Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,41 @@ jobs:
- name: Run Deterministic Headless Renode Test
run: |
python3 targets/Microchip/POLARFIRE_ICICLE_RENODE/scripts/test_renode.py

build-arm-nucleo:
name: Build ST Nucleo-F401RE (ARM Cortex-M4)
runs-on: ubuntu-24.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install CMake and Ninja
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build

- name: Install Pinned Arm GNU Toolchain 14.2.Rel1
run: |
wget -q https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
mkdir -p $HOME/arm-gcc
tar -xJf arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz -C $HOME/arm-gcc --strip-components=1
rm arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
echo "$HOME/arm-gcc/bin" >> $GITHUB_PATH

- name: Build NUCLEO-F401RE Demo
run: |
bash targets/STMicroelectronics/NUCLEO_F401RE/scripts/build.sh --rebuild

- name: Verify NUCLEO-F401RE Demo ELF
run: |
test -f targets/STMicroelectronics/NUCLEO_F401RE/build/app/nucleo_f401re.elf
echo "[OK] NUCLEO-F401RE demo ELF verified."

- name: Archive Built NUCLEO-F401RE ELF
uses: actions/upload-artifact@v4
with:
name: nucleo-f401re-demo-elf
path: targets/STMicroelectronics/NUCLEO_F401RE/build/app/nucleo_f401re.elf
retention-days: 1
20 changes: 0 additions & 20 deletions STMicroelectronics/NUCLEO_F401RE/app/common/board_init.h

This file was deleted.

52 changes: 0 additions & 52 deletions STMicroelectronics/NUCLEO_F401RE/app/common/console.c

This file was deleted.

80 changes: 0 additions & 80 deletions STMicroelectronics/NUCLEO_F401RE/app/common/newlib_syscalls.c

This file was deleted.

27 changes: 0 additions & 27 deletions STMicroelectronics/NUCLEO_F401RE/lib/nucleo_bsp/CMakeLists.txt

This file was deleted.

42 changes: 0 additions & 42 deletions STMicroelectronics/NUCLEO_F401RE/lib/nucleo_bsp/nucleo_bsp.c

This file was deleted.

25 changes: 0 additions & 25 deletions STMicroelectronics/NUCLEO_F401RE/lib/nucleo_bsp/nucleo_bsp.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ project(nucleo_f401re C ASM)

enable_language(ASM)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD 99)

set(SAMPLEX_ROOT_DIR
${CMAKE_CURRENT_LIST_DIR}/../../..
)

set(SHARED_LIB_DIR
${CMAKE_CURRENT_LIST_DIR}/../../libs
${SAMPLEX_ROOT_DIR}/libs
)

list(APPEND CMAKE_MODULE_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ arm-none-eabi-objdump --version
```

### CMake-Based Build
From the `STMicroelectronics/NUCLEO_F401RE` directory:
From the `targets/STMicroelectronics/NUCLEO_F401RE` directory:

```bash
cmake -Bbuild -GNinja -DCMAKE_TOOLCHAIN_FILE=cmake/arm-gcc-cortex-m4.cmake .
Expand Down Expand Up @@ -120,17 +120,19 @@ The BSP separates the ThreadX scheduler tick from the STM32 HAL timebase to avoi

ThreadX requires exclusive ownership of the SysTick exception for scheduler operation. To avoid conflicts, the STM32 HAL timebase is implemented using TIM2 instead of the default SysTick source.

The BSP overrides `HAL_InitTick()` to configure TIM2 as the HAL timebase and provides custom implementations of `HAL_SuspendTick()` and `HAL_ResumeTick()` in `board_init.c`. These functions enable and disable the TIM2 update interrupt without affecting the ThreadX scheduler tick.
The BSP overrides `HAL_InitTick()` to configure TIM2 as the HAL timebase and provides custom implementations of `HAL_SuspendTick()` and `HAL_ResumeTick()` in `lib/bsp/src/bsp_board.c`. These functions enable and disable the TIM2 update interrupt without affecting the ThreadX scheduler tick.


## File Organization

- **`app/`**: Main application logic and boot setups
- **`app/common/`**: Console serial driver and board configurations
- **`app/common/`**: Vendor HAL MSP hooks and boot sources
- **`app/common/startup/`**: Linker scripts and assembly boot startup code
- **`app/starter/`**: Demo main thread logic
- **`lib/`**: Libraries and dependencies
- **`lib/nucleo_bsp/`**: Board specific support libraries (LD2 LED)
- **`lib/bsp/`**: Board support implementing the generic `<bsp/*.h>` interfaces
(`bsp_board.c` clocks and HAL timebase, `bsp_led.c` LD2, `bsp_console.c`
USART2, `newlib_stubs.c` newlib syscall overrides)
- **`lib/stm32cubef4/`**: HAL Driver wrapper and platform drivers
- **`lib/threadx/`**: ThreadX user configuration file (`tx_user.h`)
- **`cmake/`**: Cross-compilation module definitions
Expand All @@ -140,9 +142,9 @@ The BSP overrides `HAL_InitTick()` to configure TIM2 as the HAL timebase and pro
## Validation Record

### Verification Environment
- **Toolchain**: Arm GNU Toolchain 15.2.Rel1 (GCC 15.2.1)
- **Static ROM usage**: 18244 Bytes (3.48% of 512 KB Flash)
- **Static RAM usage**: 5632 Bytes (5.73% of 96 KB RAM)
- **Toolchain**: Arm GNU Toolchain 14.2.Rel1 (GCC 14.2.1), the version pinned by CI
- **Static ROM usage**: 20120 Bytes (3.84% of 512 KB Flash)
- **Static RAM usage**: 6000 Bytes (6.10% of 96 KB RAM)
- **Dynamic Stack & Buffer allocation**: Stacks (8 x 1024 bytes) and Queue buffer (40 bytes) are dynamically allocated from the `TX_BYTE_POOL` (consuming 8312 bytes total, including pool headers).
- **Board Hardware**: NUCLEO-F401RE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
#
# SPDX-License-Identifier: MIT

if(NOT APP_CONFIG)
set(APP_CONFIG "starter")
endif()

message(STATUS "Building application with configuration: ${APP_CONFIG}")

set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
set(CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${APP_CONFIG})
set(STARTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/starter)

set(SOURCES
${COMMON_DIR}/startup/system_stm32f4xx.c
Expand All @@ -22,11 +16,11 @@ set(SOURCES

${COMMON_DIR}/stm32cubef4/stm32f4xx_hal_msp.c

${COMMON_DIR}/board_init.c
${COMMON_DIR}/console.c
${COMMON_DIR}/newlib_syscalls.c

${CONFIG_DIR}/main.c
# Newlib syscall overrides. Compiled into the executable rather than into
# libnucleo_bsp.a so the linker always takes these definitions instead of
# falling back to the libnosys stubs.
${CMAKE_CURRENT_SOURCE_DIR}/../lib/bsp/src/newlib_stubs.c
${STARTER_DIR}/main.c
)

add_executable(${PROJECT_NAME} ${SOURCES})
Expand All @@ -41,7 +35,7 @@ target_link_libraries(${PROJECT_NAME}
target_include_directories(${PROJECT_NAME}
PUBLIC
${COMMON_DIR}
${CONFIG_DIR}
${STARTER_DIR}
)

# Linker script
Expand Down
Loading
Loading