Skip to content

Support for wolfBoot ZynqMP (UltraScale+ MPSoC) SD Card#699

Merged
danielinux merged 3 commits intowolfSSL:masterfrom
dgarske:zynqmp_sdcard
Mar 5, 2026
Merged

Support for wolfBoot ZynqMP (UltraScale+ MPSoC) SD Card#699
danielinux merged 3 commits intowolfSSL:masterfrom
dgarske:zynqmp_sdcard

Conversation

@dgarske
Copy link
Contributor

@dgarske dgarske commented Feb 26, 2026

Summary

Add SD card boot support for the AMD ZynqMP ZCU102 evaluation board, reusing the generic SDHCI driver framework with platform-specific adaptations for the Arasan SDHCI v3.0 controller.

New Features

  • SD card boot for ZynqMP ZCU102 using generic SDHCI driver with SD1 controller (external SD card slot)
  • MBR-based A/B partition layout: FAT32 boot (BOOT.BIN) + primary image + update image + rootfs
  • New config template: config/examples/zynqmp_sdcard.config
  • New linker script: hal/zynq_sd.ld for DDR-based wolfBoot at 0x8000000
  • New BIF file: tools/scripts/zynqmp_sd_boot.bif for BOOT.BIN generation
  • EL2-to-EL1 boot transition support via BOOT_EL1=1 for Linux kernel handoff
  • Test application UART output for app_zynq.c (prints banner, EL level, boot mode)
  • Boot debug output in do_boot() showing entry point, EL, and DTS address
  • Comprehensive documentation in docs/Targets.md with build, signing, SD provisioning, and boot mode switch settings

Fixes & Platform Adaptations

  • Legacy SDMA support: Arasan SDHCI v3.0 doesn't support HV4E mode; platform layer transparently redirects SRS22/SRS23 to SRS00 for legacy 32-bit SDMA
  • Register access width decomposition: SRS10 decomposed into 4 byte writes; SRS11 into 16-bit + 8-bit + 8-bit writes per Arasan spec
  • Card detect bypass: IOU_SLCR SD_CONFIG_REG2 slot type set to Embedded with controller reset, since ZCU102 CD pin isn't wired to SDHCI
  • DMA cache coherency: Added weak sdhci_platform_dma_prepare()/sdhci_platform_dma_complete() callbacks in generic SDHCI driver; ZynqMP implements with AArch64 dc cvac/dc civac cache maintenance
  • I-cache flush before boot: hal_prepare_boot() cleans D-cache and invalidates I-cache at load address before jumping to application
  • HV4E/A64 capability masking: SRS15 writes strip HV4E and A64 bits; SRS16 reads mask A64S capability

@dgarske dgarske self-assigned this Feb 26, 2026
Copilot AI review requested due to automatic review settings February 26, 2026 21:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds SD card boot support for the AMD Zynq UltraScale+ MPSoC (ZynqMP) platform, complementing the existing QSPI boot capability. wolfBoot can now load firmware images from MBR-partitioned SD cards using the Arasan SDHCI controller.

Changes:

  • Implements SDHCI platform support for ZynqMP with register translation between Cadence SD4HC and Arasan layouts
  • Adds conditional compilation for QSPI initialization to support SD-only boot configurations
  • Documents SD card boot setup with MBR partitioning and dual A/B firmware images

Reviewed changes

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

File Description
hal/zynq.h Adds SD/SDHCI controller base addresses and clock/reset control register definitions
hal/zynq.c Implements SDHCI platform hooks with register translation and conditional QSPI initialization
docs/Targets.md Documents SD card boot configuration, partition layout, and setup procedures
config/examples/zynqmp_sdcard.config Provides complete SD card boot configuration with MBR partition support
Comments suppressed due to low confidence (2)

config/examples/zynqmp_sdcard.config:1

  • The size specification '128M' is ambiguous in sfdisk context. sfdisk expects sector counts or explicit +size notation. Use size=+128M or calculate the sector count (262144 sectors for 128MB with 512-byte sectors) to ensure consistent partition creation across different sfdisk versions.
# wolfBoot configuration for AMD ZynqMP ZCU102 - SD Card Boot

config/examples/zynqmp_sdcard.config:1

  • The size specifications '200M' should use explicit +size notation for clarity. Use size=+200M to ensure sfdisk interprets these as size specifications rather than potential sector counts.
# wolfBoot configuration for AMD ZynqMP ZCU102 - SD Card Boot

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

Copilot AI review requested due to automatic review settings February 26, 2026 23:44
Copy link
Contributor

Copilot AI left a comment

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


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

Copy link
Contributor

Copilot AI left a comment

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


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

@dgarske dgarske marked this pull request as ready for review March 4, 2026 00:35
Copilot AI review requested due to automatic review settings March 4, 2026 00:35
Copy link
Contributor

Copilot AI left a comment

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


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

You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 4, 2026 17:19
Copy link
Contributor

Copilot AI left a comment

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


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

You can also share your feedback on Copilot code review. Take the survey.

@dgarske dgarske requested a review from danielinux March 4, 2026 17:52
@dgarske dgarske assigned danielinux and unassigned dgarske Mar 4, 2026
Copilot AI review requested due to automatic review settings March 4, 2026 18:08
Copy link
Contributor

Copilot AI left a comment

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 16 changed files in this pull request and generated 7 comments.


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

You can also share your feedback on Copilot code review. Take the survey.

@danielinux
Copy link
Member

LGTM, also fixes F/218

@danielinux danielinux merged commit 1c18481 into wolfSSL:master Mar 5, 2026
312 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.

3 participants