Skip to content

Commit ec5f2bc

Browse files
agattidpgeorge
authored andcommitted
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>
1 parent 0809639 commit ec5f2bc

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

ports/rp2/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,16 @@ list(APPEND MICROPY_SOURCE_QSTR
487487
)
488488
489489
# Define mpy-cross flags
490-
set(MICROPY_CROSS_FLAGS -march=armv6m)
490+
if (${PICO_PLATFORM} STREQUAL "rp2040")
491+
set(MICROPY_CROSS_FLAGS "-march=armv6m")
492+
elseif (${PICO_PLATFORM} STREQUAL "rp2350-arm-s")
493+
set(MICROPY_CROSS_FLAGS "-march=armv7m")
494+
elseif (${PICO_PLATFORM} STREQUAL "rp2350-riscv")
495+
set(MICROPY_CROSS_FLAGS "-march=rv32imc -march-flags=zba,zcmp")
496+
else()
497+
message(WARNING "Unknown PICO_PLATFORM version (${PICO_PLATFORM}), falling back to rp2040")
498+
set(MICROPY_CROSS_FLAGS "-march=armv6m")
499+
endif()
491500
492501
# Set the frozen manifest file
493502
if (MICROPY_USER_FROZEN_MANIFEST)

0 commit comments

Comments
 (0)