From 82c9e2ee43fa74abd8d2853de8ac393c084e75fd Mon Sep 17 00:00:00 2001 From: Alex Lanzano Date: Tue, 1 Sep 2026 15:10:46 -0400 Subject: [PATCH] Rename board.h to wolfHAL_board.h --- .github/workflows/test-configs.yml | 3 ++- Makefile | 4 +-- docs/wolfHAL.md | 26 +++++++++---------- hal/boards/stm32wb_nucleo/board.mk | 4 +-- .../{board.c => wolfHAL_board.c} | 10 +++---- .../{board.h => wolfHAL_board.h} | 6 ++--- hal/boards/stm32wba55cg_nucleo/board.mk | 4 +-- .../{board.c => wolfHAL_board.c} | 10 +++---- .../{board.h => wolfHAL_board.h} | 4 +-- hal/wolfhal.c | 4 +-- test-app/Makefile | 2 +- test-app/app_wolfhal.c | 4 +-- 12 files changed, 41 insertions(+), 40 deletions(-) rename hal/boards/stm32wb_nucleo/{board.c => wolfHAL_board.c} (90%) rename hal/boards/stm32wb_nucleo/{board.h => wolfHAL_board.h} (96%) rename hal/boards/stm32wba55cg_nucleo/{board.c => wolfHAL_board.c} (95%) rename hal/boards/stm32wba55cg_nucleo/{board.h => wolfHAL_board.h} (98%) diff --git a/.github/workflows/test-configs.yml b/.github/workflows/test-configs.yml index 1cad233d47..f66cbf07fa 100644 --- a/.github/workflows/test-configs.yml +++ b/.github/workflows/test-configs.yml @@ -824,7 +824,8 @@ jobs: arch: arm config-file: ./config/examples/stm32wba.config - # DEBUG_UART=1 variant: compiles the GPIO/UART drivers and board.h pin table. + # DEBUG_UART=1 variant: compiles the GPIO/UART drivers and the + # wolfHAL_board.h pin table. stm32wba_wolfhal_debug_uart_test: uses: ./.github/workflows/test-build.yml with: diff --git a/Makefile b/Makefile index 9d9f05ae8b..b523ad8199 100644 --- a/Makefile +++ b/Makefile @@ -227,9 +227,9 @@ ifeq ($(WOLFHAL),1) $(error BOARD=$(BOARD) has no hal/boards/$(BOARD)/board.mk) endif # wolfHAL backend: hal/wolfhal.o replaces hal/$(TARGET).o above. The - # board's board.c provides hal_init/hal_prepare_boot and the wolfHAL + # board's wolfHAL_board.c provides hal_init/hal_prepare_boot and the wolfHAL # device handles; board.mk pulls in chip drivers. - OBJS+=./hal/boards/$(BOARD)/board.o + OBJS+=./hal/boards/$(BOARD)/wolfHAL_board.o include hal/boards/$(BOARD)/board.mk endif diff --git a/docs/wolfHAL.md b/docs/wolfHAL.md index 162c994a4a..1c26a92316 100644 --- a/docs/wolfHAL.md +++ b/docs/wolfHAL.md @@ -30,10 +30,10 @@ The integration consists of four parts: 2. **Board directory** (`hal/boards//`) — contains three files that fully describe a board: - - `board.h` — includes the chip-specific wolfHAL driver headers and defines - any board-level pin/peripheral enums. - - `board.c` — device instances (clock, flash, GPIO, UART), configuration - structs, and `hal_init`/`hal_prepare_boot` implementations. + - `wolfHAL_board.h` — includes the chip-specific wolfHAL driver headers + and defines any board-level pin/peripheral enums. + - `wolfHAL_board.c` — device instances (clock, flash, GPIO, UART), + configuration structs, and `hal_init`/`hal_prepare_boot` implementations. - `board.mk` — build variables (`ARCH_FLASH_OFFSET`, `LSCRIPT_IN`, the `WHAL_CFG_*_API_MAPPING_*` flags, wolfHAL driver objects, `RAM_CODE` linker rules). @@ -56,16 +56,16 @@ arch.mk Makefile └─ OBJS += hal/wolfhal.o (replaces hal/$(TARGET).o) - └─ OBJS += hal/boards/$(BOARD)/board.o + └─ OBJS += hal/boards/$(BOARD)/wolfHAL_board.o └─ include hal/boards/$(BOARD)/board.mk hal/wolfhal.c (generic — calls whal_Flash_Write, whal_Uart_Send, etc.) - └─ #include "board.h" (resolved via -I to the board directory) + └─ #include "wolfHAL_board.h" (resolved via -I to the board directory) hal/boards// - ├─ board.h (includes wolfHAL driver headers, pin enums) - ├─ board.c (device instances, hal_init, hal_prepare_boot) - └─ board.mk (WHAL_CFG_*_API_MAPPING_*, driver objects, RAM_CODE rules) + ├─ wolfHAL_board.h (includes wolfHAL driver headers, pin enums) + ├─ wolfHAL_board.c (device instances, hal_init, hal_prepare_boot) + └─ board.mk (WHAL_CFG_*_API_MAPPING_*, driver objects, RAM_CODE rules) ``` The `WHAL_CFG_*_API_MAPPING_*` flags cause each wolfHAL driver source to emit @@ -95,7 +95,7 @@ See `config/examples/*_wolfhal_*.config` for complete examples. To add a new board, create a directory `hal/boards//` with three files: -### 1. `board.h` — Driver Headers and Pin Enums +### 1. `wolfHAL_board.h` — Driver Headers and Pin Enums Include the chip-specific wolfHAL driver headers and declare any board-level enums (pin indices, peripheral identifiers): @@ -109,7 +109,7 @@ enums (pin indices, peripheral identifiers): #include _gpio.h> #include _uart.h> -/* GPIO pin indices (matches pin array in board.c) */ +/* GPIO pin indices (matches pin array in wolfHAL_board.c) */ enum { BOARD_LED_PIN, BOARD_UART_TX_PIN, @@ -120,7 +120,7 @@ enum { #endif /* WOLFHAL_BOARD_H */ ``` -### 2. `board.c` — Device Instances and Initialization +### 2. `wolfHAL_board.c` — Device Instances and Initialization Define the wolfHAL device instances and implement `hal_init` and `hal_prepare_boot` using the top-level wolfHAL API. The file must export `g_wbFlash` (and `g_wbUart` @@ -129,7 +129,7 @@ when `DEBUG_UART` is enabled) as non-static globals — these are referenced by ```c #include "hal.h" -#include "board.h" +#include "wolfHAL_board.h" /* Clock controller */ whal_Clock g_wbClock = { diff --git a/hal/boards/stm32wb_nucleo/board.mk b/hal/boards/stm32wb_nucleo/board.mk index 78054d217e..5b6f832a8f 100644 --- a/hal/boards/stm32wb_nucleo/board.mk +++ b/hal/boards/stm32wb_nucleo/board.mk @@ -10,8 +10,8 @@ CFLAGS+=-DWHAL_CFG_NO_TIMEOUT CFLAGS+=-DWHAL_CFG_STM32WB_FLASH_DIRECT_API_MAPPING CFLAGS+=-DWHAL_CFG_STM32WB_GPIO_DIRECT_API_MAPPING CFLAGS+=-DWHAL_CFG_STM32WB_UART_DIRECT_API_MAPPING -# UART driver is single-instance — reads whal_Stm32wb_Uart_Dev from board.h -# instead of the passed dev pointer. +# UART driver is single-instance — reads whal_Stm32wb_Uart_Dev from +# wolfHAL_board.h instead of the passed dev pointer. CFLAGS+=-DWHAL_CFG_STM32WB_UART_SINGLE_INSTANCE WOLFHAL_OBJS+=$(WOLFHAL_ROOT)/src/reg.o diff --git a/hal/boards/stm32wb_nucleo/board.c b/hal/boards/stm32wb_nucleo/wolfHAL_board.c similarity index 90% rename from hal/boards/stm32wb_nucleo/board.c rename to hal/boards/stm32wb_nucleo/wolfHAL_board.c index b9935c5dc1..088e60b5d3 100644 --- a/hal/boards/stm32wb_nucleo/board.c +++ b/hal/boards/stm32wb_nucleo/wolfHAL_board.c @@ -1,10 +1,10 @@ -/* board.c +/* wolfHAL_board.c * * STM32WB55 Nucleo board configuration using upstream wolfHAL drivers. * Gpio/Flash/Uart singletons are instantiated by the driver .c files - * from WHAL_CFG_STM32WB_*_DEV initializer macros in board.h; board.c - * uses the BOARD_*_DEV handles for the rest. RCC is header-inlined and - * hardcodes WHAL_STM32WB_RCC_BASE — no dev pointer needed. + * from WHAL_CFG_STM32WB_*_DEV initializer macros in wolfHAL_board.h; + * wolfHAL_board.c uses the BOARD_*_DEV handles for the rest. RCC is + * header-inlined and hardcodes WHAL_STM32WB_RCC_BASE — no dev pointer needed. * * Copyright (C) 2026 wolfSSL Inc. * @@ -27,7 +27,7 @@ #include #include "hal.h" -#include "board.h" +#include "wolfHAL_board.h" #ifdef DEBUG_UART static const whal_Stm32wb_Rcc_PeriphClk g_periphClks[] = { diff --git a/hal/boards/stm32wb_nucleo/board.h b/hal/boards/stm32wb_nucleo/wolfHAL_board.h similarity index 96% rename from hal/boards/stm32wb_nucleo/board.h rename to hal/boards/stm32wb_nucleo/wolfHAL_board.h index cfe6451967..42f7fa362b 100644 --- a/hal/boards/stm32wb_nucleo/board.h +++ b/hal/boards/stm32wb_nucleo/wolfHAL_board.h @@ -1,10 +1,10 @@ -/* board.h +/* wolfHAL_board.h * * STM32WB55 Nucleo wolfHAL board header. Provides the WHAL_CFG_STM32WB_X_DEV * initializer macros that the upstream chip drivers use to instantiate the * whal_Stm32wb_X_Dev 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. + * handles that the wolfBoot adapter (hal/wolfhal.c) and wolfHAL_board.c + * pass into the wolfHAL API. * * Copyright (C) 2026 wolfSSL Inc. * diff --git a/hal/boards/stm32wba55cg_nucleo/board.mk b/hal/boards/stm32wba55cg_nucleo/board.mk index b4a935145f..800139bcea 100644 --- a/hal/boards/stm32wba55cg_nucleo/board.mk +++ b/hal/boards/stm32wba55cg_nucleo/board.mk @@ -19,8 +19,8 @@ CFLAGS+=-DWHAL_CFG_STM32WBA_FLASH_DIRECT_API_MAPPING # 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. +# UART is single-instance — reads its singleton from wolfHAL_board.h +# instead of the passed dev pointer. CFLAGS+=-DWHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE WOLFHAL_OBJS+=$(WOLFHAL_ROOT)/src/reg.o diff --git a/hal/boards/stm32wba55cg_nucleo/board.c b/hal/boards/stm32wba55cg_nucleo/wolfHAL_board.c similarity index 95% rename from hal/boards/stm32wba55cg_nucleo/board.c rename to hal/boards/stm32wba55cg_nucleo/wolfHAL_board.c index 851ee54e99..18ed99c0f5 100644 --- a/hal/boards/stm32wba55cg_nucleo/board.c +++ b/hal/boards/stm32wba55cg_nucleo/wolfHAL_board.c @@ -1,10 +1,10 @@ -/* board.c +/* wolfHAL_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. + * the WHAL_CFG_* initializer macros in wolfHAL_board.h; wolfHAL_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=24, R=3) -> SYSCLK = 100 MHz, which * requires PWR voltage scaling Range 1 and 3 flash wait states (RM0493). @@ -30,7 +30,7 @@ #include #include "hal.h" -#include "board.h" +#include "wolfHAL_board.h" /* Flash clock gate — enabled before raising the wait-state count. */ static const whal_Stm32wba_Rcc_PeriphClk g_flashClock = {WHAL_STM32WBA55_FLASH_CLOCK}; diff --git a/hal/boards/stm32wba55cg_nucleo/board.h b/hal/boards/stm32wba55cg_nucleo/wolfHAL_board.h similarity index 98% rename from hal/boards/stm32wba55cg_nucleo/board.h rename to hal/boards/stm32wba55cg_nucleo/wolfHAL_board.h index fc4ea8eb1a..4012696deb 100644 --- a/hal/boards/stm32wba55cg_nucleo/board.h +++ b/hal/boards/stm32wba55cg_nucleo/wolfHAL_board.h @@ -1,9 +1,9 @@ -/* board.h +/* wolfHAL_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 + * that the wolfBoot adapter (hal/wolfhal.c) and wolfHAL_board.c pass into the * wolfHAL API. * * The STM32WBA GPIO/UART peripherals are register-compatible with the diff --git a/hal/wolfhal.c b/hal/wolfhal.c index 4a8e33aabd..b888489526 100644 --- a/hal/wolfhal.c +++ b/hal/wolfhal.c @@ -4,7 +4,7 @@ * (hal_flash_*, uart_write) is satisfied here by forwarding to the * wolfHAL API. The chip drivers behind the wolfHAL API are singletons, * instantiated by the driver .c files from initializer macros in - * board.h; this file passes the BOARD_*_DEV handles defined there. + * wolfHAL_board.h; this file passes the BOARD_*_DEV handles defined there. * * Copyright (C) 2026 wolfSSL Inc. * @@ -28,7 +28,7 @@ #include #include "hal.h" #include "wolfboot/wolfboot.h" -#include "board.h" +#include "wolfHAL_board.h" void RAMFUNCTION hal_flash_unlock(void) { diff --git a/test-app/Makefile b/test-app/Makefile index b39a19963e..e2c38487fa 100644 --- a/test-app/Makefile +++ b/test-app/Makefile @@ -1442,7 +1442,7 @@ delta-extra-data: image.bin ../hal/uart/uart_drv_$(UART_TARGET)_ns.o: ../hal/uart/uart_drv_$(UART_TARGET).c FORCE $(Q)$(CC) $(CFLAGS) -c -o $(@) ../hal/uart/uart_drv_$(UART_TARGET).c -DNONSECURE_APP -board_$(BOARD).o: ../hal/boards/$(BOARD)/board.c +board_$(BOARD).o: ../hal/boards/$(BOARD)/wolfHAL_board.c @echo "\t[CC-$(ARCH)] $@" $(Q)$(CC) $(CFLAGS) -DDEBUG_UART -c $(OUTPUT_FLAG) $@ $< diff --git a/test-app/app_wolfhal.c b/test-app/app_wolfhal.c index b7bff95f59..7fc82483de 100644 --- a/test-app/app_wolfhal.c +++ b/test-app/app_wolfhal.c @@ -28,10 +28,10 @@ #include "wolfboot/wolfboot.h" #include "target.h" -#include "board.h" +#include "wolfHAL_board.h" /* Chip drivers behind the wolfHAL API are singletons (configured via - * board.h). Use the BOARD_*_DEV handles defined there. */ + * wolfHAL_board.h). Use the BOARD_*_DEV handles defined there. */ /* Matches all keys: * - chacha (32 + 12)