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
32 changes: 32 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,38 @@ jobs:
config-file: ./config/examples/imx8mm-pico.config
make-args: IMX8MM_BL33=1 DISK_EMMC=0 IMX8MM_MMU=0 wolfboot.bin test-app/image_v1_signed.bin

s32g2_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
# Boot ROM image in SRAM, signed FIT from the SD card.
config-file: ./config/examples/s32g2-goldbox.config
make-args: wolfboot.bin

s32g2_emmc_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
# FIT from the eMMC behind the board's SW3, no console.
config-file: ./config/examples/s32g2-goldbox.config
make-args: DISK_EMMC=1 DISK_SDCARD=0 DEBUG_UART=0 wolfboot.bin

s32g2_qspi_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
# Boot from the QuadSPI NOR with the A/B partitions in the NOR.
config-file: ./config/examples/s32g2-goldbox-qspi.config
make-args: wolfboot.bin

s32g2_qspi_program_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
arch: aarch64
# NOR programmer build: image file from the SD card to the NOR.
config-file: ./config/examples/s32g2-goldbox.config
make-args: S32G2_QSPI=1 S32G2_QSPI_PROGRAM_FILE=/s32g2_qspi_boot.bin wolfboot.bin

disk_boot_confirm_test:
uses: ./.github/workflows/test-build-aarch64.yml
with:
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ tools/unit-tests/unit-fs-malicious
tools/unit-tests/unit-ext4
tools/unit-tests/unit-update-disk-fs
tools/unit-tests/unit-update-disk-fs-enc
tools/unit-tests/unit-update-disk-fs-confirm
tools/unit-tests/unit-psci
tools/unit-tests/ext4-min.img
tools/unit-tests/ext4-stock.img
tools/unit-tests/ext4-payload.bin
Expand Down Expand Up @@ -707,3 +709,8 @@ tools/unit-tests/stm32wb_write_extract.h
tools/unit-tests/t10xx_flash_status_extract.h
tools/unit-tests/ti_hercules_erase_extract.h
tools/unit-tests/versal_host_write.c
# S32G2 GoldBox FIT build outputs (tools/scripts/s32g2/s32g2-mkfit.sh)
Image.gz
s32g2-fitImage*
s32g2.dtb
s32g2_ddr.bin
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ ifeq ($(TARGET),imx8mm)
MAIN_TARGET:=wolfboot.bin test-app/image_v1_signed.bin
endif

# S32G2 runs from SRAM and boots a signed FIT; there is no factory.bin.
ifeq ($(TARGET),s32g2)
MAIN_TARGET:=wolfboot.bin
endif

# i.MX95 M7 runs from ITCM (loaded by the Linux remoteproc driver); the payload
# lives in DDR at 0x80100000, so there is no contiguous flash image to assemble.
ifeq ($(TARGET),imx95_m7)
Expand Down Expand Up @@ -1101,6 +1106,13 @@ secondary: $(SECONDARY_PRIVATE_KEY)
@echo "\t[CC $(ARCH)] $@"
$(Q)$(CC) $(CFLAGS) -c $(OUTPUT_FLAG) $@ $^

# hal/s32g2_ddr.o links the DDR blob in by content.
ifeq ($(TARGET),s32g2)
hal/s32g2_ddr.o: hal/s32g2_ddr.c $(wildcard $(S32G2_DDR_BLOB))
@echo "\t[CC $(ARCH)] $@"
$(Q)$(CC) $(CFLAGS) -c $(OUTPUT_FLAG) $@ $<
endif

