@@ -93,6 +93,14 @@ include(${MICROPY_DIR}/py/usermod.cmake)
93
93
94
94
add_executable (${MICROPY_TARGET} )
95
95
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
+
96
104
set (MICROPY_QSTRDEFS_PORT
97
105
${MICROPY_PORT_DIR} /qstrdefsport.h
98
106
)
@@ -108,7 +116,6 @@ set(MICROPY_SOURCE_LIB
108
116
${MICROPY_DIR} /shared/netutils/netutils.c
109
117
${MICROPY_DIR} /shared/netutils/trace.c
110
118
${MICROPY_DIR} /shared/readline/readline.c
111
- ${MICROPY_DIR} /shared/runtime/gchelper_thumb1.s
112
119
${MICROPY_DIR} /shared/runtime/gchelper_native.c
113
120
${MICROPY_DIR} /shared/runtime/interrupt_char.c
114
121
${MICROPY_DIR} /shared/runtime/mpirq.c
@@ -123,6 +130,16 @@ set(MICROPY_SOURCE_LIB
123
130
${MICROPY_DIR} /shared/tinyusb/mp_usbd_runtime.c
124
131
)
125
132
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
+
126
143
set (MICROPY_SOURCE_DRIVERS
127
144
${MICROPY_DIR} /drivers/bus/softspi.c
128
145
${MICROPY_DIR} /drivers/dht/dht.c
@@ -178,7 +195,6 @@ set(MICROPY_SOURCE_QSTR
178
195
)
179
196
180
197
set (PICO_SDK_COMPONENTS
181
- cmsis_core
182
198
hardware_adc
183
199
hardware_base
184
200
hardware_boot_lock
@@ -222,6 +238,17 @@ set(PICO_SDK_COMPONENTS
222
238
tinyusb_device
223
239
)
224
240
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
+
225
252
# Use our custom pico_float_micropython float implementation. This is needed for two reasons:
226
253
# - to fix inf handling in pico-sdk's __wrap___aeabi_fadd();
227
254
# - so we can use our own libm functions, to fix inaccuracies in the pico-sdk versions.
@@ -243,7 +270,7 @@ if(PICO_RP2040)
243
270
${PICO_SDK_PATH} /src/rp2_common/pico_float/float_init_rom_rp2040.c
244
271
${PICO_SDK_PATH} /src/rp2_common/pico_float/float_v1_rom_shim_rp2040.S
245
272
)
246
- elseif (PICO_RP2350 )
273
+ elseif (PICO_RP2350 AND PICO_ARM )
247
274
target_sources (pico_float_micropython INTERFACE
248
275
${PICO_SDK_PATH} /src/rp2_common/pico_float/float_aeabi_dcp.S
249
276
${PICO_SDK_PATH} /src/rp2_common/pico_float/float_conv_m33.S
@@ -491,6 +518,12 @@ target_link_options(${MICROPY_TARGET} PRIVATE
491
518
-Wl,--wrap=runtime_init_clocks
492
519
)
493
520
521
+ if (PICO_RP2350 )
522
+ target_link_options (${MICROPY_TARGET} PRIVATE
523
+ -Wl,--defsym=__micropy_extra_stack__=4096
524
+ )
525
+ endif ()
526
+
494
527
# Apply optimisations to performance-critical source code.
495
528
set_source_files_properties (
496
529
${MICROPY_PY_DIR} /map.c
@@ -563,7 +596,7 @@ endif()
563
596
564
597
pico_add_extra_outputs (${MICROPY_TARGET} )
565
598
566
- pico_find_compiler (PICO_COMPILER_SIZE ${PICO_GCC_TRIPLE} - size )
599
+ pico_find_compiler_with_triples (PICO_COMPILER_SIZE " ${PICO_GCC_TRIPLE} " size )
567
600
568
601
add_custom_command (TARGET ${MICROPY_TARGET}
569
602
POST_BUILD
0 commit comments