diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 45cb7ed9b4..e40c7c04b9 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -2,16 +2,124 @@ idf_build_get_property(target IDF_TARGET) # On Linux the soc component is a simple wrapper, without much functionality if(NOT ${target} STREQUAL "linux") - set(srcs "lldesc.c" - "dport_access_common.c") + set(srcs "lldesc.c" + "dport_access_common.c" + "${target}/interrupts.c" + "${target}/gpio_periph.c" + "${target}/uart_periph.c") +endif() + +set(includes "include" "${target}") + +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${target}/include") + list(APPEND includes "${target}/include") + if(target STREQUAL "esp32h4") + if(CONFIG_IDF_TARGET_ESP32H4_BETA_VERSION_1) + list(APPEND includes "${target}/include/rev1") + elseif(CONFIG_IDF_TARGET_ESP32H4_BETA_VERSION_2) + list(APPEND includes "${target}/include/rev2") + endif() + endif() +endif() + +if(target STREQUAL "esp32") + list(APPEND srcs "${target}/dport_access.c") +endif() + +if(CONFIG_SOC_ADC_SUPPORTED) + list(APPEND srcs "${target}/adc_periph.c") +endif() + +if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED) + list(APPEND srcs "${target}/dedic_gpio_periph.c") +endif() + +if(CONFIG_SOC_GDMA_SUPPORTED) + list(APPEND srcs "${target}/gdma_periph.c") +endif() + +if(CONFIG_SOC_GPSPI_SUPPORTED) + list(APPEND srcs "${target}/spi_periph.c") +endif() + +if(CONFIG_SOC_LEDC_SUPPORTED) + list(APPEND srcs "${target}/ledc_periph.c") +endif() + +if(CONFIG_SOC_PCNT_SUPPORTED) + list(APPEND srcs "${target}/pcnt_periph.c") +endif() + +if(CONFIG_SOC_RMT_SUPPORTED) + list(APPEND srcs "${target}/rmt_periph.c") +endif() + +if(CONFIG_SOC_SDM_SUPPORTED) + list(APPEND srcs "${target}/sdm_periph.c") +endif() + +if(CONFIG_SOC_I2S_SUPPORTED) + list(APPEND srcs "${target}/i2s_periph.c") +endif() + +if(CONFIG_SOC_I2C_SUPPORTED) + list(APPEND srcs "${target}/i2c_periph.c") +endif() + +if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) + list(APPEND srcs "${target}/temperature_sensor_periph.c") +endif() + +if(CONFIG_SOC_GPTIMER_SUPPORTED) + list(APPEND srcs "${target}/timer_periph.c") +endif() + +if(CONFIG_SOC_LCDCAM_SUPPORTED OR CONFIG_SOC_LCD_I80_SUPPORTED) + list(APPEND srcs "${target}/lcd_periph.c") +endif() + +if(CONFIG_SOC_MCPWM_SUPPORTED) + list(APPEND srcs "${target}/mcpwm_periph.c") +endif() + +if(CONFIG_SOC_SDMMC_HOST_SUPPORTED) + list(APPEND srcs "${target}/sdmmc_periph.c") +endif() + +if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) + list(APPEND srcs "${target}/touch_sensor_periph.c") +endif() + +if(CONFIG_SOC_TWAI_SUPPORTED) + list(APPEND srcs "${target}/twai_periph.c") +endif() + +if(CONFIG_SOC_USB_OTG_SUPPORTED) + list(APPEND srcs "${target}/usb_periph.c" + "${target}/usb_otg_periph.c") +endif() + +if(CONFIG_SOC_DAC_SUPPORTED) + list(APPEND srcs "${target}/dac_periph.c") +endif() + +if(CONFIG_SOC_RTCIO_PIN_COUNT GREATER 0) + list(APPEND srcs "${target}/rtc_io_periph.c") +endif() + +if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED) + list(APPEND srcs "${target}/sdio_slave_periph.c") endif() idf_component_register(SRCS ${srcs} - INCLUDE_DIRS include + INCLUDE_DIRS ${includes} LDFRAGMENTS "linker.lf") -idf_build_get_property(target IDF_TARGET) -add_subdirectory(${target}) +if(target STREQUAL "esp32") + # esp_dport_access_reg_read is added as an undefined symbol because otherwise + # the linker can ignore dport_access.c as it would no other files depending on any symbols in it. + set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u esp_dport_access_reg_read") +endif() if(NOT CONFIG_IDF_TARGET_LINUX) target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/ld/${target}.peripherals.ld") diff --git a/components/soc/esp32/CMakeLists.txt b/components/soc/esp32/CMakeLists.txt deleted file mode 100644 index f68511833c..0000000000 --- a/components/soc/esp32/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -set(srcs - "adc_periph.c" - "dac_periph.c" - "dport_access.c" - "gpio_periph.c" - "sdm_periph.c" - "i2c_periph.c" - "i2s_periph.c" - "interrupts.c" - "lcd_periph.c" - "ledc_periph.c" - "mcpwm_periph.c" - "pcnt_periph.c" - "rmt_periph.c" - "rtc_io_periph.c" - "sdio_slave_periph.c" - "sdmmc_periph.c" - "spi_periph.c" - "timer_periph.c" - "twai_periph.c" - "touch_sensor_periph.c" - "uart_periph.c") - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") -target_include_directories(${COMPONENT_LIB} PUBLIC . include) - -#esp_dport_access_reg_read is added as an undefined symbol because otherwise -#the linker can ignore dport_access.c as it would no other files depending on any symbols in it. -set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u esp_dport_access_reg_read") diff --git a/components/soc/esp32c2/CMakeLists.txt b/components/soc/esp32c2/CMakeLists.txt deleted file mode 100644 index 94ab7b6b20..0000000000 --- a/components/soc/esp32c2/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -set(srcs - "adc_periph.c" - "dedic_gpio_periph.c" - "gdma_periph.c" - "gpio_periph.c" - "interrupts.c" - "spi_periph.c" - "ledc_periph.c" - "i2c_periph.c" - "uart_periph.c" - "temperature_sensor_periph.c" - "timer_periph.c") - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") -target_include_directories(${COMPONENT_LIB} PUBLIC . include) diff --git a/components/soc/esp32c3/CMakeLists.txt b/components/soc/esp32c3/CMakeLists.txt deleted file mode 100644 index 367b4da596..0000000000 --- a/components/soc/esp32c3/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -set(srcs - "adc_periph.c" - "dedic_gpio_periph.c" - "gdma_periph.c" - "gpio_periph.c" - "sdm_periph.c" - "interrupts.c" - "spi_periph.c" - "ledc_periph.c" - "rmt_periph.c" - "i2s_periph.c" - "i2c_periph.c" - "uart_periph.c" - "temperature_sensor_periph.c" - "timer_periph.c" - "twai_periph.c") - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") -target_include_directories(${COMPONENT_LIB} PUBLIC . include) diff --git a/components/soc/esp32c6/CMakeLists.txt b/components/soc/esp32c6/CMakeLists.txt deleted file mode 100644 index fe727d29fb..0000000000 --- a/components/soc/esp32c6/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -set(srcs - "adc_periph.c" - "dedic_gpio_periph.c" - "gdma_periph.c" - "gpio_periph.c" - "rtc_io_periph.c" - "sdm_periph.c" - "interrupts.c" - "spi_periph.c" - "ledc_periph.c" - "pcnt_periph.c" - "mcpwm_periph.c" - "rmt_periph.c" - "i2s_periph.c" - "i2c_periph.c" - "uart_periph.c" - "temperature_sensor_periph.c" - "timer_periph.c" - "twai_periph.c" - "sdio_slave_periph.c") - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") -target_include_directories(${COMPONENT_LIB} PUBLIC . include) diff --git a/components/soc/esp32h2/CMakeLists.txt b/components/soc/esp32h2/CMakeLists.txt deleted file mode 100644 index 2288fc49c8..0000000000 --- a/components/soc/esp32h2/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -set(srcs - "adc_periph.c" - "dedic_gpio_periph.c" - "gdma_periph.c" - "gpio_periph.c" - "interrupts.c" - "spi_periph.c" - "ledc_periph.c" - "pcnt_periph.c" - "rmt_periph.c" - "sdm_periph.c" - "i2s_periph.c" - "i2c_periph.c" - "uart_periph.c" - "temperature_sensor_periph.c" - "timer_periph.c") - - -#// ESP32H2-TODO -list(REMOVE_ITEM srcs - "adc_periph.c" - "dedic_gpio_periph.c" - "ledc_periph.c" - "i2c_periph.c" - "temperature_sensor_periph.c" - "adc_periph.c" - ) - - - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") -target_include_directories(${COMPONENT_LIB} PUBLIC . include) diff --git a/components/soc/esp32h4/CMakeLists.txt b/components/soc/esp32h4/CMakeLists.txt deleted file mode 100644 index 482141bb80..0000000000 --- a/components/soc/esp32h4/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -set(srcs - "adc_periph.c" - "dedic_gpio_periph.c" - "gdma_periph.c" - "gpio_periph.c" - "sdm_periph.c" - "interrupts.c" - "spi_periph.c" - "ledc_periph.c" - "rmt_periph.c" - "i2s_periph.c" - "i2c_periph.c" - "uart_periph.c" - "temperature_sensor_periph.c" - "timer_periph.c") - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") - -set(inc_path "." "include") - -if(target STREQUAL "esp32h4") - if(CONFIG_IDF_TARGET_ESP32H4_BETA_VERSION_1) - list(APPEND inc_path "include/rev1") - elseif(CONFIG_IDF_TARGET_ESP32H4_BETA_VERSION_2) - list(APPEND inc_path "include/rev2") - endif() -endif() - -target_include_directories(${COMPONENT_LIB} PUBLIC ${inc_path}) diff --git a/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in index 90ad7fee72..42a39983f9 100644 --- a/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in @@ -19,10 +19,6 @@ config SOC_GPTIMER_SUPPORTED bool default y -config SOC_TWAI_SUPPORTED - bool - default y - config SOC_BT_SUPPORTED bool default y diff --git a/components/soc/esp32h4/include/soc/soc_caps.h b/components/soc/esp32h4/include/soc/soc_caps.h index c7da987f9d..735093c2ef 100644 --- a/components/soc/esp32h4/include/soc/soc_caps.h +++ b/components/soc/esp32h4/include/soc/soc_caps.h @@ -37,7 +37,6 @@ #define SOC_DEDICATED_GPIO_SUPPORTED 1 #define SOC_GDMA_SUPPORTED 1 #define SOC_GPTIMER_SUPPORTED 1 -#define SOC_TWAI_SUPPORTED 1 #define SOC_BT_SUPPORTED 1 #define SOC_IEEE802154_SUPPORTED 1 #define SOC_IEEE802154_BLE_ONLY 1 diff --git a/components/soc/esp32s2/CMakeLists.txt b/components/soc/esp32s2/CMakeLists.txt deleted file mode 100644 index 9ca95c4cfe..0000000000 --- a/components/soc/esp32s2/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -set(srcs - "adc_periph.c" - "dac_periph.c" - "dedic_gpio_periph.c" - "gpio_periph.c" - "sdm_periph.c" - "i2c_periph.c" - "i2s_periph.c" - "interrupts.c" - "lcd_periph.c" - "ledc_periph.c" - "pcnt_periph.c" - "rmt_periph.c" - "rtc_io_periph.c" - "spi_periph.c" - "timer_periph.c" - "touch_sensor_periph.c" - "twai_periph.c" - "uart_periph.c" - "usb_periph.c" - "temperature_sensor_periph.c" - "usb_otg_periph.c") - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") -target_include_directories(${COMPONENT_LIB} PUBLIC . include) diff --git a/components/soc/esp32s3/CMakeLists.txt b/components/soc/esp32s3/CMakeLists.txt deleted file mode 100644 index 8b5cfbffe1..0000000000 --- a/components/soc/esp32s3/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -set(srcs - "adc_periph.c" - "dedic_gpio_periph.c" - "gdma_periph.c" - "gpio_periph.c" - "sdm_periph.c" - "i2c_periph.c" - "i2s_periph.c" - "interrupts.c" - "lcd_periph.c" - "ledc_periph.c" - "mcpwm_periph.c" - "pcnt_periph.c" - "rmt_periph.c" - "rtc_io_periph.c" - "sdmmc_periph.c" - "spi_periph.c" - "temperature_sensor_periph.c" - "timer_periph.c" - "touch_sensor_periph.c" - "twai_periph.c" - "uart_periph.c" - "usb_periph.c" - "usb_otg_periph.c") - -add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") - -target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") -target_include_directories(${COMPONENT_LIB} PUBLIC . include) diff --git a/components/soc/linux/CMakeLists.txt b/components/soc/linux/CMakeLists.txt deleted file mode 100644 index 47e3727b8c..0000000000 --- a/components/soc/linux/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -target_include_directories(${COMPONENT_LIB} INTERFACE . include)