Skip to content

Implement support for wolfHAL I2C/SPI backends - #562

Open
AlexLanzano wants to merge 1 commit into
wolfSSL:masterfrom
AlexLanzano:wolfHAL-integration
Open

Implement support for wolfHAL I2C/SPI backends#562
AlexLanzano wants to merge 1 commit into
wolfSSL:masterfrom
AlexLanzano:wolfHAL-integration

Conversation

@AlexLanzano

@AlexLanzano AlexLanzano commented Aug 2, 2026

Copy link
Copy Markdown
Member

Add wolfHAL support

Adds a wolfHAL IO backend so wolfTPM can talk to a TPM over SPI or I2C on
targets using wolfHAL for peripheral access.

Usage

./configure --enable-wolfhal            # SPI
./configure --enable-wolfhal --enable-i2c   # I2C

Board definitions

wolfTPM does not ship board definitions. tpm_io_wolfhal.c includes
"board.h", which the application provides. A wolfHAL project already has
one, so usually only the TPM entries need adding:

Macro Bus Type
BOARD_SPI_DEV SPI whal_Spi*
BOARD_SPI_COM_CFG SPI whal_Spi_ComCfg*
BOARD_GPIO_DEV SPI whal_Gpio* (chip select)
BOARD_CS_PIN SPI pin number, active low
BOARD_I2C_DEV I2C whal_I2c*
BOARD_I2C_COM_CFG I2C whal_I2c_ComCfg* (carries the TPM address)

A missing entry is reported at compile time, naming the macro required.
See hal/README.md for details and examples.

Copilot AI review requested due to automatic review settings August 2, 2026 19:03
@AlexLanzano
AlexLanzano marked this pull request as draft August 2, 2026 19:03

Copilot AI left a comment

Copy link
Copy Markdown

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 wolfHAL-based IO backend so wolfTPM can communicate with a TPM over SPI or I2C on targets that use wolfHAL for peripheral access. This fits into the existing hal/ example callback framework and extends the build system and docs to expose the new backend as a selectable option.

Changes:

  • Add hal/tpm_io_wolfhal.c implementing SPI and I2C IO callbacks using wolfHAL and application-provided board.h definitions.
  • Wire wolfHAL into the HAL selection chain and public HAL prototypes (hal/tpm_io.c, hal/tpm_io.h).
  • Expose --enable-wolfhal in configure.ac and document usage/requirements in the root README and hal/README.md.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
README.md Documents wolfHAL as a supported platform and adds --enable-wolfhal configuration flag details.
hal/tpm_io.h Adds wolfHAL callback prototypes for SPI and I2C builds.
hal/tpm_io.c Adds wolfHAL to the platform selection chain and dispatches to wolfHAL callbacks.
hal/tpm_io_wolfhal.c New wolfHAL SPI/I2C backend implementation relying on application board.h macros.
hal/README.md Adds wolfHAL section explaining enablement and required BOARD_* definitions with examples.
hal/include.am Adds the new source file to the HAL build sources.
configure.ac Adds --enable-wolfhal option and includes it in the configure summary output.

@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 94bbc8b to 632031d Compare August 2, 2026 19:08
@AlexLanzano
AlexLanzano marked this pull request as ready for review August 2, 2026 19:11

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #562

Scan targets checked: wolftpm-bugs, wolftpm-src

No new issues found in the changed files. ✅

@AlexLanzano
AlexLanzano force-pushed the wolfHAL-integration branch from 632031d to 92e3e7d Compare August 2, 2026 19:19
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.

4 participants