2022-12-02 01:54:27 -05:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2024-02-20 05:23:18 -05:00
|
|
|
if(CONFIG_IDF_TARGET_ESP32C5_BETA3_VERSION)
|
|
|
|
set(target_folder "esp32c5/beta3")
|
|
|
|
elseif(CONFIG_IDF_TARGET_ESP32C5_MP_VERSION)
|
|
|
|
set(target_folder "esp32c5/mp")
|
|
|
|
else()
|
|
|
|
set(target_folder "${target}")
|
|
|
|
endif()
|
|
|
|
|
2022-12-02 01:54:27 -05:00
|
|
|
# On Linux the soc component is a simple wrapper, without much functionality
|
|
|
|
if(NOT ${target} STREQUAL "linux")
|
2023-01-19 04:35:52 -05:00
|
|
|
set(srcs "lldesc.c"
|
|
|
|
"dport_access_common.c"
|
2024-02-20 05:23:18 -05:00
|
|
|
"${target_folder}/interrupts.c"
|
|
|
|
"${target_folder}/gpio_periph.c"
|
|
|
|
"${target_folder}/uart_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2024-02-20 05:23:18 -05:00
|
|
|
set(includes "include" "${target_folder}")
|
2023-01-19 04:35:52 -05:00
|
|
|
|
2024-02-20 05:23:18 -05:00
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${target_folder}/include")
|
|
|
|
list(APPEND includes "${target_folder}/include")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(target STREQUAL "esp32")
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/dport_access.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_ADC_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/adc_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2023-03-01 06:50:45 -05:00
|
|
|
if(CONFIG_SOC_ANA_CMPR_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/ana_cmpr_periph.c")
|
2023-03-01 06:50:45 -05:00
|
|
|
endif()
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/dedic_gpio_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2024-04-26 06:27:54 -04:00
|
|
|
if(CONFIG_SOC_EMAC_SUPPORTED)
|
|
|
|
list(APPEND srcs "${target_folder}/emac_periph.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
if(CONFIG_SOC_GDMA_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/gdma_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2023-08-21 05:04:55 -04:00
|
|
|
if(CONFIG_SOC_DMA2D_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/dma2d_periph.c")
|
2023-08-21 05:04:55 -04:00
|
|
|
endif()
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
if(CONFIG_SOC_GPSPI_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/spi_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_LEDC_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/ledc_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_PCNT_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/pcnt_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_RMT_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/rmt_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_SDM_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/sdm_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2024-01-16 04:14:28 -05:00
|
|
|
if(CONFIG_SOC_ISP_SUPPORTED)
|
|
|
|
list(APPEND srcs "${target}/isp_periph.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
if(CONFIG_SOC_I2S_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/i2s_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_I2C_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/i2c_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/temperature_sensor_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_GPTIMER_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/timer_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_LCDCAM_SUPPORTED OR CONFIG_SOC_LCD_I80_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/lcd_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2024-01-11 05:43:19 -05:00
|
|
|
if(CONFIG_SOC_MIPI_DSI_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/mipi_dsi_periph.c")
|
2024-01-11 05:43:19 -05:00
|
|
|
endif()
|
|
|
|
|
2024-01-28 23:16:09 -05:00
|
|
|
if(CONFIG_SOC_MIPI_CSI_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/mipi_csi_periph.c")
|
2024-01-28 23:16:09 -05:00
|
|
|
endif()
|
|
|
|
|
2022-12-05 22:57:43 -05:00
|
|
|
if(CONFIG_SOC_PARLIO_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/parlio_periph.c")
|
2022-12-05 22:57:43 -05:00
|
|
|
endif()
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
if(CONFIG_SOC_MCPWM_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/mcpwm_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2023-03-27 07:20:03 -04:00
|
|
|
if(CONFIG_SOC_MPI_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/mpi_periph.c")
|
2023-03-27 07:20:03 -04:00
|
|
|
endif()
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
if(CONFIG_SOC_SDMMC_HOST_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/sdmmc_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/touch_sensor_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_TWAI_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/twai_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
2023-03-20 06:25:10 -04:00
|
|
|
if(CONFIG_SOC_IEEE802154_SUPPORTED)
|
|
|
|
if(NOT target STREQUAL "esp32h4")
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/ieee802154_periph.c")
|
2023-03-20 06:25:10 -04:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
if(CONFIG_SOC_USB_OTG_SUPPORTED)
|
2024-01-19 08:38:30 -05:00
|
|
|
if(NOT ${target} STREQUAL "esp32p4")
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/usb_periph.c"
|
|
|
|
"${target_folder}/usb_dwc_periph.c")
|
2024-01-19 08:38:30 -05:00
|
|
|
endif()
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_DAC_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/dac_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_RTCIO_PIN_COUNT GREATER 0)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/rtc_io_periph.c")
|
2023-01-19 04:35:52 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/sdio_slave_periph.c")
|
2022-12-02 01:54:27 -05:00
|
|
|
endif()
|
|
|
|
|
2024-01-19 04:48:35 -05:00
|
|
|
if(CONFIG_SOC_PAU_SUPPORTED)
|
2024-02-20 05:23:18 -05:00
|
|
|
list(APPEND srcs "${target_folder}/system_retention_periph.c")
|
2024-01-19 04:48:35 -05:00
|
|
|
endif()
|
|
|
|
|
2022-12-02 01:54:27 -05:00
|
|
|
idf_component_register(SRCS ${srcs}
|
2023-01-19 04:35:52 -05:00
|
|
|
INCLUDE_DIRS ${includes}
|
2021-03-10 06:33:24 -05:00
|
|
|
LDFRAGMENTS "linker.lf")
|
2018-03-22 02:27:10 -04:00
|
|
|
|
2023-02-21 23:33:02 -05:00
|
|
|
# For an embedded system, the MMU page size should always be defined statically
|
|
|
|
# For IDF, we define it according to the Flash size that user selects
|
|
|
|
# Replace this value in an adaptive way, if Kconfig isn't available on your platform
|
|
|
|
target_compile_definitions(${COMPONENT_LIB} INTERFACE SOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE)
|
|
|
|
|
2023-07-14 13:54:48 -04:00
|
|
|
target_compile_definitions(${COMPONENT_LIB} INTERFACE SOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ)
|
|
|
|
|
2023-01-19 04:35:52 -05:00
|
|
|
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()
|
2021-07-21 09:09:45 -04:00
|
|
|
|
2022-12-02 01:54:27 -05:00
|
|
|
if(NOT CONFIG_IDF_TARGET_LINUX)
|
2024-02-20 05:23:18 -05:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${target_folder}/ld/${target}.peripherals.ld")
|
2022-12-02 01:54:27 -05:00
|
|
|
endif()
|