diff options
author | Angus Gratton <angus@redyak.com.au> | 2025-03-04 12:20:02 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-03-13 11:33:10 +1100 |
commit | 4b1c666c28ef9adb5a9b5156624bccd6a3d129b6 (patch) | |
tree | dfe67b4a72fcc99edca821f8532b7bcd77019023 | |
parent | dafff1fd0e37514b230081b1b34288d1d4b25867 (diff) | |
download | micropython-4b1c666c28ef9adb5a9b5156624bccd6a3d129b6.tar.gz micropython-4b1c666c28ef9adb5a9b5156624bccd6a3d129b6.zip |
esp32: Merge the per-SoC "main" components back together.
Removes redundant metadata from each, shouldn't otherwise change
any build output.
Reverts the split originally added in e4650125.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
-rw-r--r-- | ports/esp32/CMakeLists.txt | 3 | ||||
-rw-r--r-- | ports/esp32/esp32_common.cmake | 14 | ||||
-rw-r--r-- | ports/esp32/main/CMakeLists.txt (renamed from ports/esp32/main_esp32/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | ports/esp32/main/idf_component.yml (renamed from ports/esp32/main_esp32/idf_component.yml) | 4 | ||||
-rw-r--r-- | ports/esp32/main/linker_esp32.lf | 41 | ||||
-rw-r--r-- | ports/esp32/main_esp32/linker.lf | 39 | ||||
-rw-r--r-- | ports/esp32/main_esp32c3/CMakeLists.txt | 14 | ||||
-rw-r--r-- | ports/esp32/main_esp32c3/idf_component.yml | 5 | ||||
-rw-r--r-- | ports/esp32/main_esp32c3/linker.lf | 1 | ||||
-rw-r--r-- | ports/esp32/main_esp32c6/CMakeLists.txt | 14 | ||||
-rw-r--r-- | ports/esp32/main_esp32c6/idf_component.yml | 5 | ||||
-rw-r--r-- | ports/esp32/main_esp32c6/linker.lf | 1 | ||||
-rw-r--r-- | ports/esp32/main_esp32s2/CMakeLists.txt | 13 | ||||
-rw-r--r-- | ports/esp32/main_esp32s2/idf_component.yml | 6 | ||||
-rw-r--r-- | ports/esp32/main_esp32s2/linker.lf | 1 | ||||
-rw-r--r-- | ports/esp32/main_esp32s3/CMakeLists.txt | 13 | ||||
-rw-r--r-- | ports/esp32/main_esp32s3/idf_component.yml | 6 | ||||
-rw-r--r-- | ports/esp32/main_esp32s3/linker.lf | 1 |
18 files changed, 58 insertions, 123 deletions
diff --git a/ports/esp32/CMakeLists.txt b/ports/esp32/CMakeLists.txt index c3a675eb2b..1db374b40a 100644 --- a/ports/esp32/CMakeLists.txt +++ b/ports/esp32/CMakeLists.txt @@ -61,8 +61,5 @@ set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined) # Include main IDF cmake file. include($ENV{IDF_PATH}/tools/cmake/project.cmake) -# Set the location of the main component for the project (one per target). -list(APPEND EXTRA_COMPONENT_DIRS main_${IDF_TARGET}) - # Define the project. project(micropython) diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake index 059989c10a..09952363d6 100644 --- a/ports/esp32/esp32_common.cmake +++ b/ports/esp32/esp32_common.cmake @@ -14,6 +14,18 @@ if(NOT MICROPY_PORT_DIR) get_filename_component(MICROPY_PORT_DIR ${MICROPY_DIR}/ports/esp32 ABSOLUTE) endif() +# RISC-V specific inclusions +if(CONFIG_IDF_TARGET_ARCH_RISCV) + list(APPEND MICROPY_SOURCE_LIB ${MICROPY_DIR}/shared/runtime/gchelper_generic.c) + list(APPEND IDF_COMPONENTS riscv) +endif() + +if(NOT DEFINED MICROPY_PY_TINYUSB) + if(CONFIG_IDF_TARGET_ESP32S2 OR CONFIG_IDF_TARGET_ESP32S3) + set(MICROPY_PY_TINYUSB ON) + endif() +endif() + # Include core source components. include(${MICROPY_DIR}/py/py.cmake) @@ -182,7 +194,7 @@ list(APPEND IDF_COMPONENTS if (MICROPY_USER_LDFRAGMENTS) set(MICROPY_LDFRAGMENTS ${MICROPY_USER_LDFRAGMENTS}) else() - set(MICROPY_LDFRAGMENTS linker.lf) + set(MICROPY_LDFRAGMENTS linker_esp32.lf) endif() # Register the main IDF component. diff --git a/ports/esp32/main_esp32/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt index 40188abff8..40188abff8 100644 --- a/ports/esp32/main_esp32/CMakeLists.txt +++ b/ports/esp32/main/CMakeLists.txt diff --git a/ports/esp32/main_esp32/idf_component.yml b/ports/esp32/main/idf_component.yml index 11f078f69f..ccbde1f27e 100644 --- a/ports/esp32/main_esp32/idf_component.yml +++ b/ports/esp32/main/idf_component.yml @@ -1,5 +1,9 @@ ## IDF Component Manager Manifest File dependencies: espressif/mdns: "~1.1.0" + espressif/esp_tinyusb: + rules: + - if: "target in [esp32s2, esp32s3]" + version: "~1.0.0" idf: version: ">=5.2.0" diff --git a/ports/esp32/main/linker_esp32.lf b/ports/esp32/main/linker_esp32.lf new file mode 100644 index 0000000000..27e4ac2194 --- /dev/null +++ b/ports/esp32/main/linker_esp32.lf @@ -0,0 +1,41 @@ +# This fixes components/esp_ringbuf/linker.lf for ESP32 only to allow us to put +# non-ISR ringbuf functions in flash. + +# Requires that both RINGBUF_PLACE_FUNCTIONS_INTO_FLASH and RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH +# are set to "n" (which is the default), otherwise this would result in duplicate section config +# when resolving the linker fragments. + +# The effect of this file is to leave the ISR functions in RAM (which we require), but apply a fixed +# version of RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y (leaving out prvGetFreeSize and prvGetCurMaxSizeByteBuf) +# See https://github.com/espressif/esp-idf/issues/13378 + +[mapping:esp_ringbuf_fix] +archive: libesp_ringbuf.a +entries: + if IDF_TARGET_ESP32 = y: + # This is exactly the list of functions from RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y, + # but with prvGetFreeSize and prvGetCurMaxSizeByteBuf removed. + ringbuf: prvGetCurMaxSizeNoSplit (default) + ringbuf: prvGetCurMaxSizeAllowSplit (default) + ringbuf: prvInitializeNewRingbuffer (default) + ringbuf: prvReceiveGeneric (default) + ringbuf: vRingbufferDelete (default) + ringbuf: vRingbufferGetInfo (default) + ringbuf: vRingbufferReturnItem (default) + ringbuf: xRingbufferAddToQueueSetRead (default) + ringbuf: xRingbufferCanRead (default) + ringbuf: xRingbufferCreate (default) + ringbuf: xRingbufferCreateStatic (default) + ringbuf: xRingbufferCreateNoSplit (default) + ringbuf: xRingbufferReceive (default) + ringbuf: xRingbufferReceiveSplit (default) + ringbuf: xRingbufferReceiveUpTo (default) + ringbuf: xRingbufferRemoveFromQueueSetRead (default) + ringbuf: xRingbufferSend (default) + ringbuf: xRingbufferSendAcquire (default) + ringbuf: xRingbufferSendComplete (default) + ringbuf: xRingbufferPrintInfo (default) + ringbuf: xRingbufferGetMaxItemSize (default) + ringbuf: xRingbufferGetCurFreeSize (default) + + # Everything else will have the default rule already applied (i.e. noflash_text). diff --git a/ports/esp32/main_esp32/linker.lf b/ports/esp32/main_esp32/linker.lf deleted file mode 100644 index e00cd63f55..0000000000 --- a/ports/esp32/main_esp32/linker.lf +++ /dev/null @@ -1,39 +0,0 @@ -# This fixes components/esp_ringbuf/linker.lf to allow us to put non-ISR ringbuf functions in flash. - -# Requires that both RINGBUF_PLACE_FUNCTIONS_INTO_FLASH and RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH -# are set to "n" (which is the default), otherwise this would result in duplicate section config -# when resolving the linker fragments. - -# The effect of this file is to leave the ISR functions in RAM (which we require), but apply a fixed -# version of RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y (leaving out prvGetFreeSize and prvGetCurMaxSizeByteBuf) -# See https://github.com/espressif/esp-idf/issues/13378 - -[mapping:esp_ringbuf_fix] -archive: libesp_ringbuf.a -entries: - # This is exactly the list of functions from RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y, - # but with prvGetFreeSize and prvGetCurMaxSizeByteBuf removed. - ringbuf: prvGetCurMaxSizeNoSplit (default) - ringbuf: prvGetCurMaxSizeAllowSplit (default) - ringbuf: prvInitializeNewRingbuffer (default) - ringbuf: prvReceiveGeneric (default) - ringbuf: vRingbufferDelete (default) - ringbuf: vRingbufferGetInfo (default) - ringbuf: vRingbufferReturnItem (default) - ringbuf: xRingbufferAddToQueueSetRead (default) - ringbuf: xRingbufferCanRead (default) - ringbuf: xRingbufferCreate (default) - ringbuf: xRingbufferCreateStatic (default) - ringbuf: xRingbufferCreateNoSplit (default) - ringbuf: xRingbufferReceive (default) - ringbuf: xRingbufferReceiveSplit (default) - ringbuf: xRingbufferReceiveUpTo (default) - ringbuf: xRingbufferRemoveFromQueueSetRead (default) - ringbuf: xRingbufferSend (default) - ringbuf: xRingbufferSendAcquire (default) - ringbuf: xRingbufferSendComplete (default) - ringbuf: xRingbufferPrintInfo (default) - ringbuf: xRingbufferGetMaxItemSize (default) - ringbuf: xRingbufferGetCurFreeSize (default) - - # Everything else will have the default rule already applied (i.e. noflash_text). diff --git a/ports/esp32/main_esp32c3/CMakeLists.txt b/ports/esp32/main_esp32c3/CMakeLists.txt deleted file mode 100644 index 307c0f3218..0000000000 --- a/ports/esp32/main_esp32c3/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Set location of base MicroPython directory. -if(NOT MICROPY_DIR) - get_filename_component(MICROPY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../.. ABSOLUTE) -endif() - -# Set location of the ESP32 port directory. -if(NOT MICROPY_PORT_DIR) - get_filename_component(MICROPY_PORT_DIR ${MICROPY_DIR}/ports/esp32 ABSOLUTE) -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/ports/esp32/main_esp32c3/idf_component.yml b/ports/esp32/main_esp32c3/idf_component.yml deleted file mode 100644 index 11f078f69f..0000000000 --- a/ports/esp32/main_esp32c3/idf_component.yml +++ /dev/null @@ -1,5 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/mdns: "~1.1.0" - idf: - version: ">=5.2.0" diff --git a/ports/esp32/main_esp32c3/linker.lf b/ports/esp32/main_esp32c3/linker.lf deleted file mode 100644 index 31c5b4563c..0000000000 --- a/ports/esp32/main_esp32c3/linker.lf +++ /dev/null @@ -1 +0,0 @@ -# Empty linker fragment (no workaround required for C3, see main_esp32/linker.lf). diff --git a/ports/esp32/main_esp32c6/CMakeLists.txt b/ports/esp32/main_esp32c6/CMakeLists.txt deleted file mode 100644 index 307c0f3218..0000000000 --- a/ports/esp32/main_esp32c6/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Set location of base MicroPython directory. -if(NOT MICROPY_DIR) - get_filename_component(MICROPY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../.. ABSOLUTE) -endif() - -# Set location of the ESP32 port directory. -if(NOT MICROPY_PORT_DIR) - get_filename_component(MICROPY_PORT_DIR ${MICROPY_DIR}/ports/esp32 ABSOLUTE) -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/ports/esp32/main_esp32c6/idf_component.yml b/ports/esp32/main_esp32c6/idf_component.yml deleted file mode 100644 index 11f078f69f..0000000000 --- a/ports/esp32/main_esp32c6/idf_component.yml +++ /dev/null @@ -1,5 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/mdns: "~1.1.0" - idf: - version: ">=5.2.0" diff --git a/ports/esp32/main_esp32c6/linker.lf b/ports/esp32/main_esp32c6/linker.lf deleted file mode 100644 index cedabcf979..0000000000 --- a/ports/esp32/main_esp32c6/linker.lf +++ /dev/null @@ -1 +0,0 @@ -# Empty linker fragment (no workaround required for C6, see main_esp32/linker.lf). diff --git a/ports/esp32/main_esp32s2/CMakeLists.txt b/ports/esp32/main_esp32s2/CMakeLists.txt deleted file mode 100644 index bc5ab939c3..0000000000 --- a/ports/esp32/main_esp32s2/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Set location of base MicroPython directory. -if(NOT MICROPY_DIR) - get_filename_component(MICROPY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../.. ABSOLUTE) -endif() - -# Set location of the ESP32 port directory. -if(NOT MICROPY_PORT_DIR) - get_filename_component(MICROPY_PORT_DIR ${MICROPY_DIR}/ports/esp32 ABSOLUTE) -endif() - -set(MICROPY_PY_TINYUSB ON) - -include(${MICROPY_PORT_DIR}/esp32_common.cmake) diff --git a/ports/esp32/main_esp32s2/idf_component.yml b/ports/esp32/main_esp32s2/idf_component.yml deleted file mode 100644 index 2ee00b2877..0000000000 --- a/ports/esp32/main_esp32s2/idf_component.yml +++ /dev/null @@ -1,6 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/mdns: "~1.1.0" - espressif/esp_tinyusb: "~1.0.0" - idf: - version: ">=5.2.0" diff --git a/ports/esp32/main_esp32s2/linker.lf b/ports/esp32/main_esp32s2/linker.lf deleted file mode 100644 index 3c496fa878..0000000000 --- a/ports/esp32/main_esp32s2/linker.lf +++ /dev/null @@ -1 +0,0 @@ -# Empty linker fragment (no workaround required for S2, see main_esp32/linker.lf). diff --git a/ports/esp32/main_esp32s3/CMakeLists.txt b/ports/esp32/main_esp32s3/CMakeLists.txt deleted file mode 100644 index bc5ab939c3..0000000000 --- a/ports/esp32/main_esp32s3/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Set location of base MicroPython directory. -if(NOT MICROPY_DIR) - get_filename_component(MICROPY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../.. ABSOLUTE) -endif() - -# Set location of the ESP32 port directory. -if(NOT MICROPY_PORT_DIR) - get_filename_component(MICROPY_PORT_DIR ${MICROPY_DIR}/ports/esp32 ABSOLUTE) -endif() - -set(MICROPY_PY_TINYUSB ON) - -include(${MICROPY_PORT_DIR}/esp32_common.cmake) diff --git a/ports/esp32/main_esp32s3/idf_component.yml b/ports/esp32/main_esp32s3/idf_component.yml deleted file mode 100644 index 2ee00b2877..0000000000 --- a/ports/esp32/main_esp32s3/idf_component.yml +++ /dev/null @@ -1,6 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/mdns: "~1.1.0" - espressif/esp_tinyusb: "~1.0.0" - idf: - version: ">=5.2.0" diff --git a/ports/esp32/main_esp32s3/linker.lf b/ports/esp32/main_esp32s3/linker.lf deleted file mode 100644 index 81d27906be..0000000000 --- a/ports/esp32/main_esp32s3/linker.lf +++ /dev/null @@ -1 +0,0 @@ -# Empty linker fragment (no workaround required for S3, see main_esp32/linker.lf). |