-
Notifications
You must be signed in to change notification settings - Fork 153
Implement port for STM32WBA. Bump wolfHAL lib to latest #799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # STM32WBA55CG Nucleo, wolfBoot on the wolfHAL backend. | ||
| # | ||
| # Flash: 1 MB at 0x08000000, 8 KB pages, 128-bit (16-byte) aligned writes. | ||
| # Non-secure / flat mode (the wolfHAL stm32wba flash driver uses the NS | ||
| # flash registers). Bootloader occupies the first 64 KB; two 128 KB | ||
| # partitions plus an 8 KB swap follow. | ||
| TARGET=stm32wba | ||
| BOARD=stm32wba55cg_nucleo | ||
| WOLFHAL=1 | ||
| ARCH=ARM | ||
| SIGN=ECC256 | ||
| HASH=SHA256 | ||
| NO_MPU=1 | ||
| WOLFBOOT_SECTOR_SIZE=0x2000 | ||
| WOLFBOOT_PARTITION_SIZE=0x20000 | ||
| WOLFBOOT_PARTITION_BOOT_ADDRESS=0x08010000 | ||
| WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x08030000 | ||
| WOLFBOOT_PARTITION_SWAP_ADDRESS=0x08050000 | ||
| NVM_FLASH_WRITEONCE=1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| /* board.c | ||
| * | ||
| * STM32WBA55CG Nucleo board configuration using upstream wolfHAL drivers. | ||
| * Flash/Gpio/Uart singletons are instantiated by the driver .c files from | ||
| * the WHAL_CFG_* initializer macros in board.h; board.c uses the | ||
| * BOARD_*_DEV handles for the rest. RCC is header-inlined and hardcodes | ||
| * its base — no dev pointer needed. | ||
| * | ||
| * Clock target: HSE32 -> PLL1 (M=1, N=25, R=3) -> SYSCLK = 100 MHz, which | ||
| * requires PWR voltage scaling Range 1 and 3 flash wait states (RM0493). | ||
| * | ||
| * Copyright (C) 2026 wolfSSL Inc. | ||
| * | ||
| * This file is part of wolfBoot. | ||
| * | ||
| * wolfBoot is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * wolfBoot is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program; if not, write to the Free Software | ||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA | ||
| */ | ||
|
|
||
| #include <stddef.h> | ||
| #include "hal.h" | ||
| #include "board.h" | ||
|
|
||
| /* Flash clock gate — enabled before raising the wait-state count. */ | ||
| static const whal_Stm32wba_Rcc_PeriphClk g_flashClock = {WHAL_STM32WBA55_FLASH_CLOCK}; | ||
|
|
||
| #ifdef DEBUG_UART | ||
| /* GPIO ports A (LED PA9, USART1 RX PA8) and B (USART1 TX PB12) plus USART1. */ | ||
| static const whal_Stm32wba_Rcc_PeriphClk g_periphClks[] = { | ||
| {WHAL_STM32WBA55_GPIOA_CLOCK}, | ||
| {WHAL_STM32WBA55_GPIOB_CLOCK}, | ||
| {WHAL_STM32WBA55_USART1_CLOCK}, | ||
| }; | ||
| #define PERIPH_CLK_COUNT (sizeof(g_periphClks) / sizeof(g_periphClks[0])) | ||
| #endif | ||
|
|
||
| /* | ||
| * Switch PWR voltage scaling to Range 1 (required for >16 MHz operation). | ||
| * After reset the device is in Range 2 (max 16 MHz). Must switch to Range 1 | ||
| * before configuring PLL or increasing SYSCLK. | ||
| * | ||
| * PWR base: 0x46020800, PWR_VOSR offset 0x00C | ||
| * bit 16 VOS: 0=Range2, 1=Range1 | ||
| * bit 15 VOSRDY: read-only, 1 when stable | ||
| */ | ||
| #define PWR_BASE 0x46020800 | ||
| #define PWR_VOSR_REG 0x00C | ||
| #define PWR_VOSR_VOS_Msk (1UL << 16) | ||
| #define PWR_VOSR_VOSRDY_Msk (1UL << 15) | ||
|
|
||
| static void set_vos_range1(void) | ||
| { | ||
| whal_Reg_Update(PWR_BASE, PWR_VOSR_REG, PWR_VOSR_VOS_Msk, PWR_VOSR_VOS_Msk); | ||
| while (!(whal_Reg_Read(PWR_BASE, PWR_VOSR_REG) & PWR_VOSR_VOSRDY_Msk)) | ||
| ; | ||
| } | ||
|
|
||
| /* HSE32 -> PLL1 (M=1, N=25, R=3 -> 100 MHz) -> SYSCLK */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 [Low] Documented PLL1 configuration / divider comment does not arithmetically yield the stated 100 MHz SYSCLK · Logic Both modes flagged that the header comment 'HSE32 -> PLL1 (M=1, N=25, R=3) -> SYSCLK = 100 MHz' does not reconcile with a textbook STM32 PLL formula where M/R equal the literal divisor: HSE32/M=1 gives a 32 MHz VCO input (outside the declared '.rge = WHAL_STM32WBA_RCC_PLL1RGE_8_16' 8-16 MHz range), and 3225/3 ~= 266 MHz, which would also over-clock the 100 MHz-max part. The numbers only reconcile to 100 MHz if the wolfHAL stm32wba_rcc driver encodes M and R as (divisor-1): m=1 -> /2 (16 MHz VCO input, matching PLL1RGE_8_16), r=3 -> /4, i.e. 32/225/4 = 100 MHz. This is most likely correct given the PR was hardware-validated, but the wolfHAL submodule is not checked out so the field encoding cannot be confirmed from the tree. Does not affect the build. Severity view differs: 'review' rated this Low (NIT/question), 'review-security' rated it Info; the stricter Low is kept here. Fix: Confirm the achieved SYSCLK against RM0493/the datasheet (must be <= 100 MHz) and the M/N/R/RGE field semantics of whal_Stm32wba_Rcc_Pll1Cfg, then add a one-line comment spelling out the (divisor-1) field encoding (e.g. 'M+1=2 -> 16 MHz VCO in; xN=25 -> 400 MHz VCO; /(R+1=4) -> 100 MHz SYSCLK') so the comment matches the literal field values. |
||
| static void pll_clock_on(void) | ||
| { | ||
| /* Enable PWR clock so the PWR registers are accessible, then move to | ||
| * voltage Range 1 (Range 2 after reset caps SYSCLK at 16 MHz). */ | ||
| static const whal_Stm32wba_Rcc_PeriphClk pwrClock = {WHAL_STM32WBA55_PWR_CLOCK}; | ||
| whal_Stm32wba_Rcc_EnablePeriphClk(&pwrClock); | ||
| set_vos_range1(); | ||
|
|
||
| /* Enable flash clock and set latency before increasing clock speed. | ||
| * 100 MHz @ 3.3V needs 3 wait states (RM0493 Table 69). */ | ||
| whal_Stm32wba_Rcc_EnablePeriphClk(&g_flashClock); | ||
| whal_Stm32wba_Flash_Ext_SetLatency(BOARD_FLASH_DEV, 3); | ||
|
|
||
| /* AHB5 max 32 MHz: prescale 100 MHz / 4 = 25 MHz (0b101 = div 4). */ | ||
| whal_Stm32wba_Rcc_SetHpre5(5); | ||
|
|
||
| whal_Stm32wba_Rcc_EnableOsc( | ||
| &(whal_Stm32wba_Rcc_OscCfg){WHAL_STM32WBA_RCC_HSE32_CFG}); | ||
| whal_Stm32wba_Rcc_EnablePll1(&(whal_Stm32wba_Rcc_Pll1Cfg){ | ||
| .clkSrc = WHAL_STM32WBA_RCC_PLL1SRC_HSE32, | ||
| .rge = WHAL_STM32WBA_RCC_PLL1RGE_8_16, | ||
| .m = 1, .n = 25, .r = 3, .q = 0, .p = 0, | ||
| }); | ||
| whal_Stm32wba_Rcc_SetSysClock(WHAL_STM32WBA_RCC_SYSCLK_SRC_PLL1); | ||
| } | ||
|
|
||
| static void pll_clock_off(void) | ||
| { | ||
| whal_Stm32wba_Rcc_SetSysClock(WHAL_STM32WBA_RCC_SYSCLK_SRC_HSI16); | ||
| whal_Stm32wba_Rcc_DisablePll1(); | ||
| whal_Stm32wba_Rcc_DisableOsc( | ||
| &(whal_Stm32wba_Rcc_OscCfg){WHAL_STM32WBA_RCC_HSE32_CFG}); | ||
| whal_Stm32wba_Flash_Ext_SetLatency(BOARD_FLASH_DEV, 1); | ||
| } | ||
|
|
||
| void hal_init(void) | ||
| { | ||
| pll_clock_on(); | ||
| whal_Flash_Init(BOARD_FLASH_DEV); | ||
|
|
||
| #ifdef DEBUG_UART | ||
| for (size_t i = 0; i < PERIPH_CLK_COUNT; i++) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ [Info] C99 mid-block for-loop declarations deviate from wolfSSL C89 style · Logic The new code uses C99-style in-loop variable declarations ('for (size_t i = 0; ...)' and 'for (size_t i = PERIPH_CLK_COUNT; i-- > 0; )') rather than declaring the index at the top of the block per wolfSSL C89 conventions. This matches the existing sibling stm32wb board.c and is not covered by the Makefile's --std=c89 cppcheck (which only scans top-level hal/*.c, not hal/boards/**), so it will not break CI, but it diverges from project style for new code. Fix: For strict C89 conformance, declare 'size_t i;' at the top of each function and use plain 'for (i = 0; ...)'. |
||
| whal_Stm32wba_Rcc_EnablePeriphClk(&g_periphClks[i]); | ||
| } | ||
|
|
||
| whal_Gpio_Init(BOARD_GPIO_DEV); | ||
| whal_Uart_Init(BOARD_UART_DEV); | ||
| #endif | ||
| } | ||
|
|
||
| void hal_prepare_boot(void) | ||
| { | ||
| #ifdef DEBUG_UART | ||
| whal_Uart_Deinit(BOARD_UART_DEV); | ||
| whal_Gpio_Deinit(BOARD_GPIO_DEV); | ||
|
|
||
| for (size_t i = PERIPH_CLK_COUNT; i-- > 0; ) { | ||
| whal_Stm32wba_Rcc_DisablePeriphClk(&g_periphClks[i]); | ||
| } | ||
| #endif | ||
|
|
||
| whal_Flash_Deinit(BOARD_FLASH_DEV); | ||
| pll_clock_off(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| /* board.h | ||
| * | ||
| * STM32WBA55CG Nucleo wolfHAL board header. Provides the WHAL_CFG_*_DEV | ||
| * initializer macros that the upstream chip drivers use to instantiate the | ||
| * device singletons (in their own .c file), plus the BOARD_X_DEV handles | ||
| * that the wolfBoot adapter (hal/wolfhal.c) and board.c pass into the | ||
| * wolfHAL API. | ||
| * | ||
| * The STM32WBA GPIO/UART peripherals are register-compatible with the | ||
| * STM32WB; the upstream stm32wba_{gpio,uart}.c TUs simply include the | ||
| * stm32wb implementation. The alias headers bridge the names: the GPIO | ||
| * alias maps WHAL_CFG_STM32WB_GPIO_DEV onto the WBA-named macro below, | ||
| * while the UART driver consumes WHAL_CFG_STM32WB_UART_DEV directly (the | ||
| * UART alias header bridges only the singleton symbol). Flash is a native | ||
| * STM32WBA driver and uses the WBA-named macro. | ||
| * | ||
| * Copyright (C) 2026 wolfSSL Inc. | ||
| * | ||
| * This file is part of wolfBoot. | ||
| * | ||
| * wolfBoot is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * wolfBoot is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program; if not, write to the Free Software | ||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA | ||
| */ | ||
|
|
||
| #ifndef WOLFHAL_BOARD_H | ||
| #define WOLFHAL_BOARD_H | ||
|
|
||
| #include <wolfHAL/wolfHAL.h> | ||
| #include <wolfHAL/platform/st/stm32wba55cg.h> | ||
| #include <wolfHAL/clock/stm32wba_rcc.h> | ||
| #include <wolfHAL/flash/stm32wba_flash.h> | ||
| #include <wolfHAL/gpio/stm32wba_gpio.h> | ||
| #include <wolfHAL/uart/stm32wba_uart.h> | ||
|
|
||
| /* GPIO pin indices used by the runtime-addressable pinCfg table. */ | ||
| enum { | ||
| BOARD_LED_PIN, | ||
| BOARD_UART_TX_PIN, | ||
| BOARD_UART_RX_PIN, | ||
| BOARD_PIN_COUNT, | ||
| }; | ||
|
|
||
| /* Singletons owned by the upstream driver .c files. Declared here so a | ||
| * handle could take their address in the future; the SINGLE_INSTANCE / | ||
| * DIRECT_API_MAPPING drivers read their static singleton directly and | ||
| * ignore the passed dev pointer. (whal_Stm32wba_{Gpio,Uart}_Dev are | ||
| * macro-aliased onto the whal_Stm32wb_* symbols by the alias headers.) */ | ||
| extern const whal_Flash whal_Stm32wba_Flash_Dev; | ||
| extern const whal_Gpio whal_Stm32wba_Gpio_Dev; | ||
| extern const whal_Uart whal_Stm32wba_Uart_Dev; | ||
|
|
||
| /* Device handles passed into the wolfHAL API. The direct-mapped / | ||
| * single-instance drivers ignore the dev pointer and read from their | ||
| * static singleton, so the INTERNAL_DEV sentinel is sufficient. */ | ||
| #define BOARD_GPIO_DEV WHAL_INTERNAL_DEV | ||
| #define BOARD_UART_DEV WHAL_INTERNAL_DEV | ||
| #define BOARD_FLASH_DEV WHAL_INTERNAL_DEV | ||
|
|
||
| /* Flash singleton initializer — instantiated by stm32wba_flash.c. | ||
| * STM32WBA55: 1 MB flash at 0x08000000, 8 KB pages, 128-bit writes. */ | ||
| #define WHAL_CFG_STM32WBA_FLASH_DEV { \ | ||
| .base = WHAL_STM32WBA55_FLASH_BASE, \ | ||
| .cfg = (void *)&(const whal_Stm32wba_Flash_Cfg){ \ | ||
| .startAddr = 0x08000000, \ | ||
| .size = 0x100000, \ | ||
| }, \ | ||
| } | ||
|
|
||
| /* GPIO singleton initializer — consumed by the stm32wb gpio driver via | ||
| * the WHAL_CFG_STM32WB_GPIO_DEV alias in stm32wba_gpio.h. */ | ||
| #define WHAL_CFG_STM32WBA_GPIO_DEV { \ | ||
| .base = WHAL_STM32WBA55_GPIO_BASE, \ | ||
| .cfg = (void *)&(const whal_Stm32wba_Gpio_Cfg){ \ | ||
| .pinCfg = (const whal_Stm32wba_Gpio_PinCfg[BOARD_PIN_COUNT]){ \ | ||
| /* LED: PA9 (LD2, green), output push-pull, low speed, pull-up */ \ | ||
| [BOARD_LED_PIN] = WHAL_STM32WBA_GPIO_PIN( \ | ||
| WHAL_STM32WBA_GPIO_PORT_A, 9, WHAL_STM32WBA_GPIO_MODE_OUT, \ | ||
| WHAL_STM32WBA_GPIO_OUTTYPE_PUSHPULL, WHAL_STM32WBA_GPIO_SPEED_LOW, \ | ||
| WHAL_STM32WBA_GPIO_PULL_UP, 0), \ | ||
| /* USART1 TX: PB12, AF7 */ \ | ||
| [BOARD_UART_TX_PIN] = WHAL_STM32WBA_GPIO_PIN( \ | ||
| WHAL_STM32WBA_GPIO_PORT_B, 12, WHAL_STM32WBA_GPIO_MODE_ALTFN, \ | ||
| WHAL_STM32WBA_GPIO_OUTTYPE_PUSHPULL, WHAL_STM32WBA_GPIO_SPEED_FAST, \ | ||
| WHAL_STM32WBA_GPIO_PULL_UP, 7), \ | ||
| /* USART1 RX: PA8, AF7 */ \ | ||
| [BOARD_UART_RX_PIN] = WHAL_STM32WBA_GPIO_PIN( \ | ||
| WHAL_STM32WBA_GPIO_PORT_A, 8, WHAL_STM32WBA_GPIO_MODE_ALTFN, \ | ||
| WHAL_STM32WBA_GPIO_OUTTYPE_PUSHPULL, WHAL_STM32WBA_GPIO_SPEED_FAST, \ | ||
| WHAL_STM32WBA_GPIO_PULL_UP, 7), \ | ||
| }, \ | ||
| .pinCount = BOARD_PIN_COUNT, \ | ||
| }, \ | ||
| } | ||
|
|
||
| /* UART singleton initializer — instantiated by stm32wb_uart.c (included by | ||
| * stm32wba_uart.c) when WHAL_CFG_STM32WB_UART_SINGLE_INSTANCE is defined. | ||
| * The UART alias header does not bridge the CFG macro, so the WB name is | ||
| * used directly here. USART1 is clocked from SYSCLK (PLL1 = 100 MHz). */ | ||
| #define WHAL_CFG_STM32WB_UART_DEV { \ | ||
| .base = WHAL_STM32WBA55_USART1_BASE, \ | ||
| .cfg = (void *)&(const whal_Stm32wba_Uart_Cfg){ \ | ||
| .brr = WHAL_STM32WBA_UART_BRR(100000000, 115200), \ | ||
| }, \ | ||
| } | ||
|
|
||
| #endif /* WOLFHAL_BOARD_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| ARCH_FLASH_OFFSET=0x08000000 | ||
| LSCRIPT_IN=hal/stm32wba.ld | ||
|
|
||
| CFLAGS+=-DWHAL_CFG_NO_TIMEOUT | ||
|
|
||
| # Upstream wolfHAL drivers from lib/wolfHAL/src/. wolfBoot's hal_flash_* | ||
| # contract is satisfied by hal/wolfhal.c (added automatically because | ||
| # WOLFHAL=1) calling whal_Flash_*. | ||
| # | ||
| # Direct API mapping binds each driver's functions straight to the | ||
| # top-level whal_* symbols (no vtable dispatch source compiled). | ||
|
|
||
| # Flash is a native STM32WBA driver — it checks the WBA-prefixed flag. | ||
| CFLAGS+=-DWHAL_CFG_STM32WBA_FLASH_DIRECT_API_MAPPING | ||
|
|
||
| # GPIO/UART reuse the STM32WB implementation (the stm32wba_*.c TUs include | ||
| # stm32wb_*.c). The UART wrapper forwards its WBA flags to the WB names, so | ||
| # it takes the WBA-prefixed flags. The GPIO wrapper does NOT forward, so the | ||
| # underlying stm32wb_gpio.c must be given the WB-prefixed flag directly. | ||
| CFLAGS+=-DWHAL_CFG_STM32WB_GPIO_DIRECT_API_MAPPING | ||
| CFLAGS+=-DWHAL_CFG_STM32WBA_UART_DIRECT_API_MAPPING | ||
| # UART is single-instance — reads its singleton from board.h instead of the | ||
| # passed dev pointer. | ||
| CFLAGS+=-DWHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE | ||
|
|
||
| WOLFHAL_OBJS+=$(WOLFHAL_ROOT)/src/reg.o | ||
| WOLFHAL_OBJS+=$(WOLFHAL_ROOT)/src/flash/stm32wba_flash.o | ||
| ifeq ($(DEBUG_UART),1) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 [Medium] DEBUG_UART path (GPIO/UART config macros + drivers) is never built in CI · test The new CI job stm32wba_wolfhal_test builds config/examples/stm32wba.config without DEBUG_UART=1. In board.mk the GPIO/UART driver objects are only added when DEBUG_UART=1, and in board.c the g_periphClks[] table, whal_Gpio_Init, and whal_Uart_Init calls are all guarded by #ifdef DEBUG_UART. Consequently the GPIO/UART singleton initializer macros in board.h (WHAL_CFG_STM32WBA_GPIO_DEV, WHAL_CFG_STM32WB_UART_DEV) and the pin/AF table are never macro-expanded or compiled in CI. A typo in those macros (wrong pin index, AF number, base symbol, or a missing wolfHAL symbol) would not be caught - only the flash path is exercised. A DEBUG_UART build would also flush out any missing-symbol regressions in the bumped lib/wolfHAL submodule (not checked out in this tree). Fix: Add a second CI variant that builds with DEBUG_UART=1 so the GPIO/UART configuration macros and the wolfHAL gpio/uart driver TUs are compiled at least once, protecting the board.h pin table from silent breakage. |
||
| WOLFHAL_OBJS+=$(WOLFHAL_ROOT)/src/gpio/stm32wba_gpio.o | ||
| WOLFHAL_OBJS+=$(WOLFHAL_ROOT)/src/uart/stm32wba_uart.o | ||
| endif | ||
|
|
||
| OBJS+=$(WOLFHAL_OBJS) | ||
| APP_OBJS+=$(WOLFHAL_OBJS) | ||
|
|
||
| # With RAM_CODE=1, place the flash driver in RAM so erase/program runs while | ||
| # the same flash bank is being modified. | ||
| ifeq ($(RAM_CODE),1) | ||
| WOLFHAL_FLASH_EXCLUDE_TEXT=*(EXCLUDE_FILE(*stm32wba_flash.o) .text*) | ||
| WOLFHAL_FLASH_EXCLUDE_RODATA=*(EXCLUDE_FILE(*stm32wba_flash.o) .rodata*) | ||
| WOLFHAL_FLASH_RAM_SECTIONS=*stm32wba_flash.o(.text* .rodata*) | ||
| endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| MEMORY | ||
| { | ||
| FLASH (rx) : ORIGIN = 0x08000000, LENGTH = @BOOTLOADER_PARTITION_SIZE@ | ||
| RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000 | ||
| } | ||
|
|
||
| SECTIONS | ||
| { | ||
| .text : | ||
| { | ||
| _start_text = .; | ||
| KEEP(*(.isr_vector)) | ||
| @WOLFHAL_FLASH_EXCLUDE_TEXT@ | ||
| @WOLFHAL_FLASH_EXCLUDE_RODATA@ | ||
| . = ALIGN(4); | ||
| _end_text = .; | ||
| } > FLASH | ||
| .edidx : | ||
| { | ||
| . = ALIGN(4); | ||
| *(.ARM.exidx*) | ||
| } > FLASH | ||
|
|
||
| _stored_data = .; | ||
| .data : AT (_stored_data) | ||
| { | ||
| _start_data = .; | ||
| KEEP(*(.data*)) | ||
| . = ALIGN(4); | ||
| KEEP(*(.ramcode)) | ||
| @WOLFHAL_FLASH_RAM_SECTIONS@ | ||
| . = ALIGN(4); | ||
| _end_data = .; | ||
| } > RAM | ||
|
|
||
| .bss (NOLOAD) : | ||
| { | ||
| _start_bss = .; | ||
| __bss_start__ = .; | ||
| *(.bss*) | ||
| *(COMMON) | ||
| . = ALIGN(4); | ||
| _end_bss = .; | ||
| __bss_end__ = .; | ||
| _end = .; | ||
| } > RAM | ||
| . = ALIGN(4); | ||
| } | ||
|
|
||
| END_STACK = ORIGIN(RAM) + LENGTH(RAM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ [Info] New config disables the MPU (NO_MPU=1), reducing defense-in-depth · Security
The example config sets NO_MPU=1, disabling wolfBoot's MPU-based region protection for the Cortex-M33. This removes a hardening layer (e.g. marking regions non-executable/read-only while the bootloader runs). This is a deliberate bring-up choice common to several wolfBoot ports and is not itself a vulnerability, but it is worth noting for a security-focused bootloader on an ARMv8-M part that supports an MPU.
Fix: Consider enabling the MPU for production builds once the port is stable, or document why it is left disabled for this target.