Skip to content
Open
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
31 changes: 31 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,37 @@ jobs:
arch: aarch64
config-file: ./config/examples/versal_vmk180.config

# Versal Gen 2 (VEK385): OSPI NOR A/B boot (TARGET=versal2)
versal2_vek385_test:
uses: ./.github/workflows/test-build.yml
with:
arch: aarch64
config-file: ./config/examples/versal2_vek385.config
make-args: CROSS_COMPILE=aarch64-linux-gnu-

versal2_vek385_linux_test:
uses: ./.github/workflows/test-build.yml
with:
arch: aarch64
config-file: ./config/examples/versal2_vek385_linux.config
make-args: CROSS_COMPILE=aarch64-linux-gnu-

# STIG flash reads only (no OSPI DMA)
versal2_vek385_stig_test:
uses: ./.github/workflows/test-build.yml
with:
arch: aarch64
config-file: ./config/examples/versal2_vek385.config
make-args: CROSS_COMPILE=aarch64-linux-gnu- WOLFBOOT_OSPI_DMA=0

# Test app entered at EL1 (el2_to_el1_boot)
versal2_vek385_el1_test:
uses: ./.github/workflows/test-build.yml
with:
arch: aarch64
config-file: ./config/examples/versal2_vek385.config
make-args: CROSS_COMPILE=aarch64-linux-gnu- BOOT_EL1=1

versal_vmk180_highddr_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-external-library-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ jobs:
WOLFBOOT_LIB_WOLFPSA="$(realpath ../external-libs/wolfPSA)" \
WOLFBOOT_LIB_WOLFTPM="$(realpath ../external-libs/wolfTPM)" \
WOLFBOOT_LIB_WOLFHSM="$(realpath ../external-libs/wolfHSM)" \
WOLFBOOT_LIB_WOLFCOSE="$(realpath ../external-libs/wolfCOSE)"
WOLFBOOT_LIB_WOLFCOSE="$(realpath ../external-libs/wolfCOSE)" \
WOLFBOOT_LIB_WOLFHAL="$(realpath ../external-libs/wolfHAL)"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,11 @@ tools/unit-tests/unit-t2080-fman-loader
tools/unit-tests/unit-ti-hercules-write
tools/unit-tests/unit-versal-ext-write
tools/unit-tests/unit-versal-qspi-dma
tools/unit-tests/unit-wolfhal-ext-flash
tools/unit-tests/unit-wolfhal-ext-flash-intboot
tools/unit-tests/unit-wolfhal-ext-flash-intswap
tools/unit-tests/unit-wolfhal-uart-flash
tools/unit-tests/unit-wolfhal-uart-flash-intflash
tools/unit-tests/unit-xspi-tfd-index
tools/unit-tests/unit-zynq-erase-loop
tools/unit-tests/unit-zynq-ext-write
Expand All @@ -575,6 +580,8 @@ tools/unit-tests/versal_ext_write_extract.h
tools/unit-tests/versal_host.c
tools/unit-tests/versal_host.h
tools/unit-tests/versal_qspidev_extract.h
tools/unit-tests/wolfhal_ext_flash_extract.h
tools/unit-tests/wolfhal_uart_flash_extract.h
tools/unit-tests/zynq_erase_extract.h
tools/unit-tests/zynq_write_extract.h
tools/unit-tests/unit-sign-header-failure
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,12 @@ ifeq ($(TARGET),tegra234)
MAIN_TARGET:=wolfboot.bin test-app/image_v1_signed.bin
endif

# Versal Gen 2 runs from RAM (BL33 at 0x40000000, loaded by the PLM), so
# there is no flat flash image to assemble into a factory.bin.
ifeq ($(TARGET),versal2)
MAIN_TARGET:=wolfboot.bin test-app/image_v1_signed.bin
endif

# i.MX95 A55 is a RAM-resident BL33 loaded by SPL inside an AHAB container, so
# there is no contiguous flash image to assemble into a factory.bin.
ifeq ($(TARGET),imx95_a55)
Expand Down
22 changes: 21 additions & 1 deletion arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,26 @@ ifeq ($(ARCH),AARCH64)
SPI_TARGET=nxp
endif

ifeq ($(TARGET),versal2)
# AMD Versal AI Edge / Prime Gen 2 (VEK385) - Cortex-A78AE
# A/B boot over OSPI (Cadence) flash. The board (devices, drivers) is a
# wolfHAL board: WOLFHAL=1 BOARD=vek385, see hal/boards/vek385.
ARCH_FLAGS=-mcpu=cortex-a78+crypto -march=armv8.2-a+crypto
CFLAGS+=$(ARCH_FLAGS) -DCORTEX_A78
CFLAGS+=-DWOLFBOOT_DUALBOOT
ifneq ($(WOLFHAL),1)
$(error TARGET=versal2 needs WOLFHAL=1 and BOARD, e.g. BOARD=vek385)
endif
# Support detection and skip of U-Boot legacy header
CFLAGS+=-DWOLFBOOT_UBOOT_LEGACY
# The PLM owns RVBAR on Versal Gen 2, so don't write it
CFLAGS+=-DSKIP_RVBAR=1
# aarch64-linux-gnu-gcc builds PIE by default. wolfBoot must be a
# static image at a fixed address (WOLFBOOT_ORIGIN).
CFLAGS+=-fno-pic -fno-pie
LDFLAGS+=-static -no-pie -Wl,--build-id=none
endif

ifeq ($(TARGET),tegra234)
# NVIDIA Jetson Orin (Tegra234, Cortex-A78AE): bare-metal wolfBoot as the
# BL33 firmware stage. The UEFI-application alternative is the aarch64_efi
Expand Down Expand Up @@ -447,7 +467,7 @@ ifeq ($(ARCH),AARCH64)
# asm (sp_arm64.c / WOLFSSL_SP_ARM64_ASM); that is enabled independently on
# __aarch64__ in include/user_settings.h, so a non-FIPS cm4 build still links
# sp_arm64 asm.
ifeq ($(filter zynq versal agilex5 nxp_ls1028a imx95_a55,$(TARGET)),)
ifeq ($(filter zynq versal versal2 agilex5 nxp_ls1028a imx95_a55,$(TARGET)),)
NO_ARM_ASM?=1
endif

Expand Down
156 changes: 156 additions & 0 deletions config/examples/versal2_vek385.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# wolfBoot configuration for AMD Versal AI Edge / Prime Gen 2 (VEK385)
# Cortex-A78AE, A/B boot over OSPI (Cadence) flash.
#
# This configuration is tested in QEMU `amd-versal2-virt` (QEMU 11.1.3)
# and on a VEK385 Rev B; see the "Versal Gen 2 VEK385" section of
# docs/Targets.md. The addresses below follow AMD's OSPI layout and the
# reserved-memory map of the VEK385 DTB.
#
# Production boot flow:
# PLM -> BL31 (EL3, secure) -> wolfBoot (EL2, non-secure) -> Linux
# PLM owns 0-16 MB of DDR and TF-A 16-24 MB (BL31 runs at 0x1600000).
# wolfBoot enters at 0x40000000 (AMD default BL33 entry, per the VEK385
# Rev B log "BL31: Non secure code at 0x40000000").

ARCH?=AARCH64
TARGET?=versal2
# Board on the wolfHAL drivers: hal/boards/vek385 (see docs/wolfHAL.md).
BOARD?=vek385
WOLFHAL?=1

WOLFBOOT_VERSION?=1

# ECC-384 signatures with SHA-384 hashes
SIGN?=ECC384
HASH?=SHA384
IMAGE_HEADER_SIZE?=512

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

# Optional: time the boot steps (flash read, hash, signature check).
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

# A/B boot from the OSPI NOR flash (Micron MT35XU02GCBA, 256 MB).
# See hal/boards/vek385.
EXT_FLASH?=1
NO_XIP=1

# How flash is read: 1 = CSU DMA (default, AM026 p706), 0 = STIG.
# The QEMU tests run both.
WOLFBOOT_OSPI_DMA?=1
# The code checks `#ifdef WOLFBOOT_OSPI_DMA`, so only add the -D for DMA.
# A -DWOLFBOOT_OSPI_DMA=0 would still turn DMA on.
ifeq ($(WOLFBOOT_OSPI_DMA),1)
CFLAGS_EXTRA+=-DWOLFBOOT_OSPI_DMA=1
endif

# Which level the app starts at (pick one). Default: EL2, where wolfBoot
# runs. BOOT_EL1 drops only this core to EL1; BL31 starts the others at
# EL2, and Linux does not accept that mix.
#BOOT_EL1=1
#BOOT_EL2=1

# ELF loading support
ELF?=1

# Unzip gzip FIT parts (set GZIP=0 to turn off)
GZIP?=1

# Load the FIT ramdisk (initramfs) and tell Linux where it is.
# A PetaLinux image.ub has one; without this it is ignored.
FIT_RAMDISK?=1

# Kernel load address, used instead of the FIT's own. Needed if the FIT
# has no load/entry. 0 = use the FIT's value.
#WOLFBOOT_LOAD_KERNEL_ADDRESS?=0x2001000

# Same for the ramdisk: 0 = use the ramdisk's own load address.
#WOLFBOOT_LOAD_RAMDISK_ADDRESS?=0x40000000

# Toolchain (the CI container provides aarch64-linux-gnu-)
USE_GCC=1
CROSS_COMPILE=aarch64-linux-gnu-

# ============================================================================
# Boot Memory Layout
# ============================================================================
# wolfBoot runs from DDR at 0x40000000. Load addresses stay clear of the
# reserved memory of the board DTB below them (it ends at 0x1FFFEFFF).
WOLFBOOT_ORIGIN=0x40000000

# Application (Linux kernel / FIT) load address: 512 MB.
WOLFBOOT_LOAD_ADDRESS?=0x20000000

# DTS load address in RAM: 24 MB, above PLM (0-16 MB) and TF-A (16-24 MB).
WOLFBOOT_LOAD_DTS_ADDRESS=0x1800000

# DTS slots in flash, after the UPDATE partition, 8 MB apart.
# Only used when the image has no built-in fdt.
WOLFBOOT_DTS_BOOT_ADDRESS=0x7600000
WOLFBOOT_DTS_UPDATE_ADDRESS=0x7E00000

# ============================================================================
# OSPI Flash Partitions
# ============================================================================
# AMD OSPI layout (VEK385 DTB, /axi/spi@f1010000/flash@0/partitions):
# 0x0000000 Image Selector (384 KB) - DO NOT TOUCH
# 0x0060000 Image Selector Backup (384 KB) - DO NOT TOUCH
# 0x00C0000 Image Selector Scratchpad (128 KB) - DO NOT TOUCH
# 0x00E0000 Image Recovery (20 MB) - DO NOT TOUCH
# 0x14E0000 Image Recovery Scratchpad (128 KB) - DO NOT TOUCH
# 0x1500000 SystemReady-DT metadata (128 KB) - DO NOT TOUCH
# 0x1520000 SystemReady-DT metadata Backup - DO NOT TOUCH
# 0x1540000 U-Boot Variables (128 KB) - DO NOT TOUCH
# 0x1560000 U-Boot Variables Backup (128 KB) - DO NOT TOUCH
# 0x1580000 U-Boot UEFI Variables (256 KB) - DO NOT TOUCH
# 0x15C0000 Bank A Space (114 MB, ends 0x87C0000) <- wolfBoot partitions
# 0x8800000 Bank B Space (114 MB) - DO NOT TOUCH
# 0xFA40000 User Scratchpad (5.75 MB) <- wolfBoot SWAP
#
# Bank A: 0x015C0000 BOOT.BIN (8 MB kept), 0x01DC0000 BOOT (44 MB),
# 0x049C0000 UPDATE (44 MB), 0x07600000 / 0x07E00000 DTS slots.
# The driver refuses erase/program outside BOOT, UPDATE and SWAP.

# One wolfBoot sector = one 128 KB flash sector (DCh), as on Gen 1.
# The flash has no 64 KB erase (datasheet Table 21/32, p32/p50).
WOLFBOOT_SECTOR_SIZE=0x20000

# Partition size: 44 MB, same as Gen 1 (fits the signed FIT)
WOLFBOOT_PARTITION_SIZE=0x2C00000

# BOOT partition, right after the 8 MB BOOT.BIN area
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x1DC0000

# UPDATE partition
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x49C0000

# SWAP partition (one sector), in AMD's "User Scratchpad" area
WOLFBOOT_PARTITION_SWAP_ADDRESS=0xFA40000

# Faster reads with bigger blocks
CFLAGS_EXTRA+=-DWOLFBOOT_SHA_BLOCK_SIZE=4096

# Console: UART1 (0xF1930000). DEBUG_UART_NUM=0 picks UART0 (0xF1920000).
CFLAGS_EXTRA+=-DDEBUG_UART_NUM=1

# UART clock (UART_CLK_REF): 99999001 Hz, as the PLM sets it on the VEK385
# (hal/boards/vek385/wolfHAL_board.h). For a board with another clock:
#CFLAGS_EXTRA+=-DUART_CLK_REF=100000000

# In QEMU, a small trampoline loads wolfBoot at WOLFBOOT_ORIGIN and acts
# like BL31.
Loading
Loading