From ec5f2bc686a51aad903518c0f84d7d39d3b3432c Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Mon, 10 Nov 2025 23:14:15 +0100 Subject: [PATCH] rp2/CMakeLists.txt: Set the appropriate mpy-cross flags on all targets. This commit lets the RP2 port build system use the appropriate flags to pass to "mpy-cross" when building frozen MPY files as part of the build process. Now all possible variants (RP2040, RP2350/Arm, and RP2350/RV32) have their right flags assigned, falling back the flags set of the RP2040 if a new variant is introduced. Before these changes all variants would use the RP2040 set of flags which may be a bit of an issue when building code for the RP2350 in RV32 mode. Signed-off-by: Alessandro Gatti --- ports/rp2/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index c4a081e2ef..d88a96d4a7 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -487,7 +487,16 @@ list(APPEND MICROPY_SOURCE_QSTR ) # Define mpy-cross flags -set(MICROPY_CROSS_FLAGS -march=armv6m) +if (${PICO_PLATFORM} STREQUAL "rp2040") + set(MICROPY_CROSS_FLAGS "-march=armv6m") +elseif (${PICO_PLATFORM} STREQUAL "rp2350-arm-s") + set(MICROPY_CROSS_FLAGS "-march=armv7m") +elseif (${PICO_PLATFORM} STREQUAL "rp2350-riscv") + set(MICROPY_CROSS_FLAGS "-march=rv32imc -march-flags=zba,zcmp") +else() + message(WARNING "Unknown PICO_PLATFORM version (${PICO_PLATFORM}), falling back to rp2040") + set(MICROPY_CROSS_FLAGS "-march=armv6m") +endif() # Set the frozen manifest file if (MICROPY_USER_FROZEN_MANIFEST)