Add STM32 fault handler and watchdog safety#417
Draft
nhuvaoanh123 wants to merge 6 commits into
Draft
Conversation
nhuvaoanh123
added a commit
to nhuvaoanh123/openbsw
that referenced
this pull request
Mar 30, 2026
Add FreeRTOS Cortex-M4 port and NUCLEO-G474RE board configuration, producing the first bootable reference app binary for STM32. - FreeRTOS CM4 SysTick port (port.c, portmacro.h) for Cortex-M4F - FreeRTOS core configuration (FreeRTOSConfig.h for G474RE) - Board main: startup, clock init, UART console, task creation - StaticBsp: lifecycle hooks for BSP init/shutdown - CAN system integration (ISR handlers, CanSystem task) - Application linker script for G474RE (512 KB Flash, 128 KB SRAM) - Full Options.cmake with platform feature flags OpenBSW now supports dual-RTOS design: FreeRTOS (this PR) and ThreadX (PR 7), selectable at configure time via BUILD_TARGET_RTOS. Milestone: `cmake --build --preset nucleo-g474re-freertos-gcc` produces bootable ELF. Reference app boots on NUCLEO-G474RE with UART console output. Depends on eclipse-openbsw#417 (PR 5: safety). PR 6 of 10.
This was referenced Mar 30, 2026
07f5a04 to
a2ef49a
Compare
nhuvaoanh123
pushed a commit
to nhuvaoanh123/openbsw
that referenced
this pull request
Mar 30, 2026
Add FreeRTOS Cortex-M4 port and NUCLEO-G474RE board configuration, producing the first bootable reference app binary for STM32. - FreeRTOS CM4 SysTick port (port.c, portmacro.h) for Cortex-M4F - FreeRTOS core configuration (FreeRTOSConfig.h for G474RE) - Board main: startup, clock init, UART console, task creation - StaticBsp: lifecycle hooks for BSP init/shutdown - CAN system integration (ISR handlers, CanSystem task) - Application linker script for G474RE (512 KB Flash, 128 KB SRAM) - Full Options.cmake with platform feature flags OpenBSW now supports dual-RTOS design: FreeRTOS (this PR) and ThreadX (PR 7), selectable at configure time via BUILD_TARGET_RTOS. Milestone: `cmake --build --preset nucleo-g474re-freertos-gcc` produces bootable ELF. Reference app boots on NUCLEO-G474RE with UART console output. Depends on eclipse-openbsw#417 (PR 5: safety). PR 6 of 10.
a2ef49a to
5f8d82c
Compare
nhuvaoanh123
added a commit
to nhuvaoanh123/openbsw
that referenced
this pull request
Mar 30, 2026
Add FreeRTOS Cortex-M4 port and NUCLEO-G474RE board configuration, producing the first bootable reference app binary for STM32. - FreeRTOS CM4 SysTick port (port.c, portmacro.h) for Cortex-M4F - FreeRTOS core configuration (FreeRTOSConfig.h for G474RE) - Board main: startup, clock init, UART console, task creation - StaticBsp: lifecycle hooks for BSP init/shutdown - CAN system integration (ISR handlers, CanSystem task) - Application linker script for G474RE (512 KB Flash, 128 KB SRAM) - Full Options.cmake with platform feature flags OpenBSW now supports dual-RTOS design: FreeRTOS (this PR) and ThreadX (PR 7), selectable at configure time via BUILD_TARGET_RTOS. Milestone: `cmake --build --preset nucleo-g474re-freertos-gcc` produces bootable ELF. Reference app boots on NUCLEO-G474RE with UART console output. Depends on eclipse-openbsw#417 (PR 5: safety). PR 6 of 10.
5f8d82c to
bf188ef
Compare
nhuvaoanh123
added a commit
to nhuvaoanh123/openbsw
that referenced
this pull request
Mar 31, 2026
Add FreeRTOS Cortex-M4 port and NUCLEO-G474RE board configuration, producing the first bootable reference app binary for STM32. - FreeRTOS CM4 SysTick port (port.c, portmacro.h) for Cortex-M4F - FreeRTOS core configuration (FreeRTOSConfig.h for G474RE) - Board main: startup, clock init, UART console, task creation - StaticBsp: lifecycle hooks for BSP init/shutdown - CAN system integration (ISR handlers, CanSystem task) - Application linker script for G474RE (512 KB Flash, 128 KB SRAM) - Full Options.cmake with platform feature flags OpenBSW now supports dual-RTOS design: FreeRTOS (this PR) and ThreadX (PR 7), selectable at configure time via BUILD_TARGET_RTOS. Milestone: `cmake --build --preset nucleo-g474re-freertos-gcc` produces bootable ELF. Reference app boots on NUCLEO-G474RE with UART console output. Depends on eclipse-openbsw#417 (PR 5: safety). PR 6 of 10.
bf188ef to
9d91c4b
Compare
nhuvaoanh123
added a commit
to nhuvaoanh123/openbsw
that referenced
this pull request
Mar 31, 2026
Add FreeRTOS Cortex-M4 port and NUCLEO-G474RE board configuration, producing the first bootable reference app binary for STM32. - FreeRTOS CM4 SysTick port (port.c, portmacro.h) for Cortex-M4F - FreeRTOS core configuration (FreeRTOSConfig.h for G474RE) - Board main: startup, clock init, UART console, task creation - StaticBsp: lifecycle hooks for BSP init/shutdown - CAN system integration (ISR handlers, CanSystem task) - Application linker script for G474RE (512 KB Flash, 128 KB SRAM) - Full Options.cmake with platform feature flags OpenBSW now supports dual-RTOS design: FreeRTOS (this PR) and ThreadX (PR 7), selectable at configure time via BUILD_TARGET_RTOS. Milestone: `cmake --build --preset nucleo-g474re-freertos-gcc` produces bootable ELF. Reference app boots on NUCLEO-G474RE with UART console output. Depends on eclipse-openbsw#417 (PR 5: safety). PR 6 of 10.
794d1df to
5ddad8c
Compare
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.
9c45d95 to
f7c71d1
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
Description
Fifth PR in the STM32 platform series. Adds fault handling and watchdog safety modules.
Modules added
hardFaultHandlersafeBspMcuWatchdogsafeLifecycleMilestone
CMake configures with safety modules. Watchdog kicks and HardFault handler activates when combined with PR 6 (FreeRTOS board config).
Depends on #416 (PR 4: FDCAN transceiver). PR 5 of 10.
Related Issues
Part of STM32 platform port — see #413 for series overview.
Breaking Changes
Test Plan
CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake --preset nucleo-g474re-freertos-gccRegression Tests
Have tests been added/updated? [x] Yes [ ] No