wolfBoot/config/examples/polarfire_mpfs250_m_qspi.co...

130 lines
4.2 KiB
Plaintext

# PolarFire SoC MPFS250T M-Mode (Machine Mode) with SC QSPI Flash
#
# This configuration runs wolfBoot directly from eNVM in M-mode (Machine Mode),
# and boots a test application from SC QSPI flash to L2 Scratchpad (no DDR).
#
# Boot flow:
# 1. eNVM (0x20220100) -> L2_SCRATCH (0x0A000000) - wolfBoot starts
# 2. Load signed app image from SC QSPI flash to L2_SCRATCH (0x0A010200)
# 3. Verify signature and boot
#
# Flash using mpfsBootmodeProgrammer (bootmode 1):
# java -jar mpfsBootmodeProgrammer.jar --bootmode 1 --die MPFS250T \
# --package FCG1152 --workdir $PWD wolfboot.elf
ARCH?=RISCV64
TARGET?=mpfs250
SIGN?=ECC384
HASH?=SHA384
IMAGE_HEADER_SIZE=512
WOLFBOOT_VERSION?=1
ARMORED?=0
DEBUG?=0
DEBUG_SYMBOLS?=1
DEBUG_UART?=1
VTOR?=1
NO_XIP?=1
NVM_FLASH_WRITEONCE?=0
UART_FLASH?=0
V?=0
NO_MPU?=1
RAM_CODE?=0
SPMATH?=0
SPMATHALL?=1
DUALBANK_SWAP?=0
PKA?=0
ENCRYPT=0
WOLFTPM?=0
ELF?=1
#DEBUG_ELF?=1
# Strip debug symbols from test-app ELF before signing.
# Required for M-mode: unstripped ELF (~150KB) is too large for L2 Scratch.
# Stripped ELF is typically ~5KB.
STRIP_ELF?=1
# Watchdog timer configuration (default: disabled)
# When commented out, the WDT is disabled in hal_init() and re-enabled
# with the boot ROM default in hal_prepare_boot() before do_boot.
# Uncomment -DWATCHDOG to keep the WDT enabled with a generous timeout
# for the duration of wolfBoot. Verify is bounded at ~5s; default 30s
# avoids the need to pet the WDT during long ECDSA verify.
#CFLAGS_EXTRA+=-DWATCHDOG
#CFLAGS_EXTRA+=-DWATCHDOG_TIMEOUT_MS=30000
OPTIMIZATION_LEVEL=1
# M-Mode Configuration
# Runs on E51 core in Machine Mode from L2 SRAM
RISCV_MMODE?=1
# Stack size per hart: set to 0 for M-mode (only E51/hart 0 runs;
# secondary harts park in eNVM WFI loop and never use L2 Scratch stacks)
CFLAGS_EXTRA+=-DSTACK_SIZE_PER_HART=0
# E51 core lacks RISC-V crypto extensions (Zknh), use portable C implementations
NO_ASM?=1
# QSPI Flash Configuration
# Using Micron MT25QL01GBBB (128MB, 64KB sectors)
EXT_FLASH?=1
SPI_FLASH?=0
# SPI Flash Controller Selection:
# MPFS_SC_SPI: Use SC QSPI Controller (0x37020100) for fabric-connected flash.
# Required for Video Kit (flash is fabric-connected, not on MSS pins).
# DEFAULT: Use MSS QSPI Controller (0x21000000) for external flash
# on MSS QSPI pins.
CFLAGS_EXTRA+=-DMPFS_SC_SPI
# No SD card or eMMC
DISK_SDCARD?=0
DISK_EMMC?=0
# L2 SRAM Address for wolfBoot (256KB available)
# Stack grows down from end of L2_SCRATCH
WOLFBOOT_ORIGIN?=0x0A000000
# Load application to L2 Scratchpad (above wolfBoot code, below stack)
# wolfBoot is ~36KB; 128KB reserved for growth headroom.
# Note: update_ram places header at (LOAD_ADDRESS - IMAGE_HEADER_SIZE),
# so offset by header size to keep header aligned.
# IMPORTANT: Strip debug symbols from test-app ELF before signing to keep
# the image small enough to fit in L2 Scratchpad (~95KB available).
WOLFBOOT_LOAD_ADDRESS?=0x0A020200
# Flash geometry (64 KB sector to match QSPI flash)
WOLFBOOT_SECTOR_SIZE?=0x10000
# Partition layout for 128MB QSPI flash
# Boot partition: 0x00020000 - 0x01FFFFFF (~32MB)
# Update partition: 0x02000000 - 0x03FFFFFF (~32MB)
# Swap partition: 0x04000000 - 0x0400FFFF (64KB)
WOLFBOOT_PARTITION_SIZE?=0x1FE0000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x20000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x2000000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x4000000
# Speed up reads from flash by using larger blocks
CFLAGS_EXTRA+=-DWOLFBOOT_SHA_BLOCK_SIZE=4096
# Debug options (useful for initial M-mode bring-up)
#CFLAGS_EXTRA+=-DDEBUG_BOOT
# Optional QSPI debugging
# Uncomment for verbose QSPI debug output
#CFLAGS_EXTRA+=-DDEBUG_QSPI
# Optional QSPI flash test (erase/write/read on update partition)
# Uncomment to run test during hal_init()
#CFLAGS_EXTRA+=-DTEST_EXT_FLASH
# UART QSPI programmer (enabled for M-mode)
# In M-mode, QSPI flash is not accessible via Libero/JTAG, so this UART-based
# programmer is the primary method to load the test-app image into QSPI.
# wolfBoot prompts on UART at startup ("Press P within 3s") to receive a signed
# firmware image and write it to QSPI flash.
# Use: python3 tools/scripts/mpfs_qspi_prog.py <port> <image.bin> [qspi_offset]
# Requires EXT_FLASH=1 (already set) and DEBUG_UART=1.
UART_QSPI_PROGRAM?=1