Skip to content

Commit fa67e5e

Browse files
committed
Support for wolfBoot ZynqMP (UltraScale+ MPSoC) SD Card
1 parent 2277dfa commit fa67e5e

File tree

15 files changed

+1168
-35
lines changed

15 files changed

+1168
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,4 @@ image.ub
343343
*.pdi
344344
system-default.dtb
345345
test_output/
346+
sdcard.img

arch.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ ifeq ($(ARCH),AARCH64)
7878
HASH_HAL=1
7979
CFLAGS+=-DWOLFBOOT_ZYNQMP_CSU
8080
endif
81+
8182
endif
8283

8384
ifeq ($(TARGET),versal)
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# wolfBoot configuration for AMD ZynqMP ZCU102 - SD Card Boot
2+
# Zynq UltraScale+ MPSoC ZU9EG - Quad-core ARM Cortex-A53
3+
#
4+
# This configuration enables SD card boot for the ZynqMP:
5+
# FSBL -> PMUFW -> BL31 (EL3) -> wolfBoot (EL2) -> Linux (EL1)
6+
#
7+
# wolfBoot loads firmware images from MBR partitions on SD card.
8+
# Uses the generic SDHCI driver with SD1 controller (external SD slot on ZCU102).
9+
10+
ARCH?=AARCH64
11+
TARGET?=zynq
12+
13+
WOLFBOOT_VERSION?=0
14+
15+
# RSA 4096-bit with SHA3-384 (matching existing zynqmp.config)
16+
SIGN?=RSA4096
17+
HASH?=SHA3
18+
IMAGE_HEADER_SIZE?=1024
19+
20+
# Debug options
21+
DEBUG?=1
22+
DEBUG_SYMBOLS=1
23+
DEBUG_UART=1
24+
CFLAGS_EXTRA+=-DDEBUG_ZYNQ=1
25+
26+
# SD card support - use SDHCI driver
27+
DISK_SDCARD?=1
28+
DISK_EMMC?=0
29+
# ZynqMP Arasan SDHCI does not support CDSS/CDTL card detect test level.
30+
# Since FSBL booted from the same SD card, we know it is present.
31+
CFLAGS_EXTRA+=-DSDHCI_FORCE_CARD_DETECT
32+
# Note: Arasan SDHCI v3.0 does not support HV4E mode. The platform layer
33+
# in hal/zynq.c transparently redirects SRS22/SRS23 to SRS00 for legacy SDMA.
34+
35+
# Disable QSPI flash when using SD card
36+
EXT_FLASH?=0
37+
NO_XIP=1
38+
39+
# ELF loading support
40+
ELF?=1
41+
42+
# Boot Exception Level: transition from EL2 -> EL1 before jumping to app
43+
BOOT_EL1?=1
44+
45+
# General options
46+
VTOR?=1
47+
CORTEX_M0?=0
48+
NO_ASM?=0
49+
ALLOW_DOWNGRADE?=0
50+
NVM_FLASH_WRITEONCE?=0
51+
V?=0
52+
SPMATH?=1
53+
RAM_CODE?=0
54+
DUALBANK_SWAP?=0
55+
PKA?=0
56+
WOLFTPM?=0
57+
58+
# Toolchain
59+
USE_GCC=1
60+
CROSS_COMPILE=aarch64-none-elf-
61+
62+
# ============================================================================
63+
# Partition Layout - MBR
64+
# ============================================================================
65+
# SD Card partition layout (MBR):
66+
# Partition 1: boot (128MB, FAT32 LBA, bootable) - BOOT.BIN
67+
# Partition 2: OFP_A (200MB, Linux) - Primary signed image
68+
# Partition 3: OFP_B (200MB, Linux) - Update signed image
69+
# Partition 4: rootfs (remainder) - Linux root filesystem
70+
#
71+
# Use partition numbers instead of flash addresses
72+
# These are 0-based indices into the parsed partition array:
73+
# part[0]=boot, part[1]=OFP_A, part[2]=OFP_B, part[3]=rootfs
74+
WOLFBOOT_NO_PARTITIONS=1
75+
CFLAGS_EXTRA+=-DBOOT_PART_A=1
76+
CFLAGS_EXTRA+=-DBOOT_PART_B=2
77+
78+
# Disk read chunk size (512KB)
79+
CFLAGS_EXTRA+=-DDISK_BLOCK_SIZE=0x80000
80+
81+
# Linux rootfs is on partition 4 (SD1 = mmcblk1)
82+
CFLAGS_EXTRA+=-DLINUX_BOOTARGS_ROOT=\"/dev/mmcblk1p4\"
83+
84+
# ============================================================================
85+
# Boot Memory Layout
86+
# ============================================================================
87+
# wolfBoot runs from DDR at 0x8000000 (same as U-Boot, loaded via BL31)
88+
WOLFBOOT_ORIGIN=0x8000000
89+
90+
# Load Partition to RAM Address (Linux kernel loads here)
91+
WOLFBOOT_LOAD_ADDRESS?=0x10000000
92+
93+
# DTS (Device Tree) load address
94+
WOLFBOOT_LOAD_DTS_ADDRESS?=0x1000
95+
96+
# ============================================================================
97+
# Required for test-app (even with WOLFBOOT_NO_PARTITIONS=1)
98+
# ============================================================================
99+
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80200000
100+
WOLFBOOT_PARTITION_SIZE=0x4000000
101+
WOLFBOOT_SECTOR_SIZE=0x1000
102+
103+
# ============================================================================
104+
# Optional Debug Options (uncomment to enable)
105+
# ============================================================================
106+
# SDHCI driver debug logs
107+
#CFLAGS_EXTRA+=-DDEBUG_SDHCI
108+
# Disk layer debug logs
109+
#CFLAGS_EXTRA+=-DDEBUG_DISK
110+
# GPT partition debug logs
111+
#CFLAGS_EXTRA+=-DDEBUG_GPT
112+
# Disk read/write test at boot
113+
#CFLAGS_EXTRA+=-DDISK_TEST

0 commit comments

Comments
 (0)