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
23 changes: 23 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1332,12 +1332,35 @@ jobs:
arch: aarch64
config-file: ./config/examples/versal_vmk180.config

versal_vmk180_highddr_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
config-file: ./config/examples/versal_vmk180_highddr.config

versal_vmk180_sdcard_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
config-file: ./config/examples/versal_vmk180_sdcard.config

# FIT read from a filesystem with no kernel load/entry and no fdt
# sub-image, so the staging addresses come from the build.
versal_vmk180_sdcard_fit_file_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
config-file: ./config/examples/versal_vmk180_sdcard.config
make-args: DISK_FS=fat32 FIT_RAMDISK=1 WOLFBOOT_LOAD_KERNEL_ADDRESS=0x200000 WOLFBOOT_LOAD_RAMDISK_ADDRESS=0x40000000

# Same, with every address moved into a high DDR aperture.
versal_vmk180_sdcard_fit_file_highddr_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
config-file: ./config/examples/versal_vmk180_sdcard.config
make-args: DISK_FS=fat32 FIT_RAMDISK=1 DDR_HIGH_BASE=0x40000000000 DDR_HIGH_SIZE=0x10000000000 NO_DDR_LOW=1 WOLFBOOT_ORIGIN=0x40000800000 WOLFBOOT_LOAD_ADDRESS=0x40010000000 WOLFBOOT_LOAD_DTS_ADDRESS=0x40000001000 WOLFBOOT_LOAD_KERNEL_ADDRESS=0x40002000000 WOLFBOOT_LOAD_RAMDISK_ADDRESS=0x40030000000

versal_vmk180_sdcard_fs_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,6 @@ include/target.h: $(TARGET_H_TEMPLATE) FORCE
sed -e "s/@WOLFBOOT_DTS_UPDATE_ADDRESS@/$(WOLFBOOT_DTS_UPDATE_ADDRESS)/g" | \
sed -e "s/@WOLFBOOT_LOAD_ADDRESS@/$(WOLFBOOT_LOAD_ADDRESS)/g" | \
sed -e "s/@WOLFBOOT_LOAD_DTS_ADDRESS@/$(WOLFBOOT_LOAD_DTS_ADDRESS)/g" | \
sed -e "s/@WOLFBOOT_LOAD_RAMDISK_ADDRESS@/$(WOLFBOOT_LOAD_RAMDISK_ADDRESS)/g" | \
sed -e "s/@WOLFBOOT_LOAD_FPGA_ADDRESS@/$(WOLFBOOT_LOAD_FPGA_ADDRESS)/g" | \
sed -e "s|@WOLFBOOT_RAMBOOT_MAX_SIZE_DEFINE@|$(if $(strip $(WOLFBOOT_RAMBOOT_MAX_SIZE)),#define WOLFBOOT_RAMBOOT_MAX_SIZE $(WOLFBOOT_RAMBOOT_MAX_SIZE),/* WOLFBOOT_RAMBOOT_MAX_SIZE undefined */)|g" | \
sed -e "s/@WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS@/$(WOLFBOOT_PARTITION_SELF_HEADER_ADDRESS)/g" \
> $@
Expand Down
38 changes: 26 additions & 12 deletions config/examples/versal_vmk180.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ WOLFTPM?=0
EXT_FLASH?=1
NO_XIP=1

# Boot Exception Level
# Choose the exception level for booting applications (mutually exclusive):
# BOOT_EL1: Transition applications to EL1 (default - for Linux, most bare-metal)
# BOOT_EL2: Boot applications at EL2 (for hypervisors, RTOSes that expect EL2)
# Default is BOOT_EL1 if neither is specified.
# Uncomment one of the following to override:
# Boot Exception Level (mutually exclusive)
# BOOT_EL1: drop to EL1 via ERET before entering the application.
# BOOT_EL2: enter the application at the EL2 wolfBoot runs at (default).
# EL2 is the default: PSCI brings the secondary cores up at EL2, so dropping
# only the boot core leaves Linux with "CPUs started in inconsistent modes".
#BOOT_EL1=1
#BOOT_EL2=1

