Skip to content

Add STM32 ThreadX Cortex-M4 support#419

Draft
nhuvaoanh123 wants to merge 8 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-7
Draft

Add STM32 ThreadX Cortex-M4 support#419
nhuvaoanh123 wants to merge 8 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-7

Conversation

@nhuvaoanh123

Copy link
Copy Markdown
Contributor

Purpose of this PR

  • Bugfix
  • New Feature
  • Documentation Update
  • Other

Description

Seventh PR in the STM32 platform series. Adds ThreadX as an alternative RTOS alongside FreeRTOS (PR 6).

What's included

  • ThreadX Cortex-M4 GNU port: context save/restore, scheduler, timer ISR (assembly)
  • tx_port.h / tx_user.h: ThreadX configuration tuned for G474RE
  • threadXCoreConfiguration: board-level ThreadX module

Dual-RTOS design

Both FreeRTOS and ThreadX are selectable at configure time:

  • FreeRTOS: cmake --preset nucleo-g474re-freertos-gcc
  • ThreadX: cmake --preset nucleo-g474re-threadx-gcc

The main/ directory (PR 6) already includes ThreadX-specific hooks (tx_initialize_low_level.S, osHooks/threadx/).

Milestone

cmake --preset nucleo-g474re-threadx-gcc configures successfully. Same binary boots with ThreadX scheduler.

Depends on #418 (PR 6: FreeRTOS board config). PR 7 of 10.

Related Issues

Part of STM32 platform port — see #413 for series overview.

Breaking Changes

  • Yes
  • No

Test Plan

  1. Configure: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake --preset nucleo-g474re-threadx-gcc
  2. Build: cmake --build --preset nucleo-g474re-threadx-gcc
  3. Flash and verify boot with ThreadX scheduler

Regression Tests

Have tests been added/updated? [ ] Yes [x] No

nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add complete board configuration for NUCLEO-F413ZH (STM32F413ZH):
- Cortex-M4, 100 MHz, 1.5 MB Flash, 320 KB SRAM
- bxCAN peripheral (vs FDCAN on G474RE)
- Board-specific BSP configuration, safety manager, FreeRTOS/ThreadX configs
- Main application with CAN ISR handlers and lifecycle hooks
- Linker script for F413ZH memory layout

Both boards now build and boot:
- G474RE (FDCAN): `cmake --preset nucleo-g474re-freertos-gcc`
- F413ZH (bxCAN): `cmake --preset nucleo-f413zh-freertos-gcc`

Milestone: F413ZH builds and produces bootable ELF.
Depends on eclipse-openbsw#419 (PR 7: ThreadX). PR 8 of 10.
nhuvaoanh123 pushed a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add complete board configuration for NUCLEO-F413ZH (STM32F413ZH):
- Cortex-M4, 100 MHz, 1.5 MB Flash, 320 KB SRAM
- bxCAN peripheral (vs FDCAN on G474RE)
- Board-specific BSP configuration, safety manager, FreeRTOS/ThreadX configs
- Main application with CAN ISR handlers and lifecycle hooks
- Linker script for F413ZH memory layout

Both boards now build and boot:
- G474RE (FDCAN): `cmake --preset nucleo-g474re-freertos-gcc`
- F413ZH (bxCAN): `cmake --preset nucleo-f413zh-freertos-gcc`

Milestone: F413ZH builds and produces bootable ELF.
Depends on eclipse-openbsw#419 (PR 7: ThreadX). PR 8 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add complete board configuration for NUCLEO-F413ZH (STM32F413ZH):
- Cortex-M4, 100 MHz, 1.5 MB Flash, 320 KB SRAM
- bxCAN peripheral (vs FDCAN on G474RE)
- Board-specific BSP configuration, safety manager, FreeRTOS/ThreadX configs
- Main application with CAN ISR handlers and lifecycle hooks
- Linker script for F413ZH memory layout

Both boards now build and boot:
- G474RE (FDCAN): `cmake --preset nucleo-g474re-freertos-gcc`
- F413ZH (bxCAN): `cmake --preset nucleo-f413zh-freertos-gcc`

Milestone: F413ZH builds and produces bootable ELF.
Depends on eclipse-openbsw#419 (PR 7: ThreadX). PR 8 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add complete board configuration for NUCLEO-F413ZH (STM32F413ZH):
- Cortex-M4, 100 MHz, 1.5 MB Flash, 320 KB SRAM
- bxCAN peripheral (vs FDCAN on G474RE)
- Board-specific BSP configuration, safety manager, FreeRTOS/ThreadX configs
- Main application with CAN ISR handlers and lifecycle hooks
- Linker script for F413ZH memory layout

Both boards now build and boot:
- G474RE (FDCAN): `cmake --preset nucleo-g474re-freertos-gcc`
- F413ZH (bxCAN): `cmake --preset nucleo-f413zh-freertos-gcc`

Milestone: F413ZH builds and produces bootable ELF.
Depends on eclipse-openbsw#419 (PR 7: ThreadX). PR 8 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add complete board configuration for NUCLEO-F413ZH (STM32F413ZH):
- Cortex-M4, 100 MHz, 1.5 MB Flash, 320 KB SRAM
- bxCAN peripheral (vs FDCAN on G474RE)
- Board-specific BSP configuration, safety manager, FreeRTOS/ThreadX configs
- Main application with CAN ISR handlers and lifecycle hooks
- Linker script for F413ZH memory layout

Both boards now build and boot:
- G474RE (FDCAN): `cmake --preset nucleo-g474re-freertos-gcc`
- F413ZH (bxCAN): `cmake --preset nucleo-f413zh-freertos-gcc`

Milestone: F413ZH builds and produces bootable ELF.
Depends on eclipse-openbsw#419 (PR 7: ThreadX). PR 8 of 10.
@nhuvaoanh123 nhuvaoanh123 marked this pull request as draft May 1, 2026 19:17
@nhuvaoanh123 nhuvaoanh123 changed the title feat(stm32): ThreadX Cortex-M4 port — dual-RTOS support Add STM32 ThreadX Cortex-M4 support Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 deleted the stm32-pr-7 branch June 2, 2026 07:48
@nhuvaoanh123 nhuvaoanh123 reopened this Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-7 branch 4 times, most recently from 8a47a96 to f273249 Compare June 2, 2026 09:20
Import the STM32F4 and STM32G4 CMSIS device headers from
STMicroelectronics' dedicated RIM-tracked repositories. Keep only the
F413 and G474 headers needed by the STM32 MCU foundation and record
the unused upstream headers as RIM ignores.
Add the STM32 platform entry point, chip CMake files, bspMcu startup
code, a software reset wrapper, and the STM32 unit-test presets. The
platform reuses the shared CMSIS core from libs/3rdparty/cmsis
instead of carrying a local copy.
Add STM32 BSP modules for clock, UART, GPIO, timer, ADC, and EEPROM,
plus interrupt handling primitives and the ETL platform glue.
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-7 branch 2 times, most recently from 5f4c7a5 to 0fe8b05 Compare June 11, 2026 00:09
Add bxCAN and FDCAN device drivers with STM32 CAN tests.

Add the bxCAN transceiver adapter and unit-test registration.
Add the FDCAN transceiver implementation and STM32 test coverage.

Wire the FDCAN transceiver into the chip-family CMake selection.
Add the STM32 hard fault handler with RAM dump region and the IWDG
watchdog driver. Add the G474RE safety manager sources and watchdog
unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant