-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathpolarfire_mpfs250_m_qspi.config
More file actions
130 lines (111 loc) · 4.29 KB
/
polarfire_mpfs250_m_qspi.config
File metadata and controls
130 lines (111 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# 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).
# The linker script (mpfs250-m.ld) uses STACK_SIZE_PER_HART = 0 to match.
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