Expand All @@ -78,6 +77,13 @@ GZIP?=1
# "bootm" loads; without this wolfBoot ignores it.
FIT_RAMDISK?=1

# Load address for the FIT kernel sub-image, overriding the FIT's own
# `load`/`entry`. Needed when the ITS omits them. 0 honors the FIT.
#WOLFBOOT_LOAD_KERNEL_ADDRESS?=0x200000

# Likewise for the ramdisk: 0 honors the FIT's own `load`.
#WOLFBOOT_LOAD_RAMDISK_ADDRESS?=0x40000000

# Toolchain
USE_GCC=1
CROSS_COMPILE=aarch64-none-elf-
Expand Down Expand Up @@ -118,17 +124,25 @@ WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x6000000
WOLFBOOT_LOAD_DTS_ADDRESS?=0x1000

# High DDR aperture: for designs whose DDR lives above the default address map
# (e.g. DDR at 0x400_0000_0000). These must stay BELOW the defaults above and
# use '=' so they override them. Base and size are 512 GB aligned with no
# UL/ULL suffix (the assembler consumes them); the FIT ITS must then use
# (e.g. DDR at 0x400_0000_0000). config/examples/versal_vmk180_highddr.config
# is this recipe already applied. These must stay BELOW the defaults above
# and use '=' so they override them. Base and size are 512 GB aligned with
# no UL/ULL suffix (the assembler consumes them); the FIT ITS must then use
# #address-cells = <2> with two-cell load/entry values, and the bootgen BIF
# and BL31 BL33 entry must match WOLFBOOT_ORIGIN.
#
# Note 0x40000800000 is 0x400_0080_0000 (8 MB in), not 0x400_0800_0000.
# The kernel and ramdisk destinations must clear the FIT staging buffer at
# WOLFBOOT_LOAD_ADDRESS, which the sub-images are read out of, and
# WOLFBOOT_PARTITION_SIZE must fit the whole signed FIT.
#WOLFBOOT_ORIGIN=0x40000800000
#WOLFBOOT_LOAD_ADDRESS=0x40010000000
#WOLFBOOT_LOAD_DTS_ADDRESS=0x40000001000
#CFLAGS_EXTRA+=-DVERSAL_DDR_HIGH_BASE=0x40000000000
#CFLAGS_EXTRA+=-DVERSAL_DDR_HIGH_SIZE=0x10000000000
#CFLAGS_EXTRA+=-DVERSAL_NO_DDR_LOW
#WOLFBOOT_LOAD_KERNEL_ADDRESS=0x40002000000
#WOLFBOOT_LOAD_RAMDISK_ADDRESS=0x40030000000
#DDR_HIGH_BASE=0x40000000000
#DDR_HIGH_SIZE=0x10000000000
#NO_DDR_LOW=1
WOLFBOOT_DTS_BOOT_ADDRESS?=0x7B0000
WOLFBOOT_DTS_UPDATE_ADDRESS?=0x39B0000

Expand Down
159 changes: 159 additions & 0 deletions config/examples/versal_vmk180_highddr.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# wolfBoot configuration for AMD Versal - DDR Boot with a high DDR aperture
# Versal with DDR mapped at 0x400_0000_0000 instead of the default map.
#
# PLM -> PSM -> BL31 (EL3) -> wolfBoot (EL2) -> Linux (EL2)
#
# Derived from versal_vmk180.config; see that file for the knobs this one
# does not change. Every address here lives inside the aperture declared by
# DDR_HIGH_BASE/DDR_HIGH_SIZE.
#
# Three things outside this file have to agree with it: the bootgen BIF
# (wolfboot.elf at WOLFBOOT_ORIGIN, raw DTB at WOLFBOOT_LOAD_DTS_ADDRESS),
# BL31's PRELOADED_BL33_BASE = WOLFBOOT_ORIGIN, and the FIT ITS using
# #address-cells = <2>.

ARCH?=AARCH64
TARGET?=versal

