Skip to content

Commit fda9bf4

Browse files
agattidpgeorge
authored andcommitted
esp32/esp32_common.cmake: Clean up RISC-V directives.
This commit cleans up a couple of RISC-V specific directives in the build script. Namely, removes the forced inclusion of the "riscv" component and introduces proper mpy-cross flags. The "riscv" component is already included by the ESP-IDF build framework, as certain low-level components would not build otherwise, so there is no need to add it to the required components list. The architecture flag for mpy-cross is now set for RISC-V targets, as it was previously set only for Xtensa targets (and it relied on a string comparison rather than using the appropriate configuration variable). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent 9ab6906 commit fda9bf4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

ports/esp32/esp32_common.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ if(CONFIG_IDF_TARGET_ARCH_RISCV)
2020
${MICROPY_DIR}/shared/runtime/gchelper_native.c
2121
${MICROPY_DIR}/shared/runtime/gchelper_rv32i.s
2222
)
23-
list(APPEND IDF_COMPONENTS riscv)
2423
endif()
2524

2625
if(NOT DEFINED MICROPY_PY_TINYUSB)
@@ -237,8 +236,10 @@ idf_component_register(
237236
set(MICROPY_TARGET ${COMPONENT_TARGET})
238237

239238
# Define mpy-cross flags, for use with frozen code.
240-
if(CONFIG_IDF_TARGET_ARCH STREQUAL "xtensa")
241-
set(MICROPY_CROSS_FLAGS -march=xtensawin)
239+
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
240+
set(MICROPY_CROSS_FLAGS -march=xtensawin)
241+
elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
242+
set(MICROPY_CROSS_FLAGS -march=rv32imc)
242243
endif()
243244

244245
# Set compile options for this port.

0 commit comments

Comments
 (0)