summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2023-10-31 13:28:25 +0100
committerDamien George <damien@micropython.org>2023-11-01 11:38:09 +1100
commit95ce61d0ad05af7b5ce258f1faa01a259dd1275a (patch)
tree659fc156a1a4fecb552a40e552ef49d7328f79c0
parent4cffa848f60b4d403a8edb4c87a6cd12e6d89993 (diff)
esp32: Use better build settings for ESP32-C3.
ESP32-C3 is not Xtensa-based, so build settings are now tailored a bit better following that fact. ESP-IDF 5.x already adds architecture-specific modules by itself so there is no need to specify either the `xtensa` or the `riscv` module in the build settings. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
-rw-r--r--ports/esp32/esp32_common.cmake3
-rw-r--r--ports/esp32/main_esp32c3/CMakeLists.txt1
-rw-r--r--py/mkrules.cmake8
3 files changed, 9 insertions, 3 deletions
diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake
index 8b3dac532..f66c59e34 100644
--- a/ports/esp32/esp32_common.cmake
+++ b/ports/esp32/esp32_common.cmake
@@ -134,7 +134,6 @@ list(APPEND IDF_COMPONENTS
spi_flash
ulp
vfs
- xtensa
)
# Register the main IDF component.
@@ -161,7 +160,9 @@ idf_component_register(
set(MICROPY_TARGET ${COMPONENT_TARGET})
# Define mpy-cross flags, for use with frozen code.
+if(NOT IDF_TARGET STREQUAL "esp32c3")
set(MICROPY_CROSS_FLAGS -march=xtensawin)
+endif()
# Set compile options for this port.
target_compile_definitions(${MICROPY_TARGET} PUBLIC
diff --git a/ports/esp32/main_esp32c3/CMakeLists.txt b/ports/esp32/main_esp32c3/CMakeLists.txt
index 307c0f321..c9f1e5bcb 100644
--- a/ports/esp32/main_esp32c3/CMakeLists.txt
+++ b/ports/esp32/main_esp32c3/CMakeLists.txt
@@ -9,6 +9,5 @@ if(NOT MICROPY_PORT_DIR)
endif()
list(APPEND MICROPY_SOURCE_LIB ${MICROPY_DIR}/shared/runtime/gchelper_generic.c)
-list(APPEND IDF_COMPONENTS riscv)
include(${MICROPY_PORT_DIR}/esp32_common.cmake)
diff --git a/py/mkrules.cmake b/py/mkrules.cmake
index 6415b549a..7622cd903 100644
--- a/py/mkrules.cmake
+++ b/py/mkrules.cmake
@@ -212,10 +212,16 @@ if(MICROPY_FROZEN_MANIFEST)
)
endif()
+ if(NOT MICROPY_CROSS_FLAGS)
+ set(MICROPY_CROSS_FLAGS "")
+ else()
+ set(MICROPY_CROSS_FLAGS "-f${MICROPY_CROSS_FLAGS}")
+ endif()
+
add_custom_target(
BUILD_FROZEN_CONTENT ALL
BYPRODUCTS ${MICROPY_FROZEN_CONTENT}
- COMMAND ${Python3_EXECUTABLE} ${MICROPY_DIR}/tools/makemanifest.py -o ${MICROPY_FROZEN_CONTENT} -v "MPY_DIR=${MICROPY_DIR}" -v "MPY_LIB_DIR=${MICROPY_LIB_DIR}" -v "PORT_DIR=${MICROPY_PORT_DIR}" -v "BOARD_DIR=${MICROPY_BOARD_DIR}" -b "${CMAKE_BINARY_DIR}" -f${MICROPY_CROSS_FLAGS} --mpy-tool-flags=${MICROPY_MPY_TOOL_FLAGS} ${MICROPY_FROZEN_MANIFEST}
+ COMMAND ${Python3_EXECUTABLE} ${MICROPY_DIR}/tools/makemanifest.py -o ${MICROPY_FROZEN_CONTENT} -v "MPY_DIR=${MICROPY_DIR}" -v "MPY_LIB_DIR=${MICROPY_LIB_DIR}" -v "PORT_DIR=${MICROPY_PORT_DIR}" -v "BOARD_DIR=${MICROPY_BOARD_DIR}" -b "${CMAKE_BINARY_DIR}" ${MICROPY_CROSS_FLAGS} --mpy-tool-flags=${MICROPY_MPY_TOOL_FLAGS} ${MICROPY_FROZEN_MANIFEST}
DEPENDS
${MICROPY_QSTRDEFS_GENERATED}
${MICROPY_ROOT_POINTERS}