Skip to content

Add STM32 G474RE FreeRTOS board config#418

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

Add STM32 G474RE FreeRTOS board config#418
nhuvaoanh123 wants to merge 7 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-6

Conversation

@nhuvaoanh123

Copy link
Copy Markdown
Contributor

Purpose of this PR

  • Bugfix
  • New Feature
  • Documentation Update
  • Other

Description

Sixth PR in the STM32 platform series. This is the key integration PR — it produces the first bootable reference app binary for NUCLEO-G474RE.

What's included

  • FreeRTOS Cortex-M4 SysTick port (port.c, portmacro.h)
  • FreeRTOS core configuration with FreeRTOSConfig.h tuned for G474RE (170 MHz, 128 KB SRAM)
  • Board main (main.cpp): clock init → UART console → FreeRTOS scheduler start
  • StaticBsp: lifecycle hooks for BSP initialization and shutdown
  • CAN system integration (ISR handlers, CanSystem task)
  • Application linker script for G474RE (512 KB Flash, 128 KB SRAM)
  • Options.cmake: full platform feature flags

Dual-RTOS architecture

OpenBSW supports both FreeRTOS and ThreadX on STM32, selectable at configure time via BUILD_TARGET_RTOS. This PR adds FreeRTOS; PR 7 adds ThreadX. The main/ directory contains RTOS-specific hooks in separate subdirectories (osHooks/freertos/, osHooks/threadx/).

Milestone

cmake --build --preset nucleo-g474re-freertos-gcc produces a bootable ELF (6.5 MB with debug info). Reference app boots on NUCLEO-G474RE with UART console output at 115200 baud.

Depends on #417 (PR 5: safety). PR 6 of 10.

Related Issues

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

Breaking Changes

  • Yes
  • No

Test Plan

  1. Build: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake --preset nucleo-g474re-freertos-gcc && cmake --build --preset nucleo-g474re-freertos-gcc
  2. Flash to NUCLEO-G474RE via ST-LINK
  3. Open UART terminal (115200/8N1) — verify console output
  4. Verify FreeRTOS scheduler starts and tasks run

Regression Tests

Have tests been added/updated? [ ] Yes [x] No — this PR enables on-target testing; HIL tests in PR 10

nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add ThreadX RTOS support as an alternative to FreeRTOS for STM32 platforms:

- ThreadX Cortex-M4 GNU port (context save/restore, scheduler, timer ISR)
- tx_port.h and tx_user.h configuration for G474RE
- ThreadX core configuration module for NUCLEO-G474RE
- Updated platform CMakeLists for dual-RTOS selection

Build with: `cmake --preset nucleo-g474re-threadx-gcc`

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

Milestone: `cmake --preset nucleo-g474re-threadx-gcc` configures successfully.
Depends on eclipse-openbsw#418 (PR 6: FreeRTOS board config). PR 7 of 10.
nhuvaoanh123 pushed a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add ThreadX RTOS support as an alternative to FreeRTOS for STM32 platforms:

- ThreadX Cortex-M4 GNU port (context save/restore, scheduler, timer ISR)
- tx_port.h and tx_user.h configuration for G474RE
- ThreadX core configuration module for NUCLEO-G474RE
- Updated platform CMakeLists for dual-RTOS selection

Build with: `cmake --preset nucleo-g474re-threadx-gcc`

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

Milestone: `cmake --preset nucleo-g474re-threadx-gcc` configures successfully.
Depends on eclipse-openbsw#418 (PR 6: FreeRTOS board config). PR 7 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add ThreadX RTOS support as an alternative to FreeRTOS for STM32 platforms:

- ThreadX Cortex-M4 GNU port (context save/restore, scheduler, timer ISR)
- tx_port.h and tx_user.h configuration for G474RE
- ThreadX core configuration module for NUCLEO-G474RE
- Updated platform CMakeLists for dual-RTOS selection

Build with: `cmake --preset nucleo-g474re-threadx-gcc`

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

Milestone: `cmake --preset nucleo-g474re-threadx-gcc` configures successfully.
Depends on eclipse-openbsw#418 (PR 6: FreeRTOS board config). PR 7 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add ThreadX RTOS support as an alternative to FreeRTOS for STM32 platforms:

- ThreadX Cortex-M4 GNU port (context save/restore, scheduler, timer ISR)
- tx_port.h and tx_user.h configuration for G474RE
- ThreadX core configuration module for NUCLEO-G474RE
- Updated platform CMakeLists for dual-RTOS selection

Build with: `cmake --preset nucleo-g474re-threadx-gcc`

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

Milestone: `cmake --preset nucleo-g474re-threadx-gcc` configures successfully.
Depends on eclipse-openbsw#418 (PR 6: FreeRTOS board config). PR 7 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add ThreadX RTOS support as an alternative to FreeRTOS for STM32 platforms:

- ThreadX Cortex-M4 GNU port (context save/restore, scheduler, timer ISR)
- tx_port.h and tx_user.h configuration for G474RE
- ThreadX core configuration module for NUCLEO-G474RE
- Updated platform CMakeLists for dual-RTOS selection

Build with: `cmake --preset nucleo-g474re-threadx-gcc`

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

Milestone: `cmake --preset nucleo-g474re-threadx-gcc` configures successfully.
Depends on eclipse-openbsw#418 (PR 6: FreeRTOS board config). PR 7 of 10.
@nhuvaoanh123 nhuvaoanh123 marked this pull request as draft May 1, 2026 19:17
@nhuvaoanh123 nhuvaoanh123 changed the title feat(stm32): FreeRTOS board config — first bootable G474RE binary Add STM32 G474RE FreeRTOS board config Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 deleted the stm32-pr-6 branch June 2, 2026 07:48
@nhuvaoanh123 nhuvaoanh123 reopened this Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-6 branch 4 times, most recently from 852a562 to c128d70 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-6 branch 2 times, most recently from 41d1aa2 to 5441298 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