2020-08-08 08:15:27 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2023-10-09 10:47:25 -04:00
|
|
|
set(srcs "hal_utils.c")
|
|
|
|
set(includes "platform_port/include")
|
|
|
|
|
|
|
|
# target specific include must be added before the generic one
|
2024-04-02 07:55:44 -04:00
|
|
|
# because of the "include_next" directive used by the efuse_hal.h
|
2024-04-20 06:19:31 -04:00
|
|
|
list(APPEND includes "${target}/include")
|
2024-04-23 08:11:32 -04:00
|
|
|
|
2023-10-09 10:47:25 -04:00
|
|
|
list(APPEND includes "include")
|
2022-12-02 01:54:27 -05:00
|
|
|
|
2023-10-09 10:47:25 -04:00
|
|
|
if(CONFIG_SOC_MPU_SUPPORTED)
|
|
|
|
list(APPEND srcs "mpu_hal.c")
|
|
|
|
endif()
|
2023-01-30 05:03:41 -05:00
|
|
|
|
2023-10-09 10:47:25 -04:00
|
|
|
if(CONFIG_SOC_EFUSE_SUPPORTED)
|
|
|
|
list(APPEND srcs "efuse_hal.c" "${target}/efuse_hal.c")
|
|
|
|
endif()
|
2021-02-07 02:03:51 -05:00
|
|
|
|
2023-10-09 10:47:25 -04:00
|
|
|
if(CONFIG_SOC_LP_TIMER_SUPPORTED)
|
|
|
|
list(APPEND srcs "lp_timer_hal.c")
|
|
|
|
endif()
|
2020-08-08 08:15:27 -04:00
|
|
|
|
2023-10-09 10:47:25 -04:00
|
|
|
if(CONFIG_SOC_WDT_SUPPORTED AND NOT CONFIG_HAL_WDT_USE_ROM_IMPL)
|
2022-04-16 03:06:40 -04:00
|
|
|
list(APPEND srcs "wdt_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
2023-10-30 14:18:46 -04:00
|
|
|
if(CONFIG_SOC_KEY_MANAGER_SUPPORTED)
|
|
|
|
list(APPEND srcs "key_mgr_hal.c")
|
|
|
|
list(APPEND srcs "huk_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-30 05:03:41 -05:00
|
|
|
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
2023-10-09 10:47:25 -04:00
|
|
|
if(CONFIG_SOC_MMU_PERIPH_NUM)
|
|
|
|
list(APPEND srcs "mmu_hal.c")
|
|
|
|
endif()
|
2023-01-30 05:03:41 -05:00
|
|
|
|
2023-06-12 23:56:14 -04: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")
|
2023-10-09 10:47:25 -04:00
|
|
|
elseif(NOT ${target} STREQUAL "linux")
|
2023-06-12 23:56:14 -04:00
|
|
|
list(APPEND srcs "cache_hal.c")
|
|
|
|
endif()
|
2022-02-11 02:30:54 -05:00
|
|
|
endif()
|
|
|
|
|
2020-08-08 08:15:27 -04:00
|
|
|
if(NOT BOOTLOADER_BUILD)
|
2023-08-21 05:04:55 -04:00
|
|
|
list(APPEND srcs "color_hal.c")
|
2020-08-08 08:15:27 -04:00
|
|
|
|
2023-01-30 05:03:41 -05:00
|
|
|
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
2023-10-09 10:47:25 -04:00
|
|
|
if(CONFIG_SOC_SPI_FLASH_SUPPORTED)
|
|
|
|
list(APPEND srcs "spi_flash_hal.c" "spi_flash_hal_iram.c")
|
|
|
|
endif()
|
2023-02-23 09:10:22 -05:00
|
|
|
if(CONFIG_SOC_FLASH_ENC_SUPPORTED)
|
|
|
|
list(APPEND srcs "spi_flash_encrypt_hal_iram.c")
|
|
|
|
endif()
|
2023-01-30 05:03:41 -05:00
|
|
|
endif()
|
|
|
|
|
2024-06-14 04:46:48 -04:00
|
|
|
if(CONFIG_SOC_CLK_TREE_SUPPORTED)
|
2023-07-07 05:35:29 -04:00
|
|
|
list(APPEND srcs "${target}/clk_tree_hal.c")
|
|
|
|
endif()
|
|
|
|
|
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()
|
|
|
|
|
2023-10-09 10:47:25 -04:00
|
|
|
if(CONFIG_SOC_UART_SUPPORTED)
|
|
|
|
list(APPEND srcs "uart_hal.c" "uart_hal_iram.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_GPIO_PORT)
|
|
|
|
list(APPEND srcs "gpio_hal.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SOC_RTCIO_PIN_COUNT)
|
|
|
|
list(APPEND srcs "rtc_io_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-05 06:34:05 -05:00
|
|
|
if(CONFIG_SOC_GPTIMER_SUPPORTED)
|
2023-07-01 11:12:38 -04:00
|
|
|
list(APPEND srcs "timer_hal.c")
|
2023-01-05 06:34:05 -05:00
|
|
|
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()
|
|
|
|
|
2023-10-17 06:54:13 -04:00
|
|
|
if(CONFIG_SOC_ISP_SUPPORTED)
|
|
|
|
list(APPEND srcs "isp_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2024-07-03 03:39:23 -04:00
|
|
|
if(CONFIG_SOC_LP_I2S_SUPPORTED)
|
|
|
|
list(APPEND srcs "lp_i2s_hal.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)
|
2023-06-21 07:00:59 -04:00
|
|
|
list(APPEND srcs "gdma_hal_top.c")
|
|
|
|
|
2024-03-11 08:28:03 -04:00
|
|
|
if(CONFIG_SOC_GDMA_SUPPORT_CRC)
|
|
|
|
list(APPEND srcs "gdma_hal_crc_gen.c")
|
|
|
|
endif()
|
2023-08-07 06:50:50 -04:00
|
|
|
|
2024-03-11 08:28:03 -04:00
|
|
|
if(CONFIG_SOC_AHB_GDMA_VERSION EQUAL 1)
|
|
|
|
list(APPEND srcs "gdma_hal_ahb_v1.c")
|
|
|
|
endif()
|
2023-06-21 07:00:59 -04:00
|
|
|
|
2024-03-11 08:28:03 -04:00
|
|
|
if(CONFIG_SOC_AHB_GDMA_VERSION EQUAL 2)
|
|
|
|
list(APPEND srcs "gdma_hal_ahb_v2.c")
|
|
|
|
endif()
|
2023-06-21 07:00:59 -04:00
|
|
|
|
2024-03-11 08:28:03 -04:00
|
|
|
if(CONFIG_SOC_AXI_GDMA_SUPPORTED)
|
|
|
|
list(APPEND srcs "gdma_hal_axi.c")
|
|
|
|
endif()
|
2022-05-06 06:57:14 -04:00
|
|
|
endif()
|
|
|
|
|
2023-09-24 23:36:16 -04:00
|
|
|
if(CONFIG_SOC_DW_GDMA_SUPPORTED)
|
|
|
|
list(APPEND srcs "dw_gdma_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-08-21 05:04:55 -04:00
|
|
|
if(CONFIG_SOC_DMA2D_SUPPORTED)
|
|
|
|
list(APPEND srcs "dma2d_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-05-06 06:57:14 -04:00
|
|
|
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()
|
|
|
|
|
2023-08-29 07:50:27 -04:00
|
|
|
if(CONFIG_SOC_SDMMC_HOST_SUPPORTED)
|
|
|
|
list(APPEND srcs "sdmmc_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-05-06 06:57:14 -04:00
|
|
|
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-12-05 22:57:43 -05:00
|
|
|
if(CONFIG_SOC_PARLIO_SUPPORTED)
|
|
|
|
list(APPEND srcs "parlio_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-06-29 23:30:03 -04:00
|
|
|
if(CONFIG_SOC_ADC_SUPPORTED)
|
|
|
|
list(APPEND srcs "adc_hal_common.c" "adc_oneshot_hal.c")
|
|
|
|
|
2024-03-11 08:28:03 -04:00
|
|
|
if(CONFIG_SOC_ADC_DMA_SUPPORTED)
|
|
|
|
list(APPEND srcs "adc_hal.c")
|
|
|
|
endif()
|
2022-07-15 00:52:44 -04:00
|
|
|
endif()
|
|
|
|
|
2022-05-31 23:00:00 -04:00
|
|
|
if(CONFIG_SOC_LCDCAM_SUPPORTED)
|
|
|
|
list(APPEND srcs "lcd_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-11-30 21:48:43 -05:00
|
|
|
if(CONFIG_SOC_MIPI_DSI_SUPPORTED)
|
|
|
|
list(APPEND srcs "mipi_dsi_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2024-01-28 23:16:09 -05:00
|
|
|
if(CONFIG_SOC_MIPI_CSI_SUPPORTED)
|
|
|
|
list(APPEND srcs "mipi_csi_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-06-21 02:58:34 -04:00
|
|
|
if(CONFIG_SOC_ECC_SUPPORTED)
|
|
|
|
list(APPEND srcs "ecc_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-03-02 12:10:14 -05:00
|
|
|
if(CONFIG_SOC_ECDSA_SUPPORTED)
|
|
|
|
list(APPEND srcs "ecdsa_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-03-27 07:20:03 -04:00
|
|
|
if(CONFIG_SOC_MPI_SUPPORTED)
|
|
|
|
list(APPEND srcs "mpi_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-07-12 09:02:47 -04:00
|
|
|
if(CONFIG_SOC_SHA_SUPPORTED)
|
|
|
|
list(APPEND srcs "sha_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-12-23 02:32:14 -05:00
|
|
|
if(CONFIG_SOC_AES_SUPPORTED)
|
|
|
|
list(APPEND srcs "aes_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2024-03-13 07:32:32 -04:00
|
|
|
if(CONFIG_SOC_MODEM_CLOCK_IS_INDEPENDENT AND CONFIG_SOC_MODEM_CLOCK_SUPPORTED)
|
2022-10-31 03:22:23 -04:00
|
|
|
list(APPEND srcs "${target}/modem_clock_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-02-14 01:23:29 -05:00
|
|
|
if(CONFIG_SOC_PAU_SUPPORTED)
|
|
|
|
list(APPEND srcs "${target}/pau_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-03 05:58:29 -05:00
|
|
|
if(CONFIG_SOC_BOD_SUPPORTED)
|
|
|
|
list(APPEND srcs "brownout_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2024-02-28 02:11:32 -05:00
|
|
|
if(CONFIG_SOC_JPEG_CODEC_SUPPORTED)
|
|
|
|
list(APPEND srcs "jpeg_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2024-04-08 04:41:19 -04:00
|
|
|
if(CONFIG_SOC_PPA_SUPPORTED)
|
|
|
|
list(APPEND srcs "ppa_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2022-12-28 22:01:13 -05:00
|
|
|
if(CONFIG_SOC_GPSPI_SUPPORTED)
|
|
|
|
list(APPEND srcs
|
2024-03-11 08:28:03 -04:00
|
|
|
"spi_hal.c"
|
|
|
|
"spi_hal_iram.c"
|
|
|
|
"spi_slave_hal.c"
|
|
|
|
"spi_slave_hal_iram.c"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2)
|
|
|
|
list(APPEND srcs "spi_slave_hd_hal.c")
|
|
|
|
endif()
|
2022-12-28 22:01:13 -05:00
|
|
|
endif()
|
|
|
|
|
2023-06-27 03:59:46 -04:00
|
|
|
if(CONFIG_SOC_GPSPI_SUPPORTED AND NOT CONFIG_IDF_TARGET_ESP32)
|
|
|
|
list(APPEND srcs "spi_flash_hal_gpspi.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-06 03:17:16 -05:00
|
|
|
if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED)
|
|
|
|
list(APPEND srcs "sdio_slave_hal.c")
|
|
|
|
endif()
|
2022-12-28 22:01:13 -05:00
|
|
|
|
2023-01-12 05:00:58 -05:00
|
|
|
if(CONFIG_SOC_PMU_SUPPORTED)
|
|
|
|
list(APPEND srcs "${target}/pmu_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-01-24 09:54:33 -05:00
|
|
|
if(CONFIG_SOC_APM_SUPPORTED)
|
|
|
|
list(APPEND srcs "apm_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-02-09 23:59:21 -05: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()
|
|
|
|
|
2024-05-24 03:53:11 -04:00
|
|
|
if(CONFIG_SOC_LCDCAM_CAM_SUPPORTED)
|
|
|
|
list(APPEND srcs "cam_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2024-04-02 09:10:35 -04:00
|
|
|
if(CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED)
|
|
|
|
list(APPEND srcs "usb_serial_jtag_hal.c")
|
|
|
|
endif()
|
|
|
|
|
2023-12-14 16:51:44 -05:00
|
|
|
if(CONFIG_SOC_USB_OTG_SUPPORTED)
|
2024-04-02 07:55:44 -04:00
|
|
|
list(APPEND srcs
|
|
|
|
"usb_dwc_hal.c"
|
|
|
|
"usb_wrap_hal.c")
|
2023-12-14 16:51:44 -05:00
|
|
|
endif()
|
|
|
|
|
2024-06-07 05:16:29 -04:00
|
|
|
if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
|
|
|
|
list(APPEND srcs "${target}/touch_sensor_hal.c")
|
|
|
|
if(CONFIG_SOC_TOUCH_SENSOR_VERSION LESS 3)
|
|
|
|
list(APPEND srcs "touch_sensor_hal.c")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-08-08 08:15:27 -04:00
|
|
|
if(${target} STREQUAL "esp32")
|
|
|
|
list(APPEND srcs
|
2021-08-24 11:53:45 -04:00
|
|
|
"esp32/gpio_hal_workaround.c")
|
2020-08-08 08:15:27 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32s2")
|
|
|
|
list(APPEND srcs
|
2021-08-29 23:30:12 -04:00
|
|
|
"xt_wdt_hal.c"
|
2024-06-07 05:16:29 -04:00
|
|
|
"esp32s2/cp_dma_hal.c")
|
2020-08-08 08:15:27 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${target} STREQUAL "esp32s3")
|
|
|
|
list(APPEND srcs
|
2021-08-29 23:30:12 -04:00
|
|
|
"xt_wdt_hal.c"
|
2023-12-14 16:51:44 -05:00
|
|
|
"esp32s3/rtc_cntl_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
|
2021-08-29 23:30:12 -04:00
|
|
|
"xt_wdt_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-01-17 21:32:56 -05:00
|
|
|
if(${target} STREQUAL "esp32c2")
|
2021-11-06 05:24:45 -04:00
|
|
|
list(APPEND srcs
|
2022-01-17 21:32:56 -05:00
|
|
|
"esp32c2/rtc_cntl_hal.c")
|
2021-11-06 05:24:45 -04:00
|
|
|
endif()
|
2022-07-12 09:02:47 -04:00
|
|
|
|
2022-12-05 04:32:21 -05:00
|
|
|
if(${target} STREQUAL "esp32h2")
|
|
|
|
list(REMOVE_ITEM srcs
|
|
|
|
"esp32h2/rtc_cntl_hal.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)
|
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()
|
2024-06-06 04:23:02 -04:00
|
|
|
|
|
|
|
if((CONFIG_IDF_TARGET_ESP32H2 OR CONFIG_IDF_TARGET_ESP32S2 OR CONFIG_IDF_TARGET_ESP32S3) AND
|
|
|
|
CONFIG_COMPILER_STATIC_ANALYZER AND CMAKE_C_COMPILER_ID STREQUAL "GNU") # TODO IDF-10234
|
|
|
|
target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-analyzer")
|
|
|
|
endif()
|