Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/port/stm32h563/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ CFLAGS += -I$(WOLFHAL_ROOT) -I$(BOARD_DIR) -I$(ROOT)/src/port/wolfHAL
LDSCRIPT := $(BOARD_DIR)/linker.ld

# The board dir carries its own wolfHAL-specific startup/ivt/syscalls; the
# bare-metal stm32_eth.c driver is replaced by board.c (BSP bringup) plus the
# bare-metal stm32_eth.c driver is replaced by wolfHAL_board.c (BSP bringup) plus the
# generic wolfhal_eth.c bridge.
SRCS := $(BOARD_DIR)/startup.c $(BOARD_DIR)/ivt.c syscalls.c
SRCS += main.c $(BOARD_DIR)/board.c $(ROOT)/src/port/wolfHAL/wolfhal_eth.c
SRCS += main.c $(BOARD_DIR)/wolfHAL_board.c $(ROOT)/src/port/wolfHAL/wolfhal_eth.c
Comment thread
AlexLanzano marked this conversation as resolved.
SRCS += $(ROOT)/src/wolfip.c

# wolfHAL driver selection (WHAL_CFG_* defines) + wolfHAL driver TUs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* board.c
/* wolfHAL_board.c
*
* Copyright (C) 2024-2026 wolfSSL Inc.
*
Expand All @@ -24,7 +24,7 @@

#include <stdint.h>
#include <stddef.h>
#include "board.h"
#include "wolfHAL_board.h"
#include <wolfHAL/platform/st/stm32h563xx.h>
#include <wolfHAL/eth_phy/lan8742a_eth_phy.h>

Expand Down Expand Up @@ -68,7 +68,8 @@ static const whal_Stm32h5_Rcc_PeriphClk g_ethClocks[] = {
#define ETH_CLOCK_COUNT (sizeof(g_ethClocks) / sizeof(g_ethClocks[0]))

/* Ethernet descriptor rings + buffer pool. Referenced by the ETH singleton's
* cfg (WHAL_CFG_STM32H5_ETH_DEV in board.h), so these must be global. */
* cfg (WHAL_CFG_STM32H5_ETH_DEV in wolfHAL_board.h), so these must be
* global. */
whal_Stm32h5_Eth_TxDesc ethTxDescs[BOARD_ETH_TX_DESC_COUNT]
__attribute__((aligned(16)));
whal_Stm32h5_Eth_RxDesc ethRxDescs[BOARD_ETH_RX_DESC_COUNT]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* board.h
/* wolfHAL_board.h
*
* Copyright (C) 2024-2026 wolfSSL Inc.
*
Expand All @@ -21,8 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/

#ifndef BOARD_H
#define BOARD_H
#ifndef WOLFHAL_BOARD_H
#define WOLFHAL_BOARD_H

#include <stdint.h>
#include <stddef.h>
Expand Down Expand Up @@ -139,7 +139,7 @@ enum {
}, \
}

/* ETH descriptor rings + buffer pool — defined in board.c, captured by the
/* ETH descriptor rings + buffer pool — defined in wolfHAL_board.c, captured by the
* ETH device's cfg below (expanded in the eth driver code). */
#define BOARD_ETH_TX_DESC_COUNT 3
#define BOARD_ETH_RX_DESC_COUNT 4
Expand Down Expand Up @@ -196,4 +196,4 @@ whal_Error board_init(void);
whal_Error board_deinit(void);
uint64_t board_get_tick(void);

#endif /* BOARD_H */
#endif /* WOLFHAL_BOARD_H */
2 changes: 1 addition & 1 deletion src/port/stm32h563/dot1x_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "dot1x_certs.h"

#ifdef ENABLE_WOLFHAL
#include "board.h"
#include "wolfHAL_board.h"
#endif

#define DOT1X_EAPOL_ETHERTYPE 0x888EU
Expand Down
2 changes: 1 addition & 1 deletion src/port/stm32h563/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "config.h"
#include "wolfip.h"
#ifdef ENABLE_WOLFHAL
#include "board.h"
#include "wolfHAL_board.h"
Comment thread
AlexLanzano marked this conversation as resolved.
#include "wolfhal_eth.h"
#include <wolfHAL/uart/uart.h>
#include <wolfHAL/rng/rng.h>
Expand Down
2 changes: 1 addition & 1 deletion src/port/stm32h563/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <time.h>
#ifdef ENABLE_WOLFHAL
#include <wolfHAL/uart/uart.h>
#include "board.h" /* g_whalUart for _write -> UART */
#include "wolfHAL_board.h" /* g_whalUart for _write -> UART */
#endif

extern uint32_t _ebss;
Expand Down
15 changes: 8 additions & 7 deletions src/port/wolfHAL/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ flow used by `TZEN=1`, and the wolfHAL SysTick driver owns the SysTick
handler that FreeRTOS also needs.

`ENABLE_WOLFHAL=1` selects `boards/stm32h563zi_nucleo/` (its own
`startup.c`/`ivt.c`/`syscalls.c`/`linker.ld` plus `board.c`/`board.h`/`board.mk`),
pulls the wolfHAL STM32H5 driver TUs from the `lib/wolfHAL` submodule
(`WOLFHAL_ROOT ?= lib/wolfHAL`), and compiles the port's `main.c` against
wolfHAL drivers instead of the hand-rolled bare-metal ones.
`startup.c`/`ivt.c`/`syscalls.c`/`linker.ld` plus
`wolfHAL_board.c`/`wolfHAL_board.h`/`board.mk`), pulls the wolfHAL STM32H5
driver TUs from the `lib/wolfHAL` submodule (`WOLFHAL_ROOT ?= lib/wolfHAL`), and
compiles the port's `main.c` against wolfHAL drivers instead of the hand-rolled
bare-metal ones.

Initialize the submodule once with

Expand Down Expand Up @@ -67,9 +68,9 @@ int ret = wolfhal_eth_init(wolfIP_getdev(ipstack), &ctx);

## What a board must provide

The bridge needs the hardware already brought up. A board's `board.c`
(see `src/port/stm32h563/boards/stm32h563zi_nucleo/board.c`) must, before
`wolfhal_eth_init` is called:
The bridge needs the hardware already brought up. A board's `wolfHAL_board.c`
(see `src/port/stm32h563/boards/stm32h563zi_nucleo/wolfHAL_board.c`) must,
before `wolfhal_eth_init` is called:

- Initialize clocks and GPIO, then call `whal_Eth_Init` / `whal_EthPhy_Init`
(typically from `board_init()`).
Expand Down
2 changes: 1 addition & 1 deletion src/port/wolfHAL/wolfhal_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

#include "wolfhal_eth.h"
#include "board.h"
#include "wolfHAL_board.h"
#include <string.h>

#ifndef WOLFHAL_ETH_LINK_TIMEOUT_MS
Expand Down
2 changes: 1 addition & 1 deletion src/port/wolfHAL/wolfhal_eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @code
* #include "wolfip.h"
* #include "wolfhal_eth.h"
* #include "board.h"
* #include "wolfHAL_board.h"
*
* int main(void)
* {
Expand Down
Loading