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 <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2025-11-10 23:14:15 +01:00
committed by Damien George
parent 08096392b5
commit ec5f2bc686

View File

@@ -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)