Same Chip, Two Walls: TrustZone-M vs RISC-V PMP on the RP2350
TL;DR
The RP2350 has both an Arm Cortex-M33 pair (TrustZone-M) and a RISC-V Hazard3 pair (PMP) on one die. I built the same minimal isolation demo on both — a guarded secret, a call-in service, and a deliberate illegal read — and verified both on the same Pico 2 over SWD. Findings, all measured rather than read off a spec:
- Same result, different shape. Both block the illegal read with the secret intact. TrustZone partitions the address map and the toolchain builds the gate for you; PMP filters by privilege and you write the gate yourself.
- Arm tells you where it broke, Hazard3 doesn’t.
SFSR = 0x48setsSFARVALID, so the faulting address is there for the taking. Hazard3 leavesmtval = 0on a PMP access fault.mcause = 5is all you get. - The same silicon only fought one of them. The Arm Non-Secure side hit two RP2350 walls that forced a bare-metal, RAM-resident NS image. The RISC-V U-mode side just ran from flash.
- Hazard3 has a trick TrustZone structurally can’t do:
Xh3pmpmlets M-mode sandbox itself, reversibly. - Neither of them covers the DMA. That’s a separate MPU, and it’s the RP2350 detail most likely to quietly ruin your day.
Code: rp2350-tz-tee —
minimal-tz
(Arm) and
minimal-pmp
(RISC-V).