Skip to content

Extending wolfIP AMD FPGA example support for full wolfBoot demo#137

Draft
dgarske wants to merge 5 commits into
wolfSSL:masterfrom
dgarske:amd_wolfboot_ota
Draft

Extending wolfIP AMD FPGA example support for full wolfBoot demo#137
dgarske wants to merge 5 commits into
wolfSSL:masterfrom
dgarske:amd_wolfboot_ota

Conversation

@dgarske

@dgarske dgarske commented Jun 16, 2026

Copy link
Copy Markdown
Member

AMD/Xilinx ZCU102: EL2 chain-load, SD-card OTA, and wolfBoot secure-boot demo

Extends the AMD/Xilinx wolfIP ports with wolfBoot chain-loading support, an on-device SD-card OTA update path for the ZCU102, and an end-to-end secure-boot + OTA demo.

What this does

  • Add EL2 chain-load support and ZC702 DDR layout to the AMD/Xilinx ports.
  • Add SD-card OTA update support to the ZCU102 wolfIP port.
  • Add a wolfBoot secure-boot + network OTA demo (src/port/amd/boards/zcu102/wolfboot-demo/): a self-contained walkthrough plus scripts that build wolfBoot for the ZynqMP SD config, sign the app v1/v2 (RSA-4096 / SHA3), assemble BOOT.BIN (FSBL + PMUFW + BL31 + wolfBoot), program an SD card, and apply a signed A/B firmware update fetched over TFTP.

The demo

Lives under the ZCU102 port as wolfboot-demo/ and is the secure-boot variant of the boot flow (FSBL -> PMUFW -> BL31 -> wolfBoot (EL2) -> signed app (EL2)), distinct from the port's stock FSBL -> app chain (bootgen/, flash_sd.sh). It builds the app in the parent directory with the OTA=1 EL=2 LAYOUT=ddr options added by this PR, and drives an external wolfBoot checkout (WOLFBOOT=, default ../wolfBoot) to sign the image and generate the boot image. The running app fetches a newer signed image over the network, writes it to the OFP_B SD partition, and resets; wolfBoot then verifies both slots and boots the higher version, rolling back if the update fails to verify.

What makes it notable: the app re-uses wolfBoot's own SD-host and disk drivers (sdhci.c, disk.c, gpt.c) compiled straight into the application via a small EL2 platform shim (sdhci_shim.c), so one driver serves both wolfBoot and the app with no runtime hand-off.

Files added:

  • build.sh - build wolfBoot + sign the app v1/v2 + assemble BOOT.BIN
  • partition-sd.sh / program-sd.sh - create the demo MBR layout and program a card
  • update.sh - stage the update image + trigger the OTA over the network
  • boot.bif.in - bootgen template for the wolfBoot chain
  • README.md - full walkthrough with expected console output

Dependencies

Testing

  • Bare-metal port (EL3, OCM) and the EL2 DDR chain-load layout build and run on the ZCU102.
  • OTA path: app fetches a signed v2 image over TFTP, stages it to OFP_B, resets, and wolfBoot boots the higher version; a tampered image fails verification and the board stays on v1.
  • Demo scripts are shell-only helpers; bash -n clean and fail-fast on missing dependencies.

@dgarske dgarske self-assigned this Jun 16, 2026
Copilot AI review requested due to automatic review settings June 16, 2026 21:27

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

Extends the AMD/Xilinx bare-metal wolfIP examples to support a full wolfBoot demo flow: running at EL2 when chain-loaded by wolfBoot, adding a ZC702 DDR memory layout option, and enabling SD-card based OTA updates on ZCU102 via TFTP + wolfBoot’s disk/SDHCI drivers compiled into the app.

Changes:

  • Add Zynq-7000 DDR linker script + LAYOUT=ocm|ddr selection to improve ZC702 throughput and support wolfBoot load address.
  • Add ZCU102 EL=2|3 selection (EL2 chain-load support) and adjust AArch64 startup/MMU code for EL2 system registers.
  • Add ZCU102 OTA path (OTA=1) with SDHCI shim, newlib syscall stubs, and a TFTP-based update stager writing OFP_B then resetting.

Reviewed changes

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

Show a summary per file
File Description
src/port/amd/README.md Updates performance table and loading notes reflecting ZC702 DDR support.
src/port/amd/common/app.c Adds optional OTA trigger via UDP “UPDATE” and calls ota_poll() in main loop.
src/port/amd/boards/zynq7000/target_ddr.ld New DDR-based linker layout aligned to wolfBoot load address.
src/port/amd/boards/zynq7000/Makefile Adds LAYOUT selector and rebuild-stamp handling for layout switches.
src/port/amd/boards/zcu102/syscalls_stub.c New minimal newlib syscall stubs for OTA builds pulling in snprintf().
src/port/amd/boards/zcu102/sdhci_shim.c New glue layer to reuse wolfBoot SDHCI/disk drivers inside the wolfIP app + reset hook.
src/port/amd/boards/zcu102/ota.h Declares OTA trigger/poll API used by the common app.
src/port/amd/boards/zcu102/ota.c Implements TFTP download → RAM staging → OFP_B write → reset sequencing.
src/port/amd/boards/zcu102/Makefile Adds EL selector and OTA=1 build path pulling in wolfBoot driver sources.
src/port/amd/boards/zcu102/board.c Updates banner to reflect whether running at EL2 or EL3.
src/port/amd/arch/armv7/mmu_armv7.c Carves DDR cacheability around DMA buffer region when DMA buffers live in DDR.
src/port/amd/arch/aarch64/startup_aarch64.S Retargets EL-specific system registers for EL2 chain-loaded entry.
src/port/amd/arch/aarch64/mmu_aarch64.c Retargets MMU control registers/TLB ops for EL2 vs EL3 builds.

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

Comment thread src/port/amd/boards/zcu102/ota.c
Comment thread src/port/amd/boards/zcu102/syscalls_stub.c
Comment thread src/port/amd/boards/zcu102/Makefile Outdated
Comment thread src/port/amd/boards/zcu102/Makefile
Comment thread src/port/amd/boards/zynq7000/Makefile Outdated

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 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread src/port/amd/boards/zcu102/syscalls_stub.c Outdated

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 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread src/port/amd/boards/zcu102/Makefile

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 20 out of 20 changed files in this pull request and generated 2 comments.

msr vbar_el3, x0
msr VBAR_ELx, x0

/* Stack pointer. After 'msr spsel, #1' this writes SP_EL3. */
Comment on lines 252 to 253
/* Snapshot exception return state in case irq_dispatch (or any
* nested exception inside it) clobbers SPSR_EL3 / ELR_EL3. */
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.

2 participants