1idf_build_get_property(target IDF_TARGET) 2 3# On Linux the soc component is a simple wrapper, without much functionality 4if(NOT ${target} STREQUAL "linux") 5 set(srcs "lldesc.c" 6 "dport_access_common.c" 7 "${target}/interrupts.c" 8 "${target}/gpio_periph.c" 9 "${target}/uart_periph.c") 10endif() 11 12set(includes "include" "${target}") 13 14if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${target}/include") 15 list(APPEND includes "${target}/include") 16endif() 17 18if(target STREQUAL "esp32") 19 list(APPEND srcs "${target}/dport_access.c") 20endif() 21 22if(CONFIG_SOC_ADC_SUPPORTED) 23 list(APPEND srcs "${target}/adc_periph.c") 24endif() 25 26if(CONFIG_SOC_ANA_CMPR_SUPPORTED) 27 list(APPEND srcs "${target}/ana_cmpr_periph.c") 28endif() 29 30if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED) 31 list(APPEND srcs "${target}/dedic_gpio_periph.c") 32endif() 33 34if(CONFIG_SOC_GDMA_SUPPORTED) 35 list(APPEND srcs "${target}/gdma_periph.c") 36endif() 37 38if(CONFIG_SOC_GPSPI_SUPPORTED) 39 list(APPEND srcs "${target}/spi_periph.c") 40endif() 41 42if(CONFIG_SOC_LEDC_SUPPORTED) 43 list(APPEND srcs "${target}/ledc_periph.c") 44endif() 45 46if(CONFIG_SOC_PCNT_SUPPORTED) 47 list(APPEND srcs "${target}/pcnt_periph.c") 48endif() 49 50if(CONFIG_SOC_RMT_SUPPORTED) 51 list(APPEND srcs "${target}/rmt_periph.c") 52endif() 53 54if(CONFIG_SOC_SDM_SUPPORTED) 55 list(APPEND srcs "${target}/sdm_periph.c") 56endif() 57 58if(CONFIG_SOC_I2S_SUPPORTED) 59 list(APPEND srcs "${target}/i2s_periph.c") 60endif() 61 62if(CONFIG_SOC_I2C_SUPPORTED) 63 list(APPEND srcs "${target}/i2c_periph.c") 64endif() 65 66if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) 67 list(APPEND srcs "${target}/temperature_sensor_periph.c") 68endif() 69 70if(CONFIG_SOC_GPTIMER_SUPPORTED) 71 list(APPEND srcs "${target}/timer_periph.c") 72endif() 73 74if(CONFIG_SOC_LCDCAM_SUPPORTED OR CONFIG_SOC_LCD_I80_SUPPORTED) 75 list(APPEND srcs "${target}/lcd_periph.c") 76endif() 77 78if(CONFIG_SOC_PARLIO_SUPPORTED) 79 list(APPEND srcs "${target}/parlio_periph.c") 80endif() 81 82if(CONFIG_SOC_MCPWM_SUPPORTED) 83 list(APPEND srcs "${target}/mcpwm_periph.c") 84endif() 85 86if(CONFIG_SOC_SDMMC_HOST_SUPPORTED) 87 list(APPEND srcs "${target}/sdmmc_periph.c") 88endif() 89 90if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) 91 list(APPEND srcs "${target}/touch_sensor_periph.c") 92endif() 93 94if(CONFIG_SOC_TWAI_SUPPORTED) 95 list(APPEND srcs "${target}/twai_periph.c") 96endif() 97 98if(CONFIG_SOC_IEEE802154_SUPPORTED) 99 list(APPEND srcs "${target}/ieee802154_periph.c") 100endif() 101 102if(CONFIG_SOC_USB_OTG_SUPPORTED) 103 list(APPEND srcs "${target}/usb_periph.c" 104 "${target}/usb_dwc_periph.c") 105endif() 106 107if(CONFIG_SOC_DAC_SUPPORTED) 108 list(APPEND srcs "${target}/dac_periph.c") 109endif() 110 111if(CONFIG_SOC_RTCIO_PIN_COUNT GREATER 0) 112 list(APPEND srcs "${target}/rtc_io_periph.c") 113endif() 114 115if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED) 116 list(APPEND srcs "${target}/sdio_slave_periph.c") 117endif() 118 119idf_component_register(SRCS ${srcs} 120 INCLUDE_DIRS ${includes} 121 LDFRAGMENTS "linker.lf") 122 123# For an embedded system, the MMU page size should always be defined statically 124# For IDF, we define it according to the Flash size that user selects 125# Replace this value in an adaptive way, if Kconfig isn't available on your platform 126target_compile_definitions(${COMPONENT_LIB} INTERFACE SOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE) 127 128if(target STREQUAL "esp32") 129 # esp_dport_access_reg_read is added as an undefined symbol because otherwise 130 # the linker can ignore dport_access.c as it would no other files depending on any symbols in it. 131 set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u esp_dport_access_reg_read") 132endif() 133 134if(NOT CONFIG_IDF_TARGET_LINUX) 135 target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/ld/${target}.peripherals.ld") 136endif() 137