WOLFBOOT_VERSION?=1

# ECC-384 with SHA-384 (good balance of security and performance)
SIGN?=ECC384
HASH?=SHA384
IMAGE_HEADER_SIZE?=512

# RSA 4096-bit with SHA3-384 (alternative)
#SIGN?=RSA4096
#HASH?=SHA3
#IMAGE_HEADER_SIZE?=1024

# Debug options
DEBUG?=1
DEBUG_SYMBOLS=1
DEBUG_UART=1

# Boot Benchmarking (optional):
# Enables timing of boot operations (flash read, integrity, signature).
BOOT_BENCHMARK?=1

VTOR?=1
CORTEX_M0?=0
NO_ASM?=0
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=0
V?=0
SPMATH?=1
RAM_CODE?=0
DUALBANK_SWAP?=0
PKA?=0
WOLFTPM?=0

# Flash configuration
EXT_FLASH?=1
NO_XIP=1

# Boot Exception Level (mutually exclusive)
# BOOT_EL1: drop to EL1 via ERET before entering the application.
# BOOT_EL2: enter the application at the EL2 wolfBoot runs at (default).
# EL2 is the default: PSCI brings the secondary cores up at EL2, so dropping
# only the boot core leaves Linux with "CPUs started in inconsistent modes".
#BOOT_EL1=1
#BOOT_EL2=1

# ELF loading support
ELF?=1

# Native gzip decompression for FIT subimages (set GZIP=0 to disable)
GZIP?=1

# FIT ramdisk (initramfs) extraction plus the /chosen/linux,initrd-{start,end}
# fixup. A stock PetaLinux image.ub carries a ramdisk sub-image that a U-Boot
# "bootm" loads; without this wolfBoot ignores it.
FIT_RAMDISK?=1

# WOLFBOOT_LOAD_KERNEL_ADDRESS / WOLFBOOT_LOAD_RAMDISK_ADDRESS override the
# FIT's own `load`/`entry`, so a FIT built without them boots. Set below.

# Toolchain
USE_GCC=1
CROSS_COMPILE=aarch64-none-elf-

# ============================================================================
# Boot Memory Layout
# ============================================================================
# wolfBoot runs from DDR inside the high aperture, at EL2 non-secure.
# WOLFBOOT_ORIGIN is set with the rest of the layout further down.

# Optional debugging with OCRAM
# Versal Gen 1 (VMK180): OCM is 256KB at 0xFFFC0000 - 0xFFFFFFFF
# Versal Gen 2: OCM is 2MB at 0xFFE00000 - 0xFFFFFFFF
#WOLFBOOT_ORIGIN=0xFFFC0000

# Flash Sector Size (QSPI)
WOLFBOOT_SECTOR_SIZE=0x20000

# Application Partition Size (44MB)
WOLFBOOT_PARTITION_SIZE=0x2C00000

# Location in Flash for Primary Boot Partition
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x800000

# Load Partition to RAM Address (Linux kernel loads here)
WOLFBOOT_LOAD_ADDRESS?=0x10000000

# Location in Flash for Secondary Partition (update image)
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x3400000

# Location to store wolfBoot state/swap
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x6000000

# DTS (Device Tree) - matches addresses from BOOT.BIN analysis
WOLFBOOT_LOAD_DTS_ADDRESS?=0x1000

# The aperture itself. Base and size are 512 GB aligned with no UL/ULL
# suffix - the assembler consumes them. NO_DDR_LOW drops the low mapping.
DDR_HIGH_BASE=0x40000000000
DDR_HIGH_SIZE=0x10000000000
NO_DDR_LOW=1

