2023-03-27 11:20:03 +00:00
|
|
|
|
2020-08-08 12:15:27 +00:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2022-12-02 06:54:27 +00: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 07:06:40 +00:00
|
|
|
set(srcs "mpu_hal.c"
|
2021-12-22 14:18:43 +00:00
|
|
|
"efuse_hal.c"
|
2023-01-30 10:03:41 +00:00
|
|
|
"${target}/efuse_hal.c")
|
|
|
|
|
2021-02-07 07:03:51 +00:00
|
|
|
|
2021-05-19 02:53:21 +00:00
|
|
|
set(includes "${target}/include" "include" "platform_port/include")
|
2020-08-08 12:15:27 +00:00
|
|
|
|
2022-05-06 10:57:14 +00:00
|
|
|
if(NOT CONFIG_HAL_WDT_USE_ROM_IMPL)
|
2022-04-16 07:06:40 +00:00
|
|
|
list(APPEND srcs "wdt_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-30 10:03:41 +00:00
|
|
|
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
|
|
|
list(APPEND srcs "mmu_hal.c")
|
|
|
|
|
2023-06-13 03:56:14 +00:00
|
|
|
# We wrap Cache ROM APIs as Cache HAL APIs for: 1. internal ram ; 2. unified APIs
|
|
|
|
# ESP32 cache structure / ROM APIs are different and we have a patch `cache_hal_esp32.c` for it.
|
|
|
|
if(${target} STREQUAL "esp32")
|
|
|
|
list(APPEND srcs "esp32/cache_hal_esp32.c")
|
|
|
|
else()
|
|
|
|
list(APPEND srcs "cache_hal.c")
|
|
|
|
endif()
|
2022-02-11 07:30:54 +00:00
|
|
|
endif()
|
|
|
|
|
2023-06-02 06:19:01 +00:00
|
|
|
if(CONFIG_SOC_LP_TIMER_SUPPORTED)
|
|
|
|
list(APPEND srcs "lp_timer_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2020-08-08 12:15:27 +00:00
|
|
|
if(NOT BOOTLOADER_BUILD)
|
|
|
|
list(APPEND srcs
|
2021-08-24 15:53:45 +00:00
|
|
|
"rtc_io_hal.c"
|
|
|
|
"gpio_hal.c"
|
|
|
|
"uart_hal.c"
|
|
|
|
"uart_hal_iram.c"
|
2022-12-28 07:04:51 +00:00
|
|
|
"${target}/clk_tree_hal.c")
|
2020-08-08 12:15:27 +00:00
|
|
|
|
2023-01-30 10:03:41 +00:00
|
|
|
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal.c"
|
|
|
|
"spi_flash_hal_iram.c"
|
|
|
|
)
|
2023-02-23 14:10:22 +00:00
|
|
|
if(CONFIG_SOC_FLASH_ENC_SUPPORTED)
|
|
|
|
list(APPEND srcs "spi_flash_encrypt_hal_iram.c")
|
|
|
|
endif()
|
2023-01-30 10:03:41 +00:00
|
|
|
endif()
|
|
|
|
|
2022-05-06 10:57:14 +00:00
|
|
|
if(CONFIG_SOC_SYSTIMER_SUPPORTED AND NOT CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
|
|
|
|
list(APPEND srcs "systimer_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-05 11:34:05 +00:00
|
|
|
if(CONFIG_SOC_GPTIMER_SUPPORTED)
|
2023-07-01 15:12:38 +00:00
|
|
|
list(APPEND srcs "timer_hal.c")
|
2023-01-05 11:34:05 +00:00
|
|
|
endif()
|
|
|
|
|
2022-08-31 12:12:24 +00: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 10:57:14 +00: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 05:47:14 +00:00
|
|
|
if(CONFIG_SOC_SDM_SUPPORTED)
|
|
|
|
list(APPEND srcs "sdm_hal.c")
|
2022-05-06 10:57:14 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_ETH_USE_ESP32_EMAC)
|
|
|
|
list(APPEND srcs "emac_hal.c")
|
2022-04-24 08:40:32 +00:00
|
|
|
endif()
|
|
|
|
|
2022-07-12 06:44:10 +00:00
|
|
|
if(CONFIG_SOC_ETM_SUPPORTED)
|
|
|
|
list(APPEND srcs "etm_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-12-06 03:57:43 +00:00
|
|
|
if(CONFIG_SOC_PARLIO_SUPPORTED)
|
|
|
|
list(APPEND srcs "parlio_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-06-30 03:30:03 +00:00
|
|
|
if(CONFIG_SOC_ADC_SUPPORTED)
|
|
|
|
list(APPEND srcs "adc_hal_common.c" "adc_oneshot_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-07-15 04:52:44 +00:00
|
|
|
if(CONFIG_SOC_ADC_DMA_SUPPORTED)
|
|
|
|
list(APPEND srcs "adc_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-06-01 03:00:00 +00:00
|
|
|
if(CONFIG_SOC_LCDCAM_SUPPORTED)
|
|
|
|
list(APPEND srcs "lcd_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-06-21 06:58:34 +00:00
|
|
|
if(CONFIG_SOC_ECC_SUPPORTED)
|
|
|
|
list(APPEND srcs "ecc_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-03-02 17:10:14 +00:00
|
|
|
if(CONFIG_SOC_ECDSA_SUPPORTED)
|
|
|
|
list(APPEND srcs "ecdsa_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-03-27 11:20:03 +00:00
|
|
|
if(CONFIG_SOC_MPI_SUPPORTED)
|
|
|
|
list(APPEND srcs "mpi_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-07-12 13:02:47 +00:00
|
|
|
if(CONFIG_SOC_SHA_SUPPORTED)
|
|
|
|
list(APPEND srcs "sha_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-12-23 07:32:14 +00:00
|
|
|
if(CONFIG_SOC_AES_SUPPORTED)
|
|
|
|
list(APPEND srcs "aes_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-10-31 07:22:23 +00:00
|
|
|
if(CONFIG_SOC_MODEM_CLOCK_IS_INDEPENDENT)
|
|
|
|
list(APPEND srcs "${target}/modem_clock_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-02-14 06:23:29 +00:00
|
|
|
if(CONFIG_SOC_PAU_SUPPORTED)
|
|
|
|
list(APPEND srcs "${target}/pau_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-03 10:58:29 +00:00
|
|
|
if(CONFIG_SOC_BOD_SUPPORTED)
|
|
|
|
list(APPEND srcs "brownout_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-12-29 03:01:13 +00:00
|
|
|
if(CONFIG_SOC_GPSPI_SUPPORTED)
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_hal.c"
|
|
|
|
"spi_hal_iram.c"
|
|
|
|
"spi_slave_hal.c"
|
|
|
|
"spi_slave_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2)
|
|
|
|
list(APPEND srcs "spi_slave_hd_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-06 08:17:16 +00:00
|
|
|
if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED)
|
|
|
|
list(APPEND srcs "sdio_slave_hal.c")
|
|
|
|
endif()
|
2022-12-29 03:01:13 +00:00
|
|
|
|
2023-01-12 10:00:58 +00:00
|
|
|
if(CONFIG_SOC_PMU_SUPPORTED)
|
|
|
|
list(APPEND srcs "${target}/pmu_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-24 14:54:33 +00:00
|
|
|
if(CONFIG_SOC_APM_SUPPORTED)
|
|
|
|
list(APPEND srcs "apm_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-02-10 04:59:21 +00:00
|
|
|
if(CONFIG_SOC_HMAC_SUPPORTED AND NOT CONFIG_IDF_TARGET_ESP32S2)
|
|
|
|
# For ESP32-S2 we do not have HMAC HAL layer implementation yet
|
|
|
|
list(APPEND srcs "hmac_hal.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_DIG_SIGN_SUPPORTED AND NOT CONFIG_IDF_TARGET_ESP32S2)
|
|
|
|
# For ESP32-S2 we do not have DS HAL layer implementation yet
|
|
|
|
list(APPEND srcs "ds_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2020-08-08 12:15:27 +00:00
|
|
|
if(${target} STREQUAL "esp32")
|
|
|
|
list(APPEND srcs
|
2021-08-24 15:53:45 +00:00
|
|
|
"touch_sensor_hal.c"
|
|
|
|
"esp32/touch_sensor_hal.c"
|
|
|
|
"esp32/gpio_hal_workaround.c")
|
2020-08-08 12:15:27 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32s2")
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal_gpspi.c"
|
2020-11-26 05:06:21 +00:00
|
|
|
"touch_sensor_hal.c"
|
2021-05-06 08:20:54 +00:00
|
|
|
"usb_hal.c"
|
2021-08-19 12:28:28 +00:00
|
|
|
"usb_phy_hal.c"
|
2021-08-30 03:30:12 +00:00
|
|
|
"xt_wdt_hal.c"
|
2020-08-08 12:15:27 +00:00
|
|
|
"esp32s2/cp_dma_hal.c"
|
|
|
|
"esp32s2/touch_sensor_hal.c"
|
2022-09-15 12:43:18 +00:00
|
|
|
"usb_dwc_hal.c")
|
2020-08-08 12:15:27 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32s3")
|
|
|
|
list(APPEND srcs
|
2020-08-18 09:11:46 +00:00
|
|
|
"spi_flash_hal_gpspi.c"
|
2020-11-26 05:06:21 +00:00
|
|
|
"touch_sensor_hal.c"
|
2021-05-06 08:20:54 +00:00
|
|
|
"usb_hal.c"
|
2021-08-19 12:28:28 +00:00
|
|
|
"usb_phy_hal.c"
|
2021-08-30 03:30:12 +00:00
|
|
|
"xt_wdt_hal.c"
|
2021-06-02 09:57:50 +00:00
|
|
|
"esp32s3/touch_sensor_hal.c"
|
2021-06-18 09:25:04 +00:00
|
|
|
"esp32s3/rtc_cntl_hal.c"
|
2022-09-15 12:43:18 +00:00
|
|
|
"usb_dwc_hal.c")
|
2020-08-08 12:15:27 +00:00
|
|
|
endif()
|
2020-11-26 05:06:21 +00:00
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32c3")
|
|
|
|
list(APPEND srcs
|
2021-04-02 04:41:21 +00:00
|
|
|
"spi_flash_hal_gpspi.c"
|
2021-08-30 03:30:12 +00:00
|
|
|
"xt_wdt_hal.c"
|
2020-12-24 13:02:32 +00:00
|
|
|
"esp32c3/rtc_cntl_hal.c")
|
2020-11-26 05:06:21 +00:00
|
|
|
endif()
|
2021-06-10 02:28:23 +00:00
|
|
|
|
2022-01-18 02:32:56 +00:00
|
|
|
if(${target} STREQUAL "esp32c2")
|
2021-11-06 09:24:45 +00:00
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal_gpspi.c"
|
2022-01-18 02:32:56 +00:00
|
|
|
"esp32c2/rtc_cntl_hal.c")
|
2021-11-06 09:24:45 +00:00
|
|
|
endif()
|
2022-07-12 13:02:47 +00:00
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32c6")
|
|
|
|
list(APPEND srcs
|
2023-02-10 04:59:21 +00:00
|
|
|
"spi_flash_hal_gpspi.c")
|
2022-07-12 13:02:47 +00:00
|
|
|
|
|
|
|
endif()
|
2022-12-05 09:32:21 +00:00
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32h2")
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_hal_gpspi.c"
|
|
|
|
)
|
|
|
|
|
|
|
|
list(REMOVE_ITEM srcs
|
|
|
|
"esp32h2/rtc_cntl_hal.c"
|
|
|
|
)
|
|
|
|
endif()
|
2020-08-08 12:15:27 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
idf_component_register(SRCS ${srcs}
|
|
|
|
INCLUDE_DIRS ${includes}
|
|
|
|
PRIV_INCLUDE_DIRS ${priv_include}
|
2021-12-22 14:18:43 +00:00
|
|
|
REQUIRES soc esp_rom
|
2020-08-08 12:15:27 +00:00
|
|
|
LDFRAGMENTS linker.lf)
|
2022-01-31 18:45:31 +00:00
|
|
|
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
2021-05-19 02:53:21 +00: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()
|