Skip to content

cmake: detect RP2350 RISC-V core in rp2 platform automation - #158

Merged
ventZl merged 1 commit into
ventZl:masterfrom
tobiaguiar08:fix_rp2_platform_riscv_detection
Aug 20, 2026
Merged

cmake: detect RP2350 RISC-V core in rp2 platform automation#158
ventZl merged 1 commit into
ventZl:masterfrom
tobiaguiar08:fix_rp2_platform_riscv_detection

Conversation

@tobiaguiar08

Copy link
Copy Markdown
Contributor

Summary

Fix the rp2 platform automation to correctly detect and configure RP2350 RISC-V builds instead of silently forcing ARM/CMSIS for all RP2xxx devices.

Problem

The cmake/platform/rp2.cmake module is the platform-automation convenience path for RP2xxx devices. Currently it unconditionally sets CMRX_ARCH arm / CMRX_HAL cmsis and
includes FindCMSIS for every device matching the rp2 prefix, including RP2350 RISC-V. A project using CMRX_DEVICE=rp2350 with PICO_PLATFORM=rp2350-riscv would be silently
misconfigured for the wrong architecture instead of receiving a clear error.

(Note: the documented path and the unmerged integration-test reference project both bypass this automation and set CMRX_ARCH/CMRX_HAL directly, so no real build is currently
broken. This fixes the convenience path for anyone who does use it.)

Changes

  • Add an early detection branch keying on PICO_PLATFORM STREQUAL "rp2350-riscv", which sets the correct CMRX_ARCH riscv / CMRX_HAL hal and returns immediately, before any
    ARM/CMSIS logic runs.
  • The ARM path below the branch is unchanged; the RP2040 and other ARM RP2xxx variants continue to work exactly as before.

Testing

Verified with a dry cmake configure:

  • CMRX_DEVICE=rp2350, PICO_PLATFORM=rp2350-riscv (no PICO_SDK_PATH set) → correctly resolves to CMRX_ARCH=riscv / CMRX_HAL=hal, skips PICO_SDK_PATH check, loads the
    RISC-V HAL module.
  • CMRX_DEVICE=rp2040 (no PICO_PLATFORM) → reaches the same PICO_SDK_PATH check and linker-file logic as before, no regression.

The rp2 platform-automation convenience path unconditionally forced
ARM/CMSIS for every RP2xxx device string, including the RP2350 RISC-V
(Hazard3) core, so anyone relying on it for a RISC-V project got
silently misconfigured for the wrong architecture instead of a clear
error. Detect the RISC-V core the same way the pico-sdk-riscv quirk
already does and route it to the correct arch/HAL before any of the
CMSIS-specific logic runs.

Assisted-by: Claude
Signed-off-by: Tobias Aguiar <tobi.aguiar01@gmail.com>
@ventZl
ventZl merged commit f21e62f into ventZl:master Aug 20, 2026
19 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants