Skip to content
Merged
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
24 changes: 24 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,30 @@ jobs:
config-file: ./config/examples/s32g2-goldbox.config
make-args: S32G2_QSPI=1 S32G2_QSPI_PROGRAM_FILE=/s32g2_qspi_boot.bin wolfboot.bin

s32g2_hse_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
# HSE host interface: firmware state reported at boot; PCIe0 PHY setup.
config-file: ./config/examples/s32g2-goldbox.config
make-args: NXP_HSE=1 S32G2_SERDES=1 wolfboot.bin

s32g2_hse_provision_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
# HSE provisioning from the NOR first stage, system image stored.
config-file: ./config/examples/s32g2-goldbox-qspi.config
make-args: NXP_HSE=1 NXP_HSE_PROVISION=1 NXP_HSE_SYSIMG_OFFSET=0xC0000 wolfboot.bin

s32g2_hse_rehearsal_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
# HSE provisioning rehearsal: nothing stored.
config-file: ./config/examples/s32g2-goldbox-qspi.config
make-args: NXP_HSE=1 NXP_HSE_PROVISION=1 wolfboot.bin

disk_boot_confirm_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ tools/unit-tests/unit-update-disk-fs-confirm
tools/unit-tests/unit-update-disk-fs-confirm-fdt
tools/unit-tests/unit-psci
tools/unit-tests/unit-s32g2-nor-update
tools/unit-tests/unit-nxp-hse
tools/unit-tests/unit-nxp-hse-addr32
tools/unit-tests/ext4-min.img
tools/unit-tests/ext4-stock.img
tools/unit-tests/ext4-payload.bin
Expand Down
30 changes: 30 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,30 @@ ifeq ($(ARCH),AARCH64)
endif
CFLAGS+=-DS32G2_USDHC_MAX_CLK_KHZ=$(S32G2_USDHC_MAX_CLK_KHZ)
endif
ifeq ($(NXP_HSE_PROVISION),1)
ifneq ($(NXP_HSE)/$(S32G2_QSPI),1/1)
$(error NXP_HSE_PROVISION=1 needs NXP_HSE=1 and S32G2_QSPI=1)
endif
else
ifneq ($(NXP_HSE_SYSIMG_OFFSET),)
$(error NXP_HSE_SYSIMG_OFFSET needs NXP_HSE_PROVISION=1)
endif
endif
# Report the NXP HSE firmware's state at boot (s32g2_mkimage.py --hse-fw).
ifeq ($(NXP_HSE),1)
Comment thread
dgarske marked this conversation as resolved.
Resolved
CFLAGS+=-DNXP_HSE
OBJS+=hal/nxp_hse.o
ifeq ($(NXP_HSE_PROVISION),1)
CFLAGS+=-DNXP_HSE_PROVISION
ifneq ($(NXP_HSE_SYSIMG_OFFSET),)
CFLAGS+=-DNXP_HSE_SYSIMG_OFFSET=$(NXP_HSE_SYSIMG_OFFSET)
endif
endif
endif
# PCIe0 PHY setup, for kernels that expect it from the boot loader
ifeq ($(S32G2_SERDES),1)
CFLAGS+=-DS32G2_SERDES
endif
# QuadSPI NOR driver (the ext_flash API with EXT_FLASH=1)
ifeq ($(S32G2_QSPI),1)
CFLAGS+=-DS32G2_QSPI
Expand Down Expand Up @@ -560,6 +584,12 @@ ifeq ($(ARCH),AARCH64)
endif
endif

ifneq ($(TARGET),s32g2)
ifneq ($(filter 1,$(NXP_HSE) $(NXP_HSE_PROVISION) $(S32G2_SERDES))$(NXP_HSE_SYSIMG_OFFSET),)
$(error NXP_HSE, NXP_HSE_PROVISION, NXP_HSE_SYSIMG_OFFSET and S32G2_SERDES need TARGET=s32g2)
endif
endif