# DDR layout inside the aperture, using '=' to override the '?=' defaults
# above. Each region is distinct: the kernel and ramdisk destinations must
# clear the FIT staging buffer the sub-images are read out of.
#
# 0x400_0000_1000 DTB (WOLFBOOT_LOAD_DTS_ADDRESS)
# 0x400_0080_0000 wolfBoot (WOLFBOOT_ORIGIN)
# 0x400_0200_0000 kernel (WOLFBOOT_LOAD_KERNEL_ADDRESS)
# 0x400_1000_0000 FIT staging (WOLFBOOT_LOAD_ADDRESS)
# 0x400_3000_0000 ramdisk (WOLFBOOT_LOAD_RAMDISK_ADDRESS)
WOLFBOOT_ORIGIN=0x40000800000
WOLFBOOT_LOAD_DTS_ADDRESS=0x40000001000
WOLFBOOT_LOAD_KERNEL_ADDRESS=0x40002000000
WOLFBOOT_LOAD_ADDRESS=0x40010000000
WOLFBOOT_LOAD_RAMDISK_ADDRESS=0x40030000000

# Cap the decompressed kernel at the 224 MB gap to the staging buffer above,
# which is tighter than the 256 MB WOLFBOOT_FIT_MAX_DECOMP default.
CFLAGS_EXTRA+=-DWOLFBOOT_FIT_MAX_KERNEL=0xE000000
WOLFBOOT_DTS_BOOT_ADDRESS?=0x7B0000
WOLFBOOT_DTS_UPDATE_ADDRESS?=0x39B0000

# Speed up reads by using larger blocks
CFLAGS_EXTRA+=-DWOLFBOOT_SHA_BLOCK_SIZE=4096

# UART Configuration - UART0 for APU console
CFLAGS_EXTRA+=-DDEBUG_UART_NUM=0

# QSPI Reference Clock: Ref (300MHz default for Versal)
#CFLAGS_EXTRA+=-DGQSPI_CLK_REF=300000000

# QSPI Bus Divisor: (2 << div) = BUS (0=div2, 1=div4, 2=div8)
# MT25QU01G max: 133MHz Quad Read (0x6C) with 8 dummy cycles
# div=0: 300MHz/2 = 150MHz (above spec but tested working)
# div=1: 300MHz/4 = 75MHz (within spec, default)
# div=2: 300MHz/8 = 37.5MHz (conservative)
#CFLAGS_EXTRA+=-DGQSPI_CLK_DIV=1

# QSPI flash options (uncomment to enable)
#CFLAGS_EXTRA+=-DDEBUG_QSPI # Enable QSPI debug logging
#CFLAGS_EXTRA+=-DGQSPI_MODE_IO # Use polling instead of DMA (slower)
#CFLAGS_EXTRA+=-DTEST_EXT_FLASH # Run flash erase/write/read test
14 changes: 14 additions & 0 deletions config/examples/versal_vmk180_sdcard.config
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ CFLAGS_EXTRA+=-DBOOT_PART_B=2
#DISK_FS=both
#CFLAGS_EXTRA+=-DBOOT_FILE_A='"/boot/fitImage_A.itb"'
#CFLAGS_EXTRA+=-DBOOT_FILE_B='"/boot/fitImage_B.itb"'
#
# A U-Boot "fatload mmc 0:1 <addr> image.ub ; bootm <addr> <addr>
# ${fdtcontroladdr}" flow maps onto DISK_FS=fat32 plus BOOT_FILE_A, with
# wolfBoot reading the file itself. If that FIT declares no `load`/`entry`
# and carries no `fdt`, add the staging addresses below and point
# WOLFBOOT_LOAD_DTS_ADDRESS at the DTB the bootgen BIF leaves.
#DISK_FS=fat32
#CFLAGS_EXTRA+=-DBOOT_FILE_A='"/image.ub"'
#FIT_RAMDISK=1
#WOLFBOOT_LOAD_KERNEL_ADDRESS=0x200000
#WOLFBOOT_LOAD_RAMDISK_ADDRESS=0x40000000
#
# For DDR above the default address map see the "High DDR aperture" block
# in config/examples/versal_vmk180.config; the ITS then needs 2 cells.
# Select the partitions by name instead of by index. The GPT partition label
# is matched first, then the filesystem volume label (which is what makes
# this work on MBR disks, where partitions have no names).
Expand Down
Loading
Loading