Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Flash writes lack multicore/DMA protection, and images can overlap the trailer sector erased during update triggering, risking faults and image corruption.
6 open issues
Flash operations lack multicore and DMA coordination · New Images can overlap the sector erased to trigger updates · New RP2040 options are omitted from CONFIG_VARS · New Watchdog is not serviced during long image verification · New Flash operations extend the application watchdog timeout · New Factory provisioning leaves stale partition state · New
What changed in this PR
Adds native, Makefile-based RP2040 support for the Raspberry Pi Pico and W5100S-EVB-Pico, providing authenticated updates and rollback without a hardware root of trust. The RP2350 target remains unchanged.
Changes:
- Adds startup, flash, clock and UART support with a default partition layout.
- Provides a test application, UF2 conversion tool and target documentation.
- Adds mocked flash-operation tests and two CI build configurations.
| File | Description |
|---|---|
| tools/unit-tests/unit-rp2040-flash-write.c | Tests flash writes, alignment and erases. |
| tools/unit-tests/Makefile | Registers and builds the flash tests. |
| tools/scripts/rp2040/rp2040_uf2.py | Converts binaries to UF2 and validates boot2 checksums. |
| test-app/Makefile | Adds RP2040 compiler and linker settings. |
| test-app/ARM-rp2040.ld | Defines application memory placement. |
| test-app/app_rp2040.c | Demonstrates confirmation, update triggering and console controls. |
| hal/rp2040.ld | Places boot2, bootloader code and RAM routines. |
| hal/rp2040.h | Defines registers, flash geometry and the BOOTSEL interface. |
| hal/rp2040.c | Implements startup, peripherals and ROM-backed flash operations. |
| docs/Targets.md | Documents configuration, flashing and validation results. |
| config/examples/rp2040.config | Supplies default signing, clock and partition settings. |
| arch.mk | Integrates RP2040 target options. |
| .gitignore | Excludes generated test artifacts. |
| .github/workflows/test-configs.yml | Adds default and development-option builds. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
With RAM_CODE=1, bootloader self-update erases boot2 and flash-resident HAL wrappers while misplacing the replacement by 256 bytes, potentially leaving the board unbootable.
1 open issue
6 resolved since last review
Images can overlap the sector erased to trigger updates Flash operations lack multicore and DMA coordination Flash operations extend the application watchdog timeout Watchdog is not serviced during long image verification RP2040 options are omitted from CONFIG_VARS Factory provisioning leaves stale partition state
Review effort: Balanced
| ifeq ($(TARGET),rp2040) | ||
| CORTEX_M0=1 |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1018
Scan targets checked: wolfboot-src, wolfboot-bugs
Not reviewed (no scan target covers them): .github/workflows/test-configs.yml, .gitignore, arch.mk, config/examples/rp2040.config, docs/Targets.md, hal/rp2040.h, hal/rp2040.ld, test-app/ARM-rp2040.ld, test-app/Makefile, tools/config.mk, tools/scripts/rp2040/rp2040_uf2.py, tools/unit-tests/Makefile
Coverage: 1 of 3 in-scope changed file(s) opened by the reviewer; not opened: test-app/app_rp2040.c, tools/unit-tests/unit-rp2040-flash-write.c
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
|
|
||
| RP2040_REG(SSI_SSIENR) = 0; | ||
| RP2040_REG(SSI_SER) = 1; | ||
| RP2040_REG(SSI_BAUDR) = baud_div; |
There was a problem hiding this comment.
RP2040_XIP_QUAD accepts divider values that stop the flash clock and hang wolfBoot · HAL implementation flaws
RP2040_XIP_QUAD goes straight into SSI_BAUDR, and nothing rejects 1 or other values whose SCKDV ends up 0. A zero divider stops sclk_out, so the status-register poll at line 345 spins forever with interrupts off. A user who sets RP2040_XIP_QUAD=1 as a boolean gets a board that hangs in hal_init on every boot.
Suggested fix: Add a compile-time #error in hal/rp2040.c unless RP2040_XIP_QUAD is an even value from 2 to 65534, as is already done for RP2040_SYS_MHZ.
Basis: RP2040 Datasheet, SSI clock ratios / BAUDR.SCKDV (DW_apb_ssi): SCKDV holds only even values, and when it is 0 the serial clock sclk_out is disabled.



Native Makefile target for the RP2040 (dual Cortex-M0+, external QSPI flash executed in place). No pico-sdk, picotool or CMake. The RP2040 has no secure boot or OTP key storage, so this provides authenticated updates with rollback, not a hardware root of trust.
hal/rp2040.c,.h,.ld- clocks, UART, its own 256-byte second-stage boot, flash erase/program through the boot ROM routinesconfig/examples/rp2040.config- ECC256 + SHA256, 64 KB wolfBoot, two 960 KB partitionsarch.mk,test-app/,tools/scripts/rp2040/rp2040_uf2.py, flash unit test,docs/Targets.mdsection, two CI jobsValidated on a WIZnet W5100S-EVB-Pico with the wolfIP application as the image: boot, update with swap, rejection of a tampered update, rollback. The UART console and
test-app/app_rp2040.care build-tested only.The existing pico-sdk based
rp2350target is not touched.