@@ -93,6 +93,14 @@ include(${MICROPY_DIR}/py/usermod.cmake)
9393
9494add_executable (${MICROPY_TARGET} )
9595
96+ # Provide a C-level definitions of PICO_ARM.
97+ # (The pico-sdk already defines PICO_RISCV when it's enabled.)
98+ if (PICO_ARM)
99+ target_compile_definitions (pico_platform_headers INTERFACE
100+ PICO_ARM=1
101+ )
102+ endif ()
103+
96104set (MICROPY_QSTRDEFS_PORT
97105 ${MICROPY_PORT_DIR} /qstrdefsport.h
98106)
@@ -108,7 +116,6 @@ set(MICROPY_SOURCE_LIB
108116 ${MICROPY_DIR} /shared/netutils/netutils.c
109117 ${MICROPY_DIR} /shared/netutils/trace.c
110118 ${MICROPY_DIR} /shared/readline/readline.c
111- ${MICROPY_DIR} /shared/runtime/gchelper_thumb1.s
112119 ${MICROPY_DIR} /shared/runtime/gchelper_native.c
113120 ${MICROPY_DIR} /shared/runtime/interrupt_char.c
114121 ${MICROPY_DIR} /shared/runtime/mpirq.c
@@ -123,6 +130,16 @@ set(MICROPY_SOURCE_LIB
123130 ${MICROPY_DIR} /shared/tinyusb/mp_usbd_runtime.c
124131)
125132
133+ if (PICO_ARM)
134+ list (APPEND MICROPY_SOURCE_LIB
135+ ${MICROPY_DIR} /shared/runtime/gchelper_thumb1.s
136+ )
137+ elseif (PICO_RISCV)
138+ list (APPEND MICROPY_SOURCE_LIB
139+ ${MICROPY_DIR} /shared/runtime/gchelper_rv32i.s
140+ )
141+ endif ()
142+
126143set (MICROPY_SOURCE_DRIVERS
127144 ${MICROPY_DIR} /drivers/bus/softspi.c
128145 ${MICROPY_DIR} /drivers/dht/dht.c
@@ -178,7 +195,6 @@ set(MICROPY_SOURCE_QSTR
178195)
179196
180197set (PICO_SDK_COMPONENTS
181- cmsis_core
182198 hardware_adc
183199 hardware_base
184200 hardware_boot_lock
@@ -222,6 +238,17 @@ set(PICO_SDK_COMPONENTS
222238 tinyusb_device
223239)
224240
241+ if (PICO_ARM)
242+ list (APPEND PICO_SDK_COMPONENTS
243+ cmsis_core
244+ )
245+ elseif (PICO_RISCV)
246+ list (APPEND PICO_SDK_COMPONENTS
247+ hardware_hazard3
248+ hardware_riscv
249+ )
250+ endif ()
251+
225252# Use our custom pico_float_micropython float implementation. This is needed for two reasons:
226253# - to fix inf handling in pico-sdk's __wrap___aeabi_fadd();
227254# - so we can use our own libm functions, to fix inaccuracies in the pico-sdk versions.
@@ -243,7 +270,7 @@ if(PICO_RP2040)
243270 ${PICO_SDK_PATH} /src/rp2_common/pico_float/float_init_rom_rp2040.c
244271 ${PICO_SDK_PATH} /src/rp2_common/pico_float/float_v1_rom_shim_rp2040.S
245272 )
246- elseif (PICO_RP2350)
273+ elseif (PICO_RP2350 AND PICO_ARM )
247274 target_sources (pico_float_micropython INTERFACE
248275 ${PICO_SDK_PATH} /src/rp2_common/pico_float/float_aeabi_dcp.S
249276 ${PICO_SDK_PATH} /src/rp2_common/pico_float/float_conv_m33.S
@@ -491,6 +518,12 @@ target_link_options(${MICROPY_TARGET} PRIVATE
491518 -Wl,--wrap=runtime_init_clocks
492519)
493520
521+ if(PICO_RP2350)
522+ target_link_options(${MICROPY_TARGET} PRIVATE
523+ -Wl,--defsym=__micropy_extra_stack__=4096
524+ )
525+ endif()
526+
494527# Apply optimisations to performance-critical source code.
495528set_source_files_properties(
496529 ${MICROPY_PY_DIR} /map.c
@@ -563,7 +596,7 @@ endif()
563596
564597pico_add_extra_outputs(${MICROPY_TARGET} )
565598
566- pico_find_compiler (PICO_COMPILER_SIZE ${PICO_GCC_TRIPLE} - size)
599+ pico_find_compiler_with_triples (PICO_COMPILER_SIZE " ${PICO_GCC_TRIPLE} " size)
567600
568601add_custom_command(TARGET ${MICROPY_TARGET}
569602 POST_BUILD
0 commit comments