Skip to content

Move WB0 board to NUCLEO-WB09KE, rework RCC, alias WB0 GPIO - #60

Open
AlexLanzano wants to merge 1 commit into
wolfSSL:mainfrom
AlexLanzano:stm32wb0
Open

AlexLanzano wants to merge 1 commit into
wolfSSL:mainfrom
AlexLanzano:stm32wb0

Conversation

@AlexLanzano

Copy link
Copy Markdown
Member

Summary

Moves the STM32WB0 board to the part it actually runs on (NUCLEO-WB09KE), reworks the WB0 RCC driver against RM0505, and fixes several WB09 issues in the existing WB0 support.

Changes

Board

  • Rename stm32wb05kz_nucleo to stm32wb09ke_nucleo and stm32wb05kz.h to stm32wb09ke.h: 512 KB flash, 64 KB SRAM, TRNG vector at position 28
  • Linker starts RAM at 0x20000018, since RM0505 reserves 0x20000000-0x20000017 for the boot ROM
  • Run at 64 MHz from PLL64M; select LSI as the slow clock when the IWDG is enabled
  • make flash uses a new flash.tcl that programs the flash controller registers directly through OpenOCD, since ST-Link drag-and-drop fails to identify the WB09 and the bluenrg-x flash driver wedges the chip

Clock

  • RCC ready/status polls are bounded by whal_Timeout
  • Add SetSlowClock, SetLpuartClock, DisableHsi, DisablePll and a PLL lock detector setting
  • SetSysClock takes source and divider and orders the writes so 64 MHz is never requested from HSE

GPIO and UART

  • WB0 GPIO aliases the STM32WB driver; the STM32WB port stride is now WHAL_STM32WB_GPIO_PORT_SIZE (default 0x400, unchanged for existing platforms)
  • WB0 UART alias adds WHAL_STM32WB0_UART_CLK_HZ for the fixed 16 MHz USART clock

Flash

  • PAGEPROT fields are 8 bits and Lock uses two segments, so all 256 WB09 pages are protected

Testing

  • Builds clean for every board using the STM32WB GPIO driver (F0, F3, F4, H5, C0, L1, N6, U5, WB, WBA) and for stm32wb09ke_nucleo with and without WATCHDOG=iwdg
  • On a NUCLEO-WB09KE, flashed with make flash: clock, gpio, flash, timer, rng, uart and i2c suites pass (27/27)
  • flash.tcl verified with a 40 KB image spanning two staging chunks, including a partial last word

🤖 Generated with Claude Code

…O-WB09KE, rework RCC, alias WB0 GPIO

- Rename stm32wb05kz_nucleo to stm32wb09ke_nucleo and stm32wb05kz.h to
  stm32wb09ke.h to match the board's part
- Bound RCC polls with whal_Timeout; add SetSlowClock, SetLpuartClock,
  DisableHsi, DisablePll and a PLL lock detector setting; SetSysClock
  takes source and divider
- WB0 GPIO aliases the STM32WB driver through a configurable port stride
- Add the fixed 16 MHz USART clock constant to the WB0 UART alias
- Flash lock covers all 256 WB09 pages
- Linker skips the boot ROM's reserved SRAM words; add the TRNG vector
- Select LSI as the slow clock when the IWDG is enabled
- Add flash.tcl for make flash and a WB0 clock test
Copilot AI balanced review requested due to automatic review settings October 23, 2026 20:16
@AlexLanzano AlexLanzano self-assigned this Oct 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

RCC waits use an inactive timeout timebase during startup and teardown, and the new clock suite is omitted from default test builds.

1 open issue
What changed in this PR

Updates wolfHAL’s STM32WB0 support to target NUCLEO-WB09KE, corrects device-specific configuration, and reuses the shared STM32WB GPIO driver.

Changes:

  • Renames the board and platform, updating memory layout, interrupts, documentation, and CI.
  • Reworks RCC helpers, GPIO port spacing, USART clock configuration, and flash protection.
  • Adds direct-register OpenOCD flashing and clock tests.
File Description
wolfHAL/​uart/​stm32wb0_uart.h Defines the fixed USART kernel clock.
wolfHAL/​platform/​st/​stm32wb09ke.h Renames the platform and updates flash capacity.
wolfHAL/​gpio/​stm32wb0_gpio.h Aliases the shared GPIO driver with WB0 port spacing.
wolfHAL/​gpio/​stm32wb_gpio.h Makes port spacing configurable and supports WB0 mapping.
wolfHAL/​flash/​stm32wb0_flash.h Corrects WB09 flash documentation.
wolfHAL/​clock/​stm32wb0_rcc.h Adds timeout-aware polling and clock-control helpers.
tests/​gpio/​test_stm32wb0_gpio.c Reuses shared GPIO tests.
tests/​gpio/​test_stm32wb_gpio.c Uses configurable port spacing.
tests/​flash/​test_stm32wb0_flash.c Updates the reference-manual citation in a comment.
tests/​clock/​test_stm32wb0_clock.c Adds clock-state and invalid-configuration tests.
src/​gpio/​stm32wb0_gpio.c Replaces the dedicated implementation with an alias.
src/​gpio/​stm32wb_gpio.c Uses configurable spacing for register access.
src/​flash/​stm32wb0_flash.c Protects all 256 pages using two segments.
boards/​stm32wb09ke_nucleo/​wolfHAL_board.h Updates board device initializers and flash geometry.
boards/​stm32wb09ke_nucleo/​wolfHAL_board.c Updates clock setup, teardown, and peripheral references.
boards/​stm32wb09ke_nucleo/​linker.ld Configures WB09 memory and reserves boot-ROM SRAM.
boards/​stm32wb09ke_nucleo/​ivt.c Adds the TRNG interrupt vector.
boards/​stm32wb09ke_nucleo/​flash.tcl Adds chunked flash programming and verification.
boards/​stm32wb09ke_nucleo/​board.mk Routes flashing through the new OpenOCD script.
boards/​README.md Lists the renamed board.
.github/​workflows/​boards.yml Builds the renamed board in CI.

Review effort: Balanced

WHAL_EINVAL);
}

void whal_Test_Clock_Platform(void)
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.

2 participants