@@ -363,6 +363,56 @@ ifeq ($(ARCH),AARCH64)
363363 endif
364364 endif
365365
366+ ifeq ($(TARGET),s32g2)
367+ # NXP S32G274A GoldBox: wolfBoot is the Boot ROM's application image,
368+ # copied into SRAM and entered at EL3. It runs its own identity MMU there
369+ # and tears it down at the handoff with the stack-free flush routine.
370+ ARCH_FLAGS=-mcpu =cortex-a53+crypto -march=armv8-a+crypto -mstrict-align
371+ CFLAGS+ =$(ARCH_FLAGS ) -DCORTEX_A53
372+ CFLAGS+ =-DWOLFBOOT_AARCH64_MMU_TEARDOWN
373+ WOLFBOOT_ORIGIN =0x340A0000
374+ OBJS+ =hal/s32g2_ddr.o
375+ # wolfBoot adds /memory and the spin-table addresses to the FIT's DTB,
376+ # which needs more room than the default headroom.
377+ CFLAGS+=-DWOLFBOOT_FDT_FIXUP_HEADROOM =4096
378+ # LPDDR4 register tables and PHY training firmware, generated by
379+ # tools/scripts/s32g2/s32g2-ddr-blob.py. Without the file the image
380+ # still builds, and reports the missing blob instead of training.
381+ S32G2_DDR_BLOB ?= s32g2_ddr.bin
382+ ifneq ($(wildcard $(S32G2_DDR_BLOB)),)
383+ CFLAGS+=-DS32G2_DDR_BLOB ='"$(abspath $(S32G2_DDR_BLOB ) ) "'
384+ endif
385+ # uSDHC0 board facts. Here rather than in the config because a command-line
386+ # CFLAGS_EXTRA= would replace the config's, whereas CFLAGS is additive.
387+ ifneq ($(filter 1,$(DISK_SDCARD) $(DISK_EMMC)),)
388+ # uSDHC -> SDHCI shim, shared with the i.MX 8 targets
389+ OBJS+ =hal/imx_usdhc_sdhci.o
390+ # Card detect is a GPIO, so PRES_STATE bit 16 never sets.
391+ CFLAGS+ =-DSDHCI_FORCE_CARD_DETECT
392+ # Read the payload in 64 KB chunks rather than the 512-byte default.
393+ DISK_BLOCK_SIZE ?= 65536
394+ CFLAGS+=-DDISK_BLOCK_SIZE =$(DISK_BLOCK_SIZE )
395+ # 3.3 V signalling only (no-1-8-v): high-speed rates.
396+ ifeq ($(DISK_EMMC),1)
397+ S32G2_USDHC_MAX_CLK_KHZ ?= 52000
398+ else
399+ S32G2_USDHC_MAX_CLK_KHZ ?= 50000
400+ endif
401+ CFLAGS+=-DS32G2_USDHC_MAX_CLK_KHZ =$(S32G2_USDHC_MAX_CLK_KHZ )
402+ endif
403+ # QuadSPI NOR driver (the ext_flash API with EXT_FLASH=1)
404+ ifeq ($(S32G2_QSPI),1)
405+ CFLAGS+ =-DS32G2_QSPI
406+ # NOR programmer build: writes the named file from the SD/eMMC FAT
407+ # partition to the NOR at S32G2_QSPI_PROGRAM_OFFSET, then halts.
408+ ifneq ($(S32G2_QSPI_PROGRAM_FILE),)
409+ S32G2_QSPI_PROGRAM_OFFSET ?= 0
410+ CFLAGS+=-DS32G2_QSPI_PROGRAM_FILE ='"$(S32G2_QSPI_PROGRAM_FILE ) "'
411+ CFLAGS+=-DS32G2_QSPI_PROGRAM_OFFSET =$(S32G2_QSPI_PROGRAM_OFFSET )
412+ endif
413+ endif
414+ endif
415+
366416 ifeq ($(TARGET),imx8mm)
367417 # uSDHC -> SDHCI shim, shared with imx8qm
368418 ifneq ($(filter 1,$(DISK_SDCARD) $(DISK_EMMC)),)
0 commit comments