## ARM Cortex-M
ifeq ($(ARCH),ARM)
CROSS_COMPILE?=arm-none-eabi-
Expand Down
238 changes: 238 additions & 0 deletions docs/NXP_HSE.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ See also: [wolfBoot Product Overview](https://www.wolfssl.com/products/wolfboot/
- [**MCXN947-DICE.md**](./MCXN947-DICE.md) - DICE / PSA initial attestation sample on NXP MCXN947 using the EdgeLock Secure Subsystem.
- [**measured_boot.md**](./measured_boot.md) - Measured boot concepts and recording measurements (e.g., PCRs).
- [**png/**](./png) - Folder of images/diagrams referenced by the documentation.
- [**NXP_HSE.md**](./NXP_HSE.md) - NXP Hardware Security Engine (HSE) secure boot: the HSE host driver, provisioning steps on the S32G2, what is permanent, recovery.
- [**PolarFire.md**](./PolarFire.md) - Microchip PolarFire SoC: quick start, boot configurations, sNVM/PUF key storage, SBI vendor extension, boot mode 2.
- [**PQ.md**](./PQ.md) - Post-quantum algorithms and PQC support in wolfBoot.
- [**README.md**](./README.md) - Overview and index of the documentation set.
Expand Down
24 changes: 23 additions & 1 deletion docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -11369,10 +11369,32 @@ Measured on a GoldBox with the example configurations as they are (`DEBUG=0`, wo
| QuadSPI NOR | 143872 bytes | 0.43 | 0.93 | 1.34 | 2.31 |

`DEBUG_UART=0` removes the wolfBoot console and 8 to 12 KB. `DEBUG=1` builds without optimization for debugging: the image grows by 53 to 66 KB and the kernel is entered about 1.5 s later.
### HSE secure boot

Without HSE the chain of trust starts at wolfBoot: the Boot ROM loads it unchecked, and wolfBoot verifies the FIT. With NXP's Hardware Security Engine (HSE) firmware and secure boot switched on, HSE verifies wolfBoot (ECDSA P-256) and only then releases Cortex-A53 core 0 into it.

**[NXP_HSE.md](NXP_HSE.md) is the documentation for this feature**: what HSE needs, the steps with their console output, what is permanent, recovery and limits. The tables below are the summary.

| Build option | Effect |
|---|---|
| `NXP_HSE=1` | Builds the HSE host driver and reports the HSE state at boot. |
| `NXP_HSE_PROVISION=1` | Gives HSE the key, the SMR and the core reset entry at boot. On its own a rehearsal that stores nothing. |
| `NXP_HSE_SYSIMG_OFFSET=<offset>` | With `NXP_HSE_PROVISION=1`: stores HSE's system image in the NOR at this offset. |

| `s32g2_mkimage.py` option | Effect |
|---|---|
| `--hse-fw <firmware>` | Places the HSE firmware in the image and points the IVT at it. |
| `--hse-sign <P-256 key.pem>` | Signs the code the ROM loads for HSE. |
| `--hse-sysimg <offset>` | Points the IVT at the stored system image. |
| `--hse-efuse` | Switches the fuse programming supply on in the DCD. |
| `--hse-boot-seq` | Sets the secure boot bit. |

Validated on a GoldBox (S32G274A rev 2.1) with the HSE Standard firmware 0.1.0.5, booting from QuadSPI NOR, in the development lifecycle. Provisioning advances HSE's anti-rollback fuse counter by one step; a plain image without HSE still boots afterwards. The HSE firmware comes from NXP and is not part of wolfBoot.

### Known limitations

- Inline DRAM ECC, HSE secure boot and chain-loading BL31 (for kernels that need SCMI or PSCI power states) are not implemented.
- Inline DRAM ECC and chain-loading BL31 (for kernels that need SCMI or PSCI power states) are not implemented.
- The SerDes is not initialized by default. NXP BSP 27 and 28 kernels expect the boot loader to have set up the PCIe PHY and otherwise stop with `u-boot did not initialize PCIE PHY`; later BSP kernels set it up themselves. `S32G2_SERDES=1` makes wolfBoot bring up SerDes0 as PCIe0 (both lanes, root complex, the board's 100 MHz reference clock) and leave link training to the kernel. With no device fitted that kernel waits about 2 s for a link. Validated with the slot empty: the kernel's driver starts and registers the root port; a link to a device was not tested. SerDes1 (PCIe1, SGMII) is not set up.

## NXP i.MX95 Cortex-M7

Expand Down
Loading
Loading