From 6b3443e5c538cac509dd3b50c44aa0c49431665e Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 13 Jun 2022 00:56:30 +0300 Subject: [PATCH] Improve support for hand-written asm source files in PIO Closes: https://github.com/espressif/arduino-esp32/pull/6817 Co-Authored-By: Ivan Kravets --- CMakeLists.txt | 2 +- tools/copy-libs.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8edbe72..1cefefd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ idf_build_get_property(elf EXECUTABLE GENERATOR_EXPRESSION) add_custom_command( OUTPUT "idf_libs" - COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_ESPTOOLPY_OCT_FLASH}" "${CONFIG_SPIRAM_MODE_OCT}" + COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_ESPTOOLPY_OCT_FLASH}" "${CONFIG_SPIRAM_MODE_OCT}" "${CONFIG_IDF_TARGET_ARCH_XTENSA}" DEPENDS ${elf} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} VERBATIM diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index 094f9d8..9b2f168 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -2,6 +2,7 @@ # config IDF_TARGET=$1 +IS_XTENSA=$4 OCT_FLASH= OCT_PSRAM= if [ "$2" = "y" ]; then @@ -281,6 +282,15 @@ cat pio_start.txt > "$AR_PLATFORMIO_PY" rm pio_end.txt 1pio_start.txt pio_start.txt echo " ASFLAGS=[" >> "$AR_PLATFORMIO_PY" +if [ "$IS_XTENSA" = "y" ]; then + echo " \"-mlongcalls\"" >> "$AR_PLATFORMIO_PY" +else + echo " \"-march=rv32imc\"" >> "$AR_PLATFORMIO_PY" +fi +echo " ]," >> "$AR_PLATFORMIO_PY" +echo "" >> "$AR_PLATFORMIO_PY" + +echo " ASPPFLAGS=[" >> "$AR_PLATFORMIO_PY" set -- $PIO_AS_FLAGS for item; do echo " \"$item\"," >> "$AR_PLATFORMIO_PY"