|
| 1 | +# wolfHAL Example Board Definitions |
| 2 | + |
| 3 | +The board definitions in this directory are **examples** for use with |
| 4 | +wolfHAL's tests and sample applications. They are configured for specific |
| 5 | +development boards and are not intended for production use. Users should |
| 6 | +create their own board support packages tailored to their hardware. |
| 7 | + |
| 8 | +Each subdirectory contains a board support package (BSP) for a specific |
| 9 | +development board. A BSP provides everything needed to build wolfHAL for a |
| 10 | +given target: startup code, peripheral initialization, linker script, and |
| 11 | +build configuration. |
| 12 | + |
| 13 | +## Supported Boards |
| 14 | + |
| 15 | +| Board | Platform | CPU | Directory | |
| 16 | +|-------|----------|-----|-----------| |
| 17 | +| Microchip PIC32CZ CA Curiosity Ultra | PIC32CZ | Cortex-M7 | `pic32cz_curiosity_ultra/` | |
| 18 | +| ST NUCLEO-C031C6 | STM32C0 | Cortex-M0+ | `stm32c031_nucleo/` | |
| 19 | +| ST NUCLEO-F091RC | STM32F0 | Cortex-M0 | `stm32f091rc_nucleo/` | |
| 20 | +| ST NUCLEO-F302R8 | STM32F3 | Cortex-M4 | `stm32f302r8_nucleo/` | |
| 21 | +| WeAct BlackPill STM32F411 | STM32F4 | Cortex-M4 | `stm32f411_blackpill/` | |
| 22 | +| ST NUCLEO-H563ZI | STM32H5 | Cortex-M33 | `stm32h563zi_nucleo/` | |
| 23 | +| ST NUCLEO-WB55RG | STM32WB | Cortex-M4 | `stm32wb55xx_nucleo/` | |
| 24 | +| ST NUCLEO-L152RE | STM32L1 | Cortex-M3 | `stm32l152re_nucleo/` | |
| 25 | +| ST NUCLEO-N657X0-Q | STM32N6 | Cortex-M55 | `stm32n657a0_nucleo/` | |
| 26 | +| ST NUCLEO-WBA55CG | STM32WBA | Cortex-M33 | `stm32wba55cg_nucleo/` | |
| 27 | + |
| 28 | +## Board Directory Contents |
| 29 | + |
| 30 | +Each board directory contains: |
| 31 | + |
| 32 | +- **`board.mk`** - Build configuration: toolchain, CPU flags, platform |
| 33 | + drivers, and linker script. Included by application Makefiles via |
| 34 | + `include $(BOARD_DIR)/board.mk`. |
| 35 | +- **`board.h`** - Board-level declarations: global peripheral instances, |
| 36 | + pin definitions, and `Board_Init()`/`Board_Deinit()` prototypes. |
| 37 | +- **`board.c`** - Peripheral instantiation and `Board_Init()` implementation |
| 38 | + (power, clock, GPIO, UART, flash, timer). |
| 39 | +- **`linker.ld`** - Linker script defining memory regions (flash, RAM). |
| 40 | +- Any additional board-specific source files (e.g. interrupt vector table, |
| 41 | + architecture-specific startup code). |
| 42 | + |
| 43 | +## board.mk Convention |
| 44 | + |
| 45 | +Board `board.mk` files use a self-referencing pattern so that they can be |
| 46 | +included from any directory: |
| 47 | + |
| 48 | +```makefile |
| 49 | +_BOARD_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) |
| 50 | +``` |
| 51 | + |
| 52 | +`_BOARD_DIR` points to the board's own directory, while the application |
| 53 | +Makefile sets `BOARD_DIR` which may point elsewhere (e.g. a private board |
| 54 | +overlay). This enables private repositories to extend a board by including |
| 55 | +the base `board.mk` and adding additional sources. |
| 56 | + |
| 57 | +### What `BOARD_SOURCE` includes |
| 58 | + |
| 59 | +Board `board.mk` populates `BOARD_SOURCE` with all of the sources |
| 60 | +required to build the wolfHAL tests and sample applications for that board: |
| 61 | + |
| 62 | +- Board files: `board.c` and any additional board-specific source files |
| 63 | +- Platform / SoC drivers: e.g. `pic32cz_*.c`, `stm32wb_*.c` |
| 64 | +- Architecture support: `systick.c` and any related startup / vector code |
| 65 | +- Core wolfHAL modules and common sources: generic drivers such as |
| 66 | + `gpio.c`, `clock.c`, `uart.c`, and other files under `src/*.c` |
| 67 | + |
| 68 | +In your own projects you may either reuse these defaults by including the |
| 69 | +board `board.mk` as-is, or define your own `BOARD_SOURCE` in your |
| 70 | +application Makefile to select a different set of modules. |
| 71 | + |
| 72 | +## Adding a New Board |
| 73 | + |
| 74 | +1. Create a new directory: `boards/<vendor>_<board>/` |
| 75 | +2. Add `board.mk` following the `_BOARD_DIR` pattern above |
| 76 | +3. Implement `board.h`, `board.c`, and `linker.ld` |
| 77 | +4. Set `PLATFORM`, `TESTS`, toolchain variables, `CFLAGS`, and `BOARD_SOURCE` |
| 78 | +5. Build with `make BOARD=<your_board>` |
0 commit comments