2020-08-08 08:15:27 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2022-12-02 01:54:27 -05:00
|
|
|
# On Linux, there is currently no HAL, hence this simple component registration
|
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
idf_component_register()
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2022-04-16 03:06:40 -04:00
|
|
|
set(srcs "mpu_hal.c"
|
2021-12-22 09:18:43 -05:00
|
|
|
"efuse_hal.c"
|
2022-02-11 02:30:54 -05:00
|
|
|
"${target}/efuse_hal.c"
|
|
|
|
"mmu_hal.c")
|
2021-02-07 02:03:51 -05:00
|
|
|
|
2021-05-18 22:53:21 -04:00
|
|
|
set(includes "${target}/include" "include" "platform_port/include")
|
2020-08-08 08:15:27 -04:00
|
|
|
|
2022-05-06 06:57:14 -04:00
|
|
|
if(NOT CONFIG_HAL_WDT_USE_ROM_IMPL)
|
2022-04-16 03:06:40 -04:00
|
|
|
list(APPEND srcs "wdt_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
2022-02-11 02:30:54 -05:00
|
|
|
if(NOT ${target} STREQUAL "esp32")
|
|
|
|
list(APPEND srcs "cache_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-10-19 03:57:24 -04:00
|
|
|
if(${target} STREQUAL "esp32h4")
|
|
|
|
if(CONFIG_IDF_TARGET_ESP32H4_BETA_VERSION_1)
|
2021-12-30 07:31:38 -05:00
|
|
|
list(APPEND includes "${target}/include/rev1")
|
2022-10-19 03:57:24 -04:00
|
|
|
elseif(CONFIG_IDF_TARGET_ESP32H4_BETA_VERSION_2)
|
2021-12-30 07:31:38 -05:00
|
|
|
list(APPEND includes "${target}/include/rev2")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-08-08 08:15:27 -04:00
|
|
|
if(NOT BOOTLOADER_BUILD)
|
|
|
|
list(APPEND srcs
|
2021-08-24 11:53:45 -04:00
|
|
|
"rtc_io_hal.c"
|
|
|
|
"spi_hal.c"
|
|
|
|
"spi_hal_iram.c"
|
|
|
|
"spi_slave_hal.c"
|
|
|
|
"spi_slave_hal_iram.c"
|
|
|
|
"timer_hal.c"
|
2022-01-02 03:14:17 -05:00
|
|
|
"timer_hal_iram.c"
|
2021-08-24 11:53:45 -04:00
|
|
|
"gpio_hal.c"
|
|
|
|
"uart_hal.c"
|
|
|
|
"uart_hal_iram.c"
|
|
|
|
"spi_flash_hal.c"
|
|
|
|
"spi_flash_hal_iram.c"
|
|
|
|
"spi_flash_encrypt_hal_iram.c"
|
2022-03-24 05:45:58 -04:00
|
|
|
"adc_hal_common.c"
|
2022-07-15 00:52:44 -04:00
|
|
|
"adc_oneshot_hal.c")
|
2020-08-08 08:15:27 -04:00
|
|
|
|
2022-05-06 06:57:14 -04:00
|
|
|
if(CONFIG_SOC_SYSTIMER_SUPPORTED AND NOT CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
|
|
|
|
list(APPEND srcs "systimer_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-08-31 08:12:24 -04:00
|
|
|
if(CONFIG_SOC_LEDC_SUPPORTED)
|
|
|
|
list(APPEND srcs "ledc_hal.c" "ledc_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_I2C_SUPPORTED)
|
|
|
|
list(APPEND srcs "i2c_hal.c" "i2c_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
2022-05-06 06:57:14 -04:00
|
|
|
if(CONFIG_SOC_RMT_SUPPORTED)
|
|
|
|
list(APPEND srcs "rmt_hal.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_PCNT_SUPPORTED)
|
|
|
|
list(APPEND srcs "pcnt_hal.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_MCPWM_SUPPORTED)
|
|
|
|
list(APPEND srcs "mcpwm_hal.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_TWAI_SUPPORTED)
|
|
|
|
list(APPEND srcs "twai_hal.c" "twai_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_GDMA_SUPPORTED)
|
|
|
|
list(APPEND srcs "gdma_hal.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_I2S_SUPPORTED)
|
|
|
|
list(APPEND srcs "i2s_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-05-17 01:47:14 -04:00
|
|
|
if(CONFIG_SOC_SDM_SUPPORTED)
|
|
|
|
list(APPEND srcs "sdm_hal.c")
|
2022-05-06 06:57:14 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_ETH_USE_ESP32_EMAC)
|
|
|
|
list(APPEND srcs "emac_hal.c")
|
2022-04-24 04:40:32 -04:00
|
|
|
endif()
|
|
|
|
|
2022-07-12 02:44:10 -04:00
|
|
|
if(CONFIG_SOC_ETM_SUPPORTED)
|
|
|
|
list(APPEND srcs "etm_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-07-15 00:52:44 -04:00
|
|
|
if(CONFIG_SOC_ADC_DMA_SUPPORTED)
|
|
|
|
list(APPEND srcs "adc_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-05-31 23:00:00 -04:00
|
|
|
if(CONFIG_SOC_LCDCAM_SUPPORTED)
|
|
|
|
list(APPEND srcs "lcd_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-06-21 02:58:34 -04:00
|
|
|
if(CONFIG_SOC_ECC_SUPPORTED)
|
|
|
|
list(APPEND srcs "ecc_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-07-12 09:02:47 -04:00
|
|
|
if(CONFIG_SOC_SHA_SUPPORTED)
|
|
|
|
list(APPEND srcs "sha_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2020-08-08 08:15:27 -04:00
|
|
|
if(${target} STREQUAL "esp32")
|
|
|
|
list(APPEND srcs
|
2021-08-24 11:53:45 -04:00
|
|
|
"sdio_slave_hal.c"
|
|
|
|
"touch_sensor_hal.c"
|
2021-11-06 05:24:45 -04:00
|
|
|
"aes_hal.c"
|
2021-08-24 11:53:45 -04:00
|
|
|
"esp32/brownout_hal.c"
|
|
|
|
"esp32/touch_sensor_hal.c"
|
|
|
|
"esp32/gpio_hal_workaround.c")
|
2020-08-08 08:15:27 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32s2")
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal_gpspi.c"
|
|
|
|
"spi_slave_hd_hal.c"
|
2020-11-26 00:06:21 -05:00
|
|
|
"touch_sensor_hal.c"
|
2021-05-06 04:20:54 -04:00
|
|
|
"usb_hal.c"
|
2021-08-19 08:28:28 -04:00
|
|
|
"usb_phy_hal.c"
|
2021-08-29 23:30:12 -04:00
|
|
|
"xt_wdt_hal.c"
|
2021-11-06 05:24:45 -04:00
|
|
|
"aes_hal.c"
|
2020-08-08 08:15:27 -04:00
|
|
|
"esp32s2/brownout_hal.c"
|
|
|
|
"esp32s2/cp_dma_hal.c"
|
|
|
|
"esp32s2/touch_sensor_hal.c"
|
2022-09-15 08:43:18 -04:00
|
|
|
"usb_dwc_hal.c")
|
2020-08-08 08:15:27 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32s3")
|
|
|
|
list(APPEND srcs
|
2021-08-24 11:53:45 -04:00
|
|
|
"ds_hal.c"
|
2020-08-18 05:11:46 -04:00
|
|
|
"spi_flash_hal_gpspi.c"
|
2020-09-08 05:05:49 -04:00
|
|
|
"spi_slave_hd_hal.c"
|
2020-11-26 00:06:21 -05:00
|
|
|
"touch_sensor_hal.c"
|
2021-05-06 04:20:54 -04:00
|
|
|
"usb_hal.c"
|
2021-08-19 08:28:28 -04:00
|
|
|
"usb_phy_hal.c"
|
2021-08-29 23:30:12 -04:00
|
|
|
"xt_wdt_hal.c"
|
2021-11-06 05:24:45 -04:00
|
|
|
"aes_hal.c"
|
2020-08-08 08:15:27 -04:00
|
|
|
"esp32s3/brownout_hal.c"
|
2022-11-24 05:32:03 -05:00
|
|
|
"hmac_hal.c"
|
2021-06-02 05:57:50 -04:00
|
|
|
"esp32s3/touch_sensor_hal.c"
|
2021-06-18 05:25:04 -04:00
|
|
|
"esp32s3/rtc_cntl_hal.c"
|
2022-09-15 08:43:18 -04:00
|
|
|
"usb_dwc_hal.c")
|
2020-08-08 08:15:27 -04:00
|
|
|
endif()
|
2020-11-26 00:06:21 -05:00
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32c3")
|
|
|
|
list(APPEND srcs
|
2020-09-30 05:27:33 -04:00
|
|
|
"ds_hal.c"
|
2021-04-02 00:41:21 -04:00
|
|
|
"spi_flash_hal_gpspi.c"
|
|
|
|
"spi_slave_hd_hal.c"
|
2021-08-29 23:30:12 -04:00
|
|
|
"xt_wdt_hal.c"
|
2021-11-06 05:24:45 -04:00
|
|
|
"aes_hal.c"
|
2020-11-26 00:06:21 -05:00
|
|
|
"esp32c3/brownout_hal.c"
|
2022-11-24 05:32:03 -05:00
|
|
|
"hmac_hal.c"
|
2020-12-24 08:02:32 -05:00
|
|
|
"esp32c3/rtc_cntl_hal.c")
|
2020-11-26 00:06:21 -05:00
|
|
|
endif()
|
2021-06-09 22:28:23 -04:00
|
|
|
|
2022-10-19 03:57:24 -04:00
|
|
|
if(${target} STREQUAL "esp32h4")
|
2021-06-09 22:28:23 -04:00
|
|
|
list(APPEND srcs
|
2021-08-24 11:53:45 -04:00
|
|
|
"ds_hal.c"
|
|
|
|
"spi_flash_hal_gpspi.c"
|
|
|
|
"spi_slave_hd_hal.c"
|
2021-11-06 05:24:45 -04:00
|
|
|
"aes_hal.c"
|
2022-10-19 03:57:24 -04:00
|
|
|
"esp32h4/brownout_hal.c"
|
2022-11-24 05:32:03 -05:00
|
|
|
"hmac_hal.c"
|
2022-10-19 03:57:24 -04:00
|
|
|
"esp32h4/rtc_cntl_hal.c")
|
2021-06-09 22:28:23 -04:00
|
|
|
endif()
|
2021-11-06 05:24:45 -04:00
|
|
|
|
2022-01-17 21:32:56 -05:00
|
|
|
if(${target} STREQUAL "esp32c2")
|
2021-11-06 05:24:45 -04:00
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal_gpspi.c"
|
|
|
|
"spi_slave_hd_hal.c"
|
2022-01-17 21:32:56 -05:00
|
|
|
"esp32c2/brownout_hal.c"
|
|
|
|
"esp32c2/rtc_cntl_hal.c")
|
2021-11-06 05:24:45 -04:00
|
|
|
endif()
|
2022-07-12 09:02:47 -04:00
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32c6")
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal_gpspi.c"
|
|
|
|
"spi_slave_hd_hal.c"
|
|
|
|
"esp32c6/brownout_hal.c"
|
|
|
|
"esp32c6/rtc_cntl_hal.c")
|
|
|
|
|
|
|
|
# TODO: IDF-5310
|
|
|
|
list(REMOVE_ITEM srcs
|
|
|
|
"adc_oneshot_hal.c"
|
|
|
|
"adc_hal_common.c"
|
|
|
|
)
|
|
|
|
endif()
|
2022-12-05 04:32:21 -05:00
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32h2")
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal_gpspi.c"
|
|
|
|
)
|
|
|
|
|
|
|
|
# TODO: IDF-5310
|
|
|
|
list(REMOVE_ITEM srcs
|
|
|
|
"adc_oneshot_hal.c"
|
|
|
|
"adc_hal_common.c"
|
|
|
|
"spi_slave_hd_hal.c"
|
|
|
|
"spi_hal.c"
|
|
|
|
"spi_hal_iram.c"
|
|
|
|
"spi_slave_hal.c"
|
|
|
|
"spi_slave_hal_iram.c"
|
|
|
|
"esp32h2/brownout_hal.c"
|
|
|
|
"esp32h2/rtc_cntl_hal.c"
|
|
|
|
"timer_hal.c"
|
|
|
|
"timer_hal_iram.c"
|
|
|
|
)
|
|
|
|
endif()
|
2020-08-08 08:15:27 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
idf_component_register(SRCS ${srcs}
|
|
|
|
INCLUDE_DIRS ${includes}
|
|
|
|
PRIV_INCLUDE_DIRS ${priv_include}
|
2021-12-22 09:18:43 -05:00
|
|
|
REQUIRES soc esp_rom
|
2020-08-08 08:15:27 -04:00
|
|
|
LDFRAGMENTS linker.lf)
|
2022-01-31 13:45:31 -05:00
|
|
|
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
2021-05-18 22:53:21 -04:00
|
|
|
|
|
|
|
if(CONFIG_HAL_DEFAULT_ASSERTION_LEVEL EQUAL 1)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u abort")
|
|
|
|
elseif(CONFIG_HAL_DEFAULT_ASSERTION_LEVEL EQUAL 2)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __assert_func")
|
|
|
|
endif()
|