Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The DK CMake configuration omits its board definition, selecting incorrect clocks and UART pins, while the UART driver truncates low-baud divisors and silently transmits at the wrong rate.
2 open issues
What changed in this PR
Adds STM32H573I-DK support to the STM32H5 target and corrects shared UART clock and baud-rate handling.
Changes:
- Adds DK clock settings, console pins, LEDs, and TrustZone peripheral handoff.
- Fixes UART initialization and application interrupt/timebase handling.
- Adds example configurations, documentation, and CI build jobs.
| File | Description |
|---|---|
| tools/config.mk | Preserves the board selection in generated configuration. |
| test-app/startup_arm.c | Routes the DK’s USART1 interrupt. |
| test-app/Makefile | Selects the non-secure UART driver for TrustZone. |
| test-app/app_stm32h5.c | Adds DK LEDs and updates interrupts and timing. |
| hal/uart/uart_drv_stm32h5.c | Derives baud divisors from clocks and fixes UART setup. |
| hal/stm32h5.h | Adds board definitions and corrects peripheral mappings. |
| hal/stm32h5.c | Configures DK clocks and non-secure peripheral access. |
| docs/Targets.md | Documents DK configuration and update procedures. |
| config/examples/stm32h5-dk.config | Adds a non-TrustZone DK configuration. |
| config/examples/stm32h5-dk-tz.config | Adds a TrustZone DK configuration. |
| arch.mk | Adds the DK compile-time selection. |
| .github/workflows/test-configs.yml | Adds builds for both DK configurations. |
Review effort: Balanced
2ff61cb to
cdf10ac
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1022
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-configs.yml, CMakeLists.txt, arch.mk, config/examples/stm32h5-dk-tz.config, config/examples/stm32h5-dk.config, docs/Targets.md, hal/stm32h5.h, test-app/Makefile, tools/config.mk
Coverage: 4 of 4 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max


Adds a board option to the STM32H5 target for the STM32H573I-DK, which has a 25 MHz HSE, its ST-LINK console on USART1 (PA9/PA10) and LEDs on ports F and I.
What it adds
arch.mk,tools/config.mk-STM32H5_BOARD=h573i_dkadds-DSTM32H573I_DKhal/stm32h5.c,hal/stm32h5.h- PLL1 settings for the 25 MHz HSE, USART1 and GPIOA/GPIOI definitions, release of USART1 and the LEDs to the non-secure sidetest-app/app_stm32h5.c,test-app/startup_arm.c- board LEDs and the USART1 interrupt; interrupts enabled on entry when TrustZone is off, with the SysTick reload computed from the running clock instead of a fixed 250 MHz, and the UART interrupt clears an overrun so it cannot fire foreverconfig/examples/stm32h5-dk.config,stm32h5-dk-tz.config,docs/Targets.md, CI build jobsTouches shared code
hal/uart/uart_drv_stm32h5.c- the divisor assumed a 64 MHz clock and only came out near 115200 because the prescaler was set to divide by 4 at a 250 MHz PLL. After the clock is restored to HSI (32 MHz) the application console was unusable. The divisor is now computed from the RCC registers with the prescaler at 1, and the UART is disabled whileBRRandPRESCare written, as the reference manual requireshal/stm32h5.h- the secure alias of USART3 pointed at I2C2;uart_init()now enables the USART3 clock; on the DK, GPIOG is clocked before it is released to the non-secure sidehal/stm32h5.c- withDEBUG_UART, wait for the last byte before switching the clock backUSE_UART1=1) never worked: the branch was compiled out, LPUART1 was not clocked (APB3, not APB2), the pins used AF7 instead of AF8, one alternate-function write went to AFH, and the baud divisor lacked the LPUART factor of 256test-app/Makefile- withTZEN=1the application links a non-secure build of the UART driver instead of the bootloader's secure oneHardware / test status
STM32H573I-DK with TrustZone off and on: boot, update, rollback of an unconfirmed update, and confirm; with TrustZone off also with the PLL left running, and the application timebase measured at 1 kHz after the clock restore. NUCLEO-H563ZI with
stm32h5-tz.config: the same sequence. LPUART1 on the NUCLEO-H563ZI was checked through its registers (clock, pins, baud divisor) but not with an adapter on the D0/D1 pins. The STM32H5 emulator tests pass.Scope
No dual-bank configuration for the DK, and its external OCTOSPI flash is not used. The test application has no interrupt handler for LPUART1, so its console input works only on USART1/USART3.