%.o:%.S
@echo "\t[AS $(ARCH)] $@"
$(Q)$(CC) $(CFLAGS) -c $(OUTPUT_FLAG) $@ $^
Expand Down
55 changes: 55 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ ifeq ($(ARCH),AARCH64)
CROSS_COMPILE?=aarch64-none-elf-
endif
CFLAGS+=-DARCH_AARCH64 -DFAST_MEMCPY
# Distribution aarch64-linux-gnu- compilers enable _FORTIFY_SOURCE by
# default, turning bounded memcpy() calls into glibc __memcpy_chk, which a
# bare-metal image cannot resolve (it links, then branches to address 0).
CFLAGS+=-U_FORTIFY_SOURCE
ifeq ($(TARGET),aarch64_efi)
# UEFI app: gnu-efi CRT0 is the entry; do_boot is in boot_aarch64_efi.o.
# Skip the bare-metal reset (boot_aarch64_start.S) and EL2/GIC glue.
Expand Down Expand Up @@ -359,6 +363,57 @@ ifeq ($(ARCH),AARCH64)
endif
endif

ifeq ($(TARGET),s32g2)
# NXP S32G274A GoldBox: wolfBoot runs from SRAM at EL3 with its own
# identity MMU, and cleans the caches at the handoff.
ARCH_FLAGS=-mcpu=cortex-a53+crypto -march=armv8-a+crypto -mstrict-align
CFLAGS+=$(ARCH_FLAGS) -DCORTEX_A53
CFLAGS+=-DWOLFBOOT_AARCH64_MMU_TEARDOWN
WOLFBOOT_ORIGIN=0x340A0000
OBJS+=hal/s32g2_ddr.o
# PSCI runtime at EL3. An SMC is served with the kernel's FP/SIMD state
# live: no use of those registers, nor of libgcc's out-of-line atomics.
OBJS+=src/psci.o
hal/s32g2.o src/psci.o: CFLAGS+=-mgeneral-regs-only -mno-outline-atomics
# wolfBoot adds /memory and /psci to the FIT's DTB, which needs more
# room than the default headroom.
CFLAGS+=-DWOLFBOOT_FDT_FIXUP_HEADROOM=4096
# LPDDR4 register tables and PHY training firmware, generated by
# tools/scripts/s32g2/s32g2-ddr-blob.py. Without the file the image
# still builds, and reports the missing blob instead of training.
S32G2_DDR_BLOB ?= s32g2_ddr.bin
ifneq ($(wildcard $(S32G2_DDR_BLOB)),)
CFLAGS+=-DS32G2_DDR_BLOB='"$(abspath $(S32G2_DDR_BLOB))"'
Comment thread
dgarske marked this conversation as resolved.
Resolved
endif
ifneq ($(filter 1,$(DISK_SDCARD) $(DISK_EMMC)),)
# uSDHC -> SDHCI shim, shared with the i.MX 8 targets
OBJS+=hal/imx_usdhc_sdhci.o
# Card detect is a GPIO, so PRES_STATE bit 16 never sets.
CFLAGS+=-DSDHCI_FORCE_CARD_DETECT
# Read the payload in 64 KB chunks rather than the 512-byte default.
DISK_BLOCK_SIZE ?= 65536
CFLAGS+=-DDISK_BLOCK_SIZE=$(DISK_BLOCK_SIZE)
# 3.3 V signalling only (no-1-8-v): high-speed rates.
ifeq ($(DISK_EMMC),1)
S32G2_USDHC_MAX_CLK_KHZ ?= 52000
else
S32G2_USDHC_MAX_CLK_KHZ ?= 50000
endif
CFLAGS+=-DS32G2_USDHC_MAX_CLK_KHZ=$(S32G2_USDHC_MAX_CLK_KHZ)
endif
# QuadSPI NOR driver (the ext_flash API with EXT_FLASH=1)
ifeq ($(S32G2_QSPI),1)
CFLAGS+=-DS32G2_QSPI
Comment thread
dgarske marked this conversation as resolved.
Resolved
# NOR programmer build: writes the named file from the SD/eMMC FAT
# partition to the NOR at S32G2_QSPI_PROGRAM_OFFSET, then halts.
ifneq ($(S32G2_QSPI_PROGRAM_FILE),)
S32G2_QSPI_PROGRAM_OFFSET ?= 0
CFLAGS+=-DS32G2_QSPI_PROGRAM_FILE='"$(S32G2_QSPI_PROGRAM_FILE)"'
CFLAGS+=-DS32G2_QSPI_PROGRAM_OFFSET=$(S32G2_QSPI_PROGRAM_OFFSET)
endif
endif
endif

ifeq ($(TARGET),imx8mm)
# uSDHC -> SDHCI shim, shared with imx8qm
ifneq ($(filter 1,$(DISK_SDCARD) $(DISK_EMMC)),)
Expand Down
35 changes: 35 additions & 0 deletions config/examples/s32g2-goldbox-qspi.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# NXP S32G2 GoldBox (S32G-VNP-GLDBOX, S32G274A-RDB2) - wolfBoot booting from
# the 64 MB QuadSPI NOR, with the A/B image partitions in the same NOR.
# Build, NOR layout and programming: docs/Targets.md.
#
# Never pass CFLAGS_EXTRA= on the command line - it replaces, not appends.
ARCH=AARCH64
TARGET=s32g2
S32G2_QSPI=1
SIGN?=ECC384
HASH?=SHA384
DEBUG?=1
DEBUG_UART?=1
SPMATH?=1
NO_XIP?=1
EXT_FLASH?=1
# The HAL sets up the GICv3 itself (hal/s32g2.c); skip the generic GICv2 init.
SKIP_GIC_INIT?=1
GZIP?=1
DISK_SDCARD?=0
# The flash's 16-byte ECC units program once per erase: keep the partition
# state as a journal, in 64 KB sectors (docs/Targets.md).
NVM_FLASH_JOURNAL?=1
WOLFBOOT_SECTOR_SIZE?=0x10000
WOLFBOOT_PARTITION_SIZE?=0x1000000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x100000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x1100000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x2100000
# Separate DTB partitions are not used (the FIT carries the DTB) but the
# RAM-boot flow needs them defined; they sit after the swap sector.
WOLFBOOT_DTS_BOOT_ADDRESS?=0x2110000
WOLFBOOT_DTS_UPDATE_ADDRESS?=0x2120000

WOLFBOOT_RAMBOOT_MAX_SIZE=0x4000000
WOLFBOOT_LOAD_ADDRESS?=0xA0000000
WOLFBOOT_LOAD_DTS_ADDRESS?=0xA5000000
33 changes: 33 additions & 0 deletions config/examples/s32g2-goldbox.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# NXP S32G2 GoldBox (S32G-VNP-GLDBOX, S32G274A-RDB2) - wolfBoot as the Boot
# ROM's application image in SRAM, in place of U-Boot. The signed FIT is read
# from a FAT32 partition of the SD card, or of the eMMC with DISK_EMMC=1
# DISK_SDCARD=0. Build, DDR blob and card layout: docs/Targets.md.
#
# Never pass CFLAGS_EXTRA= on the command line - it replaces, not appends.
ARCH=AARCH64
TARGET=s32g2
SIGN?=ECC384
HASH?=SHA384
DEBUG?=1
DEBUG_UART?=1
SPMATH?=1
NO_XIP?=1
# The HAL sets up the GICv3 itself (hal/s32g2.c); skip the generic GICv2 init.
SKIP_GIC_INIT?=1
WOLFBOOT_SECTOR_SIZE?=0x1000
WOLFBOOT_NO_PARTITIONS=1
GZIP?=1
DISK_SDCARD?=1
DISK_FS?=fat32

# A/B slots: two files on the third partition, with the boot confirmation
# state in the last 8 bytes of each file.
DISK_BOOT_CONFIRM?=1
CFLAGS_EXTRA+=-DBOOT_PART_A=2
CFLAGS_EXTRA+=-DBOOT_PART_B=2
CFLAGS_EXTRA+=-DBOOT_FILE_A='"/fitImage_a.bin"'
CFLAGS_EXTRA+=-DBOOT_FILE_B='"/fitImage_b.bin"'

WOLFBOOT_RAMBOOT_MAX_SIZE=0x4000000
WOLFBOOT_LOAD_ADDRESS?=0xA0000000
WOLFBOOT_LOAD_DTS_ADDRESS?=0xA5000000
Loading
Loading