Skip to content

Add generic wolfHAL Ethernet port with STM32H563ZI Nucleo board support - #97

Merged
dgarske merged 2 commits into
wolfSSL:masterfrom
AlexLanzano:wolfHAL-integration
Aug 4, 2026
Merged

Add generic wolfHAL Ethernet port with STM32H563ZI Nucleo board support#97
dgarske merged 2 commits into
wolfSSL:masterfrom
AlexLanzano:wolfHAL-integration

Conversation

@AlexLanzano

@AlexLanzano AlexLanzano commented Apr 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a generic wolfIP port that bridges to wolfHAL's whal_Eth / whal_EthPhy API — any board with a wolfHAL Ethernet driver can use wolfIP with no platform-specific port code
  • Include STM32H563ZI Nucleo-144 as the first reference board (boards/stm32h563zi_nucleo)
  • Port waits for PHY link negotiation, starts the MAC with correct speed/duplex, and wires wolfIP_ll_dev poll/send to
    whal_Eth_Recv/whal_Eth_Send

Structure

src/port/wolfHAL/
├── Makefile, main.c, wolfhal_eth.c/h # Generic (board-independent)
└── boards/stm32h563zi_nucleo/ # Board-specific: clock, GPIO, ETH, UART, linker

Adding a new board requires only a boards/<name>/ directory with board.c/h, board.mk, and bare-metal startup files. The generic main.c and wolfhal_eth.c are shared across all boards.

Build

cd src/port/wolfHAL
make BOARD=stm32h563zi_nucleo

Requires arm-none-eabi-gcc and wolfHAL cloned as a sibling directory (overridable via WOLFHAL_ROOT).

Testing

I tested this by doing a ping 192.168.1.100 on my host PC. I successfully got a responses back.

Copilot AI review requested due to automatic review settings April 7, 2026 16:01
@AlexLanzano
AlexLanzano marked this pull request as draft April 7, 2026 16:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new src/port/wolfHAL/ port intended to let wolfIP run on any target that provides wolfHAL whal_Eth / whal_EthPhy, with STM32H563ZI Nucleo-144 as the first reference board and a standalone Makefile-based bare-metal build.

Changes:

  • Introduces a generic wolfHAL-based link-layer adapter (wolfhal_eth.c/.h) that bridges wolfIP ll_dev poll/send to whal_Eth_Recv / whal_Eth_Send and starts the MAC after PHY negotiation.
  • Adds a generic bare-metal main.c for bringing up wolfIP, configuring a static IPv4 address, and starting a TCP echo server.
  • Adds a complete STM32H563ZI Nucleo board package (startup/IVT/linker/board init/syscalls + board.mk) and a port-local build system + .gitignore.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/port/wolfHAL/wolfhal_eth.h Public API/docs for the generic wolfHAL Ethernet bridge.
src/port/wolfHAL/wolfhal_eth.c Implements wolfIP ll_dev poll/send via wolfHAL and link negotiation + MAC start.
src/port/wolfHAL/main.c Bare-metal reference app wiring board init + wolfIP + echo server.
src/port/wolfHAL/Makefile New Makefile entrypoint for BOARD-based builds.
src/port/wolfHAL/.gitignore Ignores build artifacts.
src/port/wolfHAL/boards/stm32h563zi_nucleo/board.mk Toolchain flags and board + wolfHAL driver source list.
src/port/wolfHAL/boards/stm32h563zi_nucleo/board.h Board API and exported wolfHAL device instances.
src/port/wolfHAL/boards/stm32h563zi_nucleo/board.c STM32H563ZI init: flash latency, clocks, GPIO, ETH/PHY, SysTick timer, UART.
src/port/wolfHAL/boards/stm32h563zi_nucleo/syscalls.c Newlib stubs + wolfIP hooks (incl. RNG).
src/port/wolfHAL/boards/stm32h563zi_nucleo/startup.c Minimal reset handler (data/bss init + libc init + main).
src/port/wolfHAL/boards/stm32h563zi_nucleo/ivt.c Cortex-M33 vector table.
src/port/wolfHAL/boards/stm32h563zi_nucleo/linker.ld Memory map and sections for STM32H563ZI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/port/wolfHAL/main.c Outdated
Comment thread src/port/wolfHAL/boards/stm32h563zi_nucleo/syscalls.c Outdated
Comment thread src/port/wolfHAL/boards/stm32h563zi_nucleo/board.c Outdated
Comment thread src/port/wolfHAL/Makefile Outdated
Comment thread src/port/wolfHAL/main.c Outdated
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from b5999a2 to 015ca06 Compare April 7, 2026 16:27
Copilot AI review requested due to automatic review settings April 7, 2026 16:38
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 015ca06 to 70ac819 Compare April 7, 2026 16:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/port/wolfHAL/boards/stm32h563zi_nucleo/board.mk Outdated
Comment thread src/port/wolfHAL/boards/stm32h563zi_nucleo/board.c Outdated
Comment thread src/port/wolfHAL/boards/stm32h563zi_nucleo/board.h
Comment thread src/port/wolfHAL/README.md Outdated
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 70ac819 to 6e50685 Compare April 7, 2026 17:08
@AlexLanzano
AlexLanzano marked this pull request as ready for review April 7, 2026 17:20
Copilot AI review requested due to automatic review settings April 7, 2026 17:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/port/wolfHAL/main.c Outdated
Comment thread src/port/wolfHAL/boards/stm32h563zi_nucleo/board.c Outdated
Comment thread src/port/wolfHAL/Makefile Outdated
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 6e50685 to fc3675e Compare April 7, 2026 18:51
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from fc3675e to 80a210f Compare April 17, 2026 18:22
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch 2 times, most recently from 9fbb31e to 878c293 Compare May 4, 2026 20:29
@dgarske dgarske removed their assignment May 4, 2026

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can wolfHAL be less intrusive? Or show what an update of the existing STM32H5 wolfIP port look for the H5? Have you compare code size between the two (existing and this)? I'd almost like to see instead a proper update to a wolfHAL version of the drivers. Not src/port/wolfHAL but src/port/stm32h5 optionally using the wolfHAL to compare.

@AlexLanzano

AlexLanzano commented May 5, 2026

Copy link
Copy Markdown
Member Author

Can wolfHAL be less intrusive? Or show what an update of the existing STM32H5 wolfIP port look for the H5? Have you compare code size between the two (existing and this)? I'd almost like to see instead a proper update to a wolfHAL version of the drivers. Not src/port/wolfHAL but src/port/stm32h5 optionally using the wolfHAL to compare.

@dgarske The nice thing about having this in a separate src/port/wolfHAL is that we can maintain a generic application and layer on things like FreeRTOS, MQTT, TLS client/servers without having to re-implement this in each port.

Having this generic wolfHAL port structure makes it much easier to port existing platforms in wolfHAL to wolfip. You just add a new entry in boards/ that contains all the platform specific config instead of spinning up a new src/port/ dir and then having to re-implement all the same application level code.

I can move all of this out of src/port/wolfHAL and into src/port/stm32h5 but this would lose a lot of the nice things that wolfHAL provides IMO

Also, I'll get this size comparison between the existing H5 port and the wolfHAL port soon

@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 878c293 to d1530a9 Compare June 3, 2026 14:49
@AlexLanzano
AlexLanzano requested a review from dgarske June 3, 2026 14:49
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch 2 times, most recently from 9009c88 to 3974801 Compare June 4, 2026 23:00
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 3974801 to 2e9c1f4 Compare July 10, 2026 19:51
@AlexLanzano AlexLanzano removed their assignment Jul 10, 2026
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 2e9c1f4 to 8fbd34f Compare July 21, 2026 21:41
@dgarske
dgarske requested a review from aidangarske July 31, 2026 17:27

@aidangarske aidangarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Skoll Code Review

Scan type: securityOverall recommendation: COMMENT
Findings: 2 total — 2 posted, 0 skipped

Posted findings

  • [Medium] Unpinned wolfHAL checkout makes the CI firmware build depend on mutable upstream HEAD.github/workflows/wolfhal-stm32h563zi-nucleo.yml:1-38
  • [Medium] wolfHAL Ethernet init failure is logged but networking still startssrc/port/stm32h563/main.c:849-1453

Review generated by Skoll

@aidangarske aidangarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Skoll Code Review

Scan type: review-securityOverall recommendation: COMMENT
Findings: 6 total — 6 posted, 0 skipped
6 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [Medium] wolfHAL syscalls omit wall-clock hooks required by TLSsrc/port/stm32h563/boards/stm32h563zi_nucleo/syscalls.c:23-121
  • [Medium] 32-bit tick wraps while wolfIP expects a monotonic 64-bit clocksrc/port/stm32h563/main.c:1095-1098
  • [Medium] wolfHAL backend conflicts with the existing DOT1X SysTick handlersrc/port/stm32h563/boards/stm32h563zi_nucleo/board.c:34-37
  • [Medium] CI builds against mutable wolfHAL HEAD.github/workflows/wolfhal-stm32h563zi-nucleo.yml:23-26
  • [Low] DEBUG_H5_ETH still references the removed STM32 Ethernet driversrc/port/stm32h563/main.c:1062-1128
  • [Low] New wolfHAL bridge has no automated behavioral coveragesrc/port/wolfHAL/wolfhal_eth.c:27-96

Review generated by Skoll

Comment thread src/port/stm32h563/boards/stm32h563zi_nucleo/syscalls.c Outdated
Comment thread src/port/stm32h563/main.c
Comment thread src/port/stm32h563/boards/stm32h563zi_nucleo/board.c
Comment thread .github/workflows/wolfhal-stm32h563zi-nucleo.yml Outdated
Comment thread src/port/stm32h563/main.c Outdated
Comment thread src/port/wolfHAL/wolfhal_eth.c
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 8fbd34f to 268a01e Compare August 2, 2026 16:31
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 268a01e to 26851f3 Compare August 2, 2026 16:40
@AlexLanzano

Copy link
Copy Markdown
Member Author

Need to wait for 64bit tick support to land in wolfHAL (PR is open here wolfSSL/wolfHAL#53) for the wolfHAL CI build checks to pass

@AlexLanzano
AlexLanzano requested a review from aidangarske August 2, 2026 17:08

@aidangarske aidangarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ran on HW and it looks good! Just a few nits you might want to cover

Comment thread .github/workflows/wolfhal-stm32h563zi-nucleo.yml
Comment thread src/port/stm32h563/main.c Outdated
Comment thread src/port/wolfHAL/README.md
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch 2 times, most recently from cb2f399 to ec2daf0 Compare August 3, 2026 22:30
@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch 2 times, most recently from ec2daf0 to 152fb65 Compare August 4, 2026 17:09
@dgarske
dgarske merged commit 994ba6f into wolfSSL:master Aug 4, 2026
49 of 75 checks passed
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.

5 participants