You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Targets.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -828,6 +828,28 @@ Key build settings that differ between configurations:
828
828
> **Note:** All configurations require `NO_ASM=1` because the MPFS250 U54/E51 cores lack RISC-V
829
829
> crypto extensions (Zknh); wolfBoot uses portable C implementations for all cryptographic operations.
830
830
831
+
### M-Mode Optional Build Flags
832
+
833
+
These flags apply to `polarfire_mpfs250_m_qspi.config` and are added via `CFLAGS_EXTRA+=-D...`.
834
+
835
+
| Flag | Default | Description |
836
+
|------|---------|-------------|
837
+
|`WATCHDOG`| undefined (disabled) | When defined, the E51 watchdog timer is **kept enabled** during wolfBoot operation with a generous timeout. When undefined, the WDT is **disabled** in `hal_init()` and re-enabled with the boot ROM default in `hal_prepare_boot()` before jumping to the application. Either way, the application receives a normal WDT. |
838
+
|`WATCHDOG_TIMEOUT_MS`|`30000` (30 s) | Watchdog timeout in milliseconds when `WATCHDOG` is defined. ECDSA P-384 verification on E51 with portable C math is bounded at ~5 s; the default 30 s avoids any need to refresh the WDT during the long verify call. |
839
+
840
+
#### Stack overflow detection
841
+
842
+
The trap handler in `src/boot_riscv.c` automatically detects stack overflow on synchronous exceptions. When a trap fires with `SP < _main_hart_stack_bottom`, it prints:
843
+
844
+
```
845
+
TRAP: cause=2 epc=A000740 tval=0 sp=A02FFE8
846
+
STACK OVERFLOW: sp=A02FFE8 < bottom=A030000 (under by 24)
847
+
```
848
+
849
+
This is helpful for diagnosing illegal-instruction TRAPs at random valid `.text` addresses, which are the classic signature of stack overflow corrupting the return address.
850
+
851
+
The current `STACK_SIZE` in `hal/mpfs250-m.ld` is **32 KB**. Measured peak for ECC384 + SHA384 + SPMATHALL + NO_ASM is ~6 KB (5x headroom).
0 commit comments