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>
diff --git a/ports/esp32/CMakeLists.txt b/ports/esp32/CMakeLists.txt
index c3a675e..1db374b 100644
--- a/ports/esp32/CMakeLists.txt
+++ b/ports/esp32/CMakeLists.txt
@@ -61,8 +61,5 @@
# 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 059989c..0995236 100644
--- a/ports/esp32/esp32_common.cmake
+++ b/ports/esp32/esp32_common.cmake
@@ -14,6 +14,18 @@
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 @@
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
similarity index 100%
rename from ports/esp32/main_esp32/CMakeLists.txt
rename to ports/esp32/main/CMakeLists.txt
diff --git a/ports/esp32/main/idf_component.yml b/ports/esp32/main/idf_component.yml
new file mode 100644
index 0000000..ccbde1f
--- /dev/null
+++ b/ports/esp32/main/idf_component.yml
@@ -0,0 +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 0000000..27e4ac2
--- /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/idf_component.yml b/ports/esp32/main_esp32/idf_component.yml
deleted file mode 100644
index 11f078f..0000000
--- a/ports/esp32/main_esp32/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_esp32/linker.lf b/ports/esp32/main_esp32/linker.lf
deleted file mode 100644
index e00cd63..0000000
--- 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 307c0f3..0000000
--- 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 11f078f..0000000
--- 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 31c5b45..0000000
--- 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 307c0f3..0000000
--- 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 11f078f..0000000
--- 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 cedabcf..0000000
--- 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 bc5ab93..0000000
--- 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 2ee00b2..0000000
--- 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 3c496fa..0000000
--- 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 bc5ab93..0000000
--- 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 2ee00b2..0000000
--- 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 81d2790..0000000
--- 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).