1idf_build_get_property(target IDF_TARGET)
2
3set(srcs "wdt_hal_iram.c"
4         "mpu_hal.c"
5         "cpu_hal.c")
6
7set(includes "${target}/include" "include" "platform_port/include")
8
9if(NOT BOOTLOADER_BUILD)
10    list(APPEND srcs
11        "rmt_hal.c"
12        "rtc_io_hal.c"
13        "spi_hal.c"
14        "spi_hal_iram.c"
15        "spi_slave_hal.c"
16        "spi_slave_hal_iram.c"
17        "i2s_hal.c"
18        "sigmadelta_hal.c"
19        "timer_hal.c"
20        "ledc_hal.c"
21        "ledc_hal_iram.c"
22        "i2c_hal.c"
23        "i2c_hal_iram.c"
24        "gpio_hal.c"
25        "uart_hal.c"
26        "uart_hal_iram.c"
27        "spi_flash_hal.c"
28        "spi_flash_hal_iram.c"
29        "spi_flash_encrypt_hal_iram.c"
30        "soc_hal.c"
31        "interrupt_controller_hal.c"
32        "sha_hal.c"
33        "aes_hal.c"
34        "twai_hal.c"
35        "twai_hal_iram.c"
36        "adc_hal.c")
37
38    if(${target} STREQUAL "esp32")
39        list(APPEND srcs
40            "dac_hal.c"
41            "mcpwm_hal.c"
42            "pcnt_hal.c"
43            "sdio_slave_hal.c"
44            "touch_sensor_hal.c"
45            "esp32/adc_hal.c"
46            "esp32/brownout_hal.c"
47            "esp32/interrupt_descriptor_table.c"
48            "esp32/touch_sensor_hal.c"
49            "esp32/gpio_hal_workaround.c")
50        if(NOT BOOTLOADER_BUILD AND CONFIG_ETH_USE_ESP32_EMAC)
51            list(APPEND srcs "emac_hal.c")
52        endif()
53    endif()
54
55    if(${target} STREQUAL "esp32s2")
56        list(APPEND srcs
57                    "dac_hal.c"
58                    "pcnt_hal.c"
59                    "spi_flash_hal_gpspi.c"
60                    "spi_slave_hd_hal.c"
61                    "systimer_hal.c"
62                    "touch_sensor_hal.c"
63                    "usb_hal.c"
64                    "usb_phy_hal.c"
65                    "xt_wdt_hal.c"
66                    "esp32s2/adc_hal.c"
67                    "esp32s2/brownout_hal.c"
68                    "esp32s2/cp_dma_hal.c"
69                    "esp32s2/touch_sensor_hal.c"
70                    "esp32s2/dac_hal.c"
71                    "esp32s2/interrupt_descriptor_table.c"
72                    "usbh_hal.c")
73    endif()
74
75    if(${target} STREQUAL "esp32s3")
76        list(APPEND srcs
77            "ds_hal.c"
78            "gdma_hal.c"
79            "lcd_hal.c"
80            "mcpwm_hal.c"
81            "pcnt_hal.c"
82            "spi_flash_hal_gpspi.c"
83            "spi_slave_hd_hal.c"
84            "systimer_hal.c"
85            "touch_sensor_hal.c"
86            "usb_hal.c"
87            "usb_phy_hal.c"
88            "xt_wdt_hal.c"
89            "esp32s3/brownout_hal.c"
90            "esp32s3/hmac_hal.c"
91            "esp32s3/interrupt_descriptor_table.c"
92            "esp32s3/touch_sensor_hal.c"
93            "esp32s3/rtc_cntl_hal.c"
94            "usbh_hal.c")
95    endif()
96
97    if(${target} STREQUAL "esp32c3")
98        list(APPEND srcs
99              "ds_hal.c"
100              "gdma_hal.c"
101              "spi_flash_hal_gpspi.c"
102              "spi_slave_hd_hal.c"
103              "systimer_hal.c"
104              "xt_wdt_hal.c"
105              "esp32c3/adc_hal.c"
106              "esp32c3/brownout_hal.c"
107              "esp32c3/hmac_hal.c"
108              "esp32c3/rtc_cntl_hal.c")
109    endif()
110
111    if(${target} STREQUAL "esp32h2")
112        list(APPEND srcs
113            "ds_hal.c"
114            "gdma_hal.c"
115            "spi_flash_hal_gpspi.c"
116            "spi_slave_hd_hal.c"
117            "systimer_hal.c"
118            "esp32h2/brownout_hal.c"
119            "esp32h2/hmac_hal.c"
120            "esp32h2/rtc_cntl_hal.c")
121    endif()
122endif()
123
124idf_component_register(SRCS ${srcs}
125                       INCLUDE_DIRS ${includes}
126                       PRIV_INCLUDE_DIRS ${priv_include}
127                       REQUIRES soc
128                       PRIV_REQUIRES ${target}
129                       LDFRAGMENTS linker.lf)
130
131if(CONFIG_HAL_DEFAULT_ASSERTION_LEVEL EQUAL 1)
132    target_link_libraries(${COMPONENT_LIB} INTERFACE "-u abort")
133elseif(CONFIG_HAL_DEFAULT_ASSERTION_LEVEL EQUAL 2)
134    target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __assert_func")
135endif()
136