Skip to content

Add STM32 fault handler and watchdog safety#417

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

Add STM32 fault handler and watchdog safety#417
nhuvaoanh123 wants to merge 6 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-5

Conversation

@nhuvaoanh123

Copy link
Copy Markdown
Contributor

Purpose of this PR

  • Bugfix
  • New Feature
  • Documentation Update
  • Other

Description

Fifth PR in the STM32 platform series. Adds fault handling and watchdog safety modules.

Modules added

Module Purpose
hardFaultHandler Cortex-M4 HardFault handler — captures R0–R12, LR, PC, PSR in assembly
safeBspMcuWatchdog IWDG driver with configurable timeout and kick interface
safeLifecycle Board-level SafetyManager for NUCLEO-G474RE

Milestone

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

  • Yes
  • No

Test Plan

  1. Configure: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake --preset nucleo-g474re-freertos-gcc
  2. Tests: WatchdogTest, WatchdogStressTest, SafetyManagerTest (in test sources)

Regression Tests

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

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.
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.
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.
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.
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.
@nhuvaoanh123 nhuvaoanh123 marked this pull request as draft May 1, 2026 19:17
@nhuvaoanh123 nhuvaoanh123 changed the title feat(stm32): HardFault handler and IWDG watchdog safety Add STM32 fault handler and watchdog safety Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 deleted the stm32-pr-5 branch June 2, 2026 07:48
@nhuvaoanh123 nhuvaoanh123 reopened this Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-5 branch 3 times, most recently from 794d1df to 5ddad8c Compare June 2, 2026 08:23
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-5 branch 2 times, most recently from 9c45d95 to f7c71d1 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