1# SPDX-License-Identifier: Apache-2.0
2
3if(CONFIG_SOC_SERIES_ESP32C6)
4
5  zephyr_compile_options(-fstrict-volatile-bitfields)
6  zephyr_compile_definitions_ifndef(CONFIG_MCUBOOT CONFIG_APP_BUILD_USE_FLASH_SECTIONS)
7  zephyr_compile_definitions_ifndef(asm asm=__asm__)
8
9  zephyr_compile_definitions(CONFIG_IDF_TARGET_ARCH_RISCV)
10
11  if(CONFIG_MCUBOOT)
12    zephyr_compile_options(-fdump-rtl-expand)
13  endif()
14
15  zephyr_include_directories(
16    include
17    ../esp_shared/include
18    ../esp_shared/components/include
19    ../port/include
20    ../common/include
21
22    ../../components/efuse/include
23    ../../components/efuse/private_include
24    ../../components/efuse/${CONFIG_SOC_SERIES}/include
25    ../../components/efuse/${CONFIG_SOC_SERIES}/private_include
26
27    ../../components/esp_common/include
28
29    ../../components/esp_hw_support/dma
30    ../../components/esp_hw_support/include
31    ../../components/esp_hw_support/include/esp_private
32    ../../components/esp_hw_support/include/hal
33    ../../components/esp_hw_support/include/soc
34    ../../components/esp_hw_support/include/soc/${CONFIG_SOC_SERIES}
35    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}
36    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/private_include
37    ../../components/esp_hw_support/port/include
38    ../../components/esp_rom/${CONFIG_SOC_SERIES}
39    ../../components/esp_rom/${CONFIG_SOC_SERIES}/ld
40    ../../components/esp_rom/include/
41    ../../components/esp_rom/include/${CONFIG_SOC_SERIES}
42
43    ../../components/esp_system/include
44    ../../components/esp_system/include/esp_private
45    ../../components/esp_system/port/include
46    ../../components/esp_system/port/include/private/esp_private
47    ../../components/esp_system/port/include/private
48
49    ../../components/hal/${CONFIG_SOC_SERIES}/include
50    ../../components/hal/include
51    ../../components/hal/platform_port/include
52
53    ../../components/log/include
54
55    ../../components/soc/${CONFIG_SOC_SERIES}/include
56    ../../components/soc/${CONFIG_SOC_SERIES}/ld
57    ../../components/soc/include
58
59    ../../components/riscv/${CONFIG_SOC_SERIES}/include
60    ../../components/riscv/include
61    ../../components/riscv/include/esp_private
62    ../../components/riscv/include/xtensa
63
64    ../../components/esp_timer/include
65    ../../components/esp_timer/private_include
66
67    ../../components/driver/include
68    ../../components/driver/deprecated
69    ../../components/driver/gpio/include
70    ../../components/driver/uart/include
71    ../../components/driver/touch_sensor/include
72    ../../components/driver/touch_sensor/${CONFIG_SOC_SERIES}/include
73    ../../components/driver/spi/include
74
75    ../../components/spi_flash/include
76    ../../components/spi_flash/include/spi_flash
77
78    ../../components/esp_pm/include
79
80    ../../components/bootloader_support/include
81    ../../components/bootloader_support/private_include
82    ../../components/bootloader_support/bootloader_flash/include
83
84    ../../components/heap/include
85
86    ../../components/esp_mm/include
87
88    ../../components/esp_netif/include
89
90    ../../components/esp_coex/include
91    ../../components/esp_phy/include
92    ../../components/esp_phy/include/esp_private
93    ../../components/esp_phy/${CONFIG_SOC_SERIES}/include
94    ../../components/esp_wifi/include
95    ../../components/esp_event/include
96    ../../components/wpa_supplicant/esp_supplicant/src
97    ../../components/wpa_supplicant/esp_supplicant/include
98    ../../components/wpa_supplicant/include
99    ../../components/wpa_supplicant/include/esp_supplicant
100    ../../components/wpa_supplicant/port/include
101    ../../components/wpa_supplicant/src
102    ../../components/wpa_supplicant/src/crypto
103    ../../components/wpa_supplicant/src/utils
104    ../../components/wpa_supplicant/src/eap_peer
105    ../../components/mbedtls/port/include
106
107    ../port/include/boot
108  )
109
110  zephyr_link_libraries(
111    gcc
112    -T${CMAKE_CURRENT_SOURCE_DIR}/src/linker/${CONFIG_SOC_SERIES}.rom.alias.ld
113    -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.ld
114    -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.api.ld
115    -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.rvfp.ld
116    -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.newlib.ld
117    -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.version.ld
118    -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.wdt.ld
119    -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/soc/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.peripherals.ld
120    -T${CMAKE_CURRENT_SOURCE_DIR}/../../tools/esptool_py/flasher_stub/ld/rom_32c6.ld
121  )
122
123  zephyr_compile_definitions(ESP_PLATFORM)
124
125  zephyr_sources_ifdef(
126    CONFIG_ESP32_SPIM
127    ../../components/hal/spi_hal.c
128    ../../components/hal/spi_hal_iram.c
129    ../../components/soc/lldesc.c
130    ../../components/hal/gdma_hal.c
131    )
132
133  if(CONFIG_SOC_FLASH_ESP32 OR NOT CONFIG_BOOTLOADER_MCUBOOT)
134    zephyr_sources(
135    ../../components/esp_mm/esp_mmu_map.c
136    ../../components/esp_mm/port/${CONFIG_SOC_SERIES}/ext_mem_layout.c
137    ../../components/bootloader_support/src/flash_encrypt.c
138    ../../components/esp_hw_support/esp_gpio_reserve.c
139    ../../components/hal/cache_hal.c
140    ../../components/hal/mmu_hal.c
141    ../../components/hal/spi_flash_encrypt_hal_iram.c
142    ../../components/hal/spi_flash_hal.c
143    ../../components/hal/spi_flash_hal_iram.c
144    ../../components/hal/spi_flash_hal_gpspi.c
145    ../../components/spi_flash/esp_flash_api.c
146    ../../components/spi_flash/esp_flash_spi_init.c
147    ../../components/spi_flash/flash_mmap.c
148    ../../components/spi_flash/flash_ops.c
149    ../../components/spi_flash/memspi_host_driver.c
150    ../../components/spi_flash/spi_flash_chip_boya.c
151    ../../components/spi_flash/spi_flash_chip_drivers.c
152    ../../components/spi_flash/spi_flash_chip_gd.c
153    ../../components/spi_flash/spi_flash_chip_generic.c
154    ../../components/spi_flash/spi_flash_chip_issi.c
155    ../../components/spi_flash/spi_flash_chip_mxic.c
156    ../../components/spi_flash/spi_flash_chip_mxic_opi.c
157    ../../components/spi_flash/spi_flash_chip_th.c
158    ../../components/spi_flash/spi_flash_chip_winbond.c
159    ../../components/spi_flash/spi_flash_os_func_noos.c
160    ../../components/spi_flash/spi_flash_os_func_app.c
161    )
162  endif()
163
164  if(CONFIG_PM OR CONFIG_POWEROFF)
165  zephyr_sources(
166    ../../components/driver/gpio/gpio.c
167    ../../components/driver/gpio/rtc_io.c
168    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/pmu_sleep.c
169    ../../components/esp_hw_support/sleep_clock.c
170    ../../components/esp_hw_support/sleep_cpu.c
171    ../../components/esp_hw_support/sleep_cpu_asm.S
172    ../../components/esp_hw_support/sleep_gpio.c
173    ../../components/esp_hw_support/sleep_event.c
174    ../../components/esp_hw_support/sleep_console.c
175    ../../components/esp_hw_support/sleep_modem.c
176    ../../components/esp_hw_support/sleep_modes.c
177    ../../components/esp_hw_support/sleep_retention.c
178    ../../components/esp_hw_support/sleep_system_peripheral.c
179    ../../components/esp_pm/pm_impl.c
180    ../../components/hal/${CONFIG_SOC_SERIES}/pmu_hal.c
181    ../../components/hal/rtc_io_hal.c
182    )
183  endif()
184
185  zephyr_sources_ifdef(
186    CONFIG_DMA_ESP32
187    ../../components/soc/lldesc.c
188    ../../components/hal/gdma_hal.c
189    )
190
191  if (CONFIG_MCUBOOT)
192    zephyr_sources(
193        ../port/boot/esp_image_loader.c
194        )
195  endif()
196
197  if (CONFIG_MCUBOOT OR NOT CONFIG_BOOTLOADER_MCUBOOT)
198    zephyr_include_directories(
199      ../../components/esp_rom/${CONFIG_SOC_SERIES}
200      )
201
202    zephyr_sources(
203      ../../components/bootloader_support/src/bootloader_clock_init.c
204      ../../components/hal/mpu_hal.c
205      ../../components/bootloader_support/bootloader_flash/src/flash_qio_mode.c
206      ../common/console_init.c
207      ../common/soc_init.c
208      )
209  endif()
210
211  zephyr_sources(
212
213    ../../components/soc/${CONFIG_SOC_SERIES}/gpio_periph.c
214    ../../components/soc/${CONFIG_SOC_SERIES}/rtc_io_periph.c
215    ../../components/soc/${CONFIG_SOC_SERIES}/temperature_sensor_periph.c
216
217    ../../components/esp_hw_support/adc_share_hw_ctrl.c
218    ../../components/esp_hw_support/cpu.c
219    ../../components/esp_hw_support/clk_ctrl_os.c
220    ../../components/esp_hw_support/esp_clk.c
221    ../../components/esp_hw_support/mac_addr.c
222    ../../components/esp_hw_support/modem_clock.c
223    ../../components/esp_hw_support/periph_ctrl.c
224    ../../components/esp_hw_support/regi2c_ctrl.c
225    ../../components/esp_hw_support/sar_periph_ctrl_common.c
226    ../../components/esp_hw_support/sleep_modes.c
227    ../../components/esp_hw_support/sleep_retention.c
228    ../../components/esp_hw_support/port/esp_clk_tree_common.c
229    ../../components/esp_hw_support/port/regdma_link.c
230    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/esp_cpu_intr.c
231    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/esp_clk_tree.c
232    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/rtc_clk.c
233    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/rtc_clk_init.c
234    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/rtc_time.c
235    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/sar_periph_ctrl.c
236    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/systimer.c
237    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/pmu_init.c
238    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/pmu_param.c
239    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/pmu_sleep.c
240    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/ocode_init.c
241    ../../components/esp_hw_support/port/${CONFIG_SOC_SERIES}/cpu_region_protect.c
242    ../../components/esp_rom/patches/esp_rom_crc.c
243    ../../components/esp_rom/patches/esp_rom_sys.c
244    ../../components/esp_rom/patches/esp_rom_uart.c
245    ../../components/esp_rom/patches/esp_rom_spiflash.c
246    ../../components/esp_rom/patches/esp_rom_efuse.c
247    ../../components/esp_rom/patches/esp_rom_gpio.c
248    ../../components/esp_rom/patches/esp_rom_systimer.c
249    ../../components/esp_rom/patches/esp_rom_wdt.c
250    ../../components/esp_rom/patches/esp_rom_hp_regi2c_esp32c6.c
251
252    ../../components/esp_system/port/soc/${CONFIG_SOC_SERIES}/clk.c
253    ../../components/esp_system/port/soc/${CONFIG_SOC_SERIES}/system_internal.c
254    ../../components/esp_system/port/soc/${CONFIG_SOC_SERIES}/reset_reason.c
255    ../../components/esp_system/esp_err.c
256
257    ../../components/esp_timer/src/ets_timer_legacy.c
258    ../../components/esp_timer/src/esp_timer.c
259    ../../components/esp_timer/src/esp_timer_etm.c
260    ../../components/esp_timer/src/esp_timer_impl_common.c
261    ../../components/esp_timer/src/esp_timer_impl_systimer.c
262    ../../components/esp_timer/src/system_time.c
263
264    ../../components/hal/efuse_hal.c
265    ../../components/hal/systimer_hal.c
266    ../../components/hal/wdt_hal_iram.c
267    ../../components/hal/${CONFIG_SOC_SERIES}/clk_tree_hal.c
268    ../../components/hal/${CONFIG_SOC_SERIES}/efuse_hal.c
269    ../../components/hal/${CONFIG_SOC_SERIES}/modem_clock_hal.c
270    ../../components/hal/lp_timer_hal.c
271
272    ../../components/log/log_noos.c
273    ../../components/log/log.c
274
275    ../port/heap/heap_caps_zephyr.c
276    ../port/host_flash/cache_utils.c
277    ../../components/riscv/interrupt.c
278    ../port/bootloader/bootloader_flash.c
279
280    ../common/flash_init.c
281
282    src/stubs.c
283    src/soc_random.c
284    src/soc_init.c
285    src/soc_flash_init.c
286  )
287
288  zephyr_sources_ifdef(
289    CONFIG_I2C_ESP32
290    ../../components/hal/i2c_hal_iram.c
291    ../../components/hal/i2c_hal.c
292    )
293
294  zephyr_sources_ifdef(
295    CONFIG_COUNTER_TMR_ESP32
296    ../../components/hal/timer_hal.c
297    )
298
299  zephyr_sources_ifdef(
300    CONFIG_UART_ESP32
301    ../../components/hal/uart_hal.c
302    ../../components/hal/uart_hal_iram.c
303    )
304
305  zephyr_sources_ifdef(
306    CONFIG_PWM_LED_ESP32
307    ../../components/soc/${CONFIG_SOC_SERIES}/ledc_periph.c
308    ../../components/hal/ledc_hal_iram.c
309    ../../components/hal/ledc_hal.c
310    )
311
312  if (CONFIG_ADC_ESP32)
313    zephyr_include_directories(
314    ../../components/esp_adc/${CONFIG_SOC_SERIES}/include
315    ../../components/esp_adc/include
316    ../../components/esp_adc/interface
317    )
318
319    zephyr_sources(
320    ../../components/hal/adc_hal.c
321    ../../components/hal/adc_hal_common.c
322    ../../components/hal/adc_oneshot_hal.c
323    ../../components/hal/rtc_io_hal.c
324    ../../components/driver/gpio/rtc_io.c
325    ../../components/esp_adc/adc_cali.c
326    ../../components/esp_adc/adc_cali_curve_fitting.c
327    ../../components/esp_adc/${CONFIG_SOC_SERIES}/curve_fitting_coefficients.c
328    ../../components/soc/${CONFIG_SOC_SERIES}/adc_periph.c
329    ../../components/efuse/src/esp_efuse_api.c
330    ../../components/efuse/src/esp_efuse_utility.c
331    ../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
332    ../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
333    ../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
334    )
335  endif()
336
337  ## shared WIFI/BT resources
338  if (CONFIG_BT OR CONFIG_WIFI_ESP32)
339    zephyr_sources(
340      ../../components/esp_phy/src/phy_init.c
341      ../../components/esp_phy/src/lib_printf.c
342      ../../components/esp_phy/src/phy_common.c
343      ../../components/esp_phy/src/phy_override.c
344      )
345
346    zephyr_sources(
347      ../../components/efuse/src/esp_efuse_utility.c
348      ../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
349      ../../components/efuse/src/esp_efuse_api.c
350      ../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
351      ../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
352      )
353
354    if (CONFIG_ESP32_SW_COEXIST_ENABLE)
355      if (CONFIG_BUILD_ONLY_NO_BLOBS)
356        zephyr_sources(
357          ../port/coex/coex_stubs.c
358          )
359      endif()
360
361      zephyr_link_libraries(
362        coexist
363          -L${CMAKE_CURRENT_SOURCE_DIR}/../blobs/lib/${CONFIG_SOC_SERIES}
364        )
365    endif()
366
367    zephyr_link_libraries_ifndef(
368      CONFIG_BUILD_ONLY_NO_BLOBS
369      net80211
370      core
371      pp
372      phy
373      mesh
374      ## esp-idf wifi libs refer gcc libs symbols, so linked in libgcc
375      gcc
376        -L${CMAKE_CURRENT_SOURCE_DIR}/../blobs/lib/${CONFIG_SOC_SERIES}
377        -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.coexist.ld
378        -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.pp.ld
379        -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.phy.ld
380        -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/${CONFIG_SOC_SERIES}/ld/${CONFIG_SOC_SERIES}.rom.net80211.ld
381      )
382  endif()
383
384  ## BT definitions
385  if (CONFIG_BT)
386    zephyr_sources(src/bt/esp_bt_adapter.c)
387    zephyr_compile_definitions(CONFIG_BT_ENABLED)
388
389    zephyr_link_libraries(
390      ## ble
391      btbb
392        -L${CMAKE_CURRENT_SOURCE_DIR}/../blobs/lib/${CONFIG_SOC_SERIES}
393      )
394
395  endif()
396
397  ## WIFI definitions
398  if (CONFIG_WIFI_ESP32)
399
400    set(WPA_SUPPLICANT_COMPONENT_DIR "../../components/wpa_supplicant")
401    #TODO: Additional WPA supplicant feature like Enterprise mode etc. are yet to be supported.
402    set(WPA_SUPPLICANT_SRCS "../port/wifi/wpa_supplicant/os_xtensa.c"
403      "${WPA_SUPPLICANT_COMPONENT_DIR}/port/eloop.c"
404      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/ap_config.c"
405      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/ieee802_1x.c"
406      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/wpa_auth.c"
407      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/wpa_auth_ie.c"
408      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/pmksa_cache_auth.c"
409      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/sta_info.c"
410      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/ieee802_11.c"
411      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/ap/comeback_token.c"
412      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/common/sae.c"
413      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/common/dragonfly.c"
414      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/common/wpa_common.c"
415      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/utils/bitfield.c"
416      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-siv.c"
417      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha256-kdf.c"
418      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/ccmp.c"
419      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-gcm.c"
420      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/crypto_ops.c"
421      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/dh_group5.c"
422      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/dh_groups.c"
423      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/ms_funcs.c"
424      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha1-tlsprf.c"
425      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha256-tlsprf.c"
426      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha384-tlsprf.c"
427      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha256-prf.c"
428      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha1-prf.c"
429      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha384-prf.c"
430      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/md4-internal.c"
431      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha1-tprf.c"
432      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/eap_common/eap_wsc_common.c"
433      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/common/ieee802_11_common.c"
434      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/eap_peer/chap.c"
435      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/eap_peer/eap.c"
436      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/eap_peer/eap_common.c"
437      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/eap_peer/mschapv2.c"
438      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/rsn_supp/pmksa_cache.c"
439      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/rsn_supp/wpa.c"
440      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/rsn_supp/wpa_ie.c"
441      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/utils/common.c"
442      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/utils/ext_password.c"
443      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/utils/uuid.c"
444      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/utils/wpabuf.c"
445      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/utils/wpa_debug.c"
446      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/utils/json.c"
447      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/wps/wps.c"
448      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/wps/wps_attr_build.c"
449      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/wps/wps_attr_parse.c"
450      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/wps/wps_attr_process.c"
451      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/wps/wps_common.c"
452      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/wps/wps_dev_attr.c"
453      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/wps/wps_enrollee.c"
454      )
455
456    if(CONFIG_ESP32_WIFI_ENABLE_SAE_PK)
457      set(WPA_SUPPLICANT_SRCS ${WPA_SUPPLICANT_SRCS}
458        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/common/sae_pk.c"
459        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/common/bss.c"
460        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/common/scan.c"
461        "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_scan.c"
462        )
463    endif()
464
465    set(ESP_SUPPLICANT_SRCS "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_eap_client.c"
466      "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_wpa2_api_port.c"
467      "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_wpa_main.c"
468      "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_wpas_glue.c"
469      "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_common.c"
470      "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_wps.c"
471      "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_wpa3.c"
472      "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_owe.c"
473      )
474    if(CONFIG_ESP32_WIFI_SOFTAP_SUPPORT)
475        set(ESP_SUPPLICANT_SRCS ${ESP_SUPPLICANT_SRCS} "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/esp_hostap.c")
476    endif()
477
478    set(TLS_SRCS
479      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/asn1.c"
480      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/bignum.c"
481      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/pkcs1.c"
482      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/pkcs5.c"
483      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/pkcs8.c"
484      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/rsa.c"
485      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/tls_internal.c"
486      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/tlsv1_client.c"
487      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/tlsv1_client_read.c"
488      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/tlsv1_client_write.c"
489      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/tlsv1_common.c"
490      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/tlsv1_cred.c"
491      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/tlsv1_record.c"
492      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/tlsv1_client_ocsp.c"
493      "${WPA_SUPPLICANT_COMPONENT_DIR}/src/tls/x509v3.c"
494      )
495
496    if(CONFIG_ESP32_WIFI_MBEDTLS_CRYPTO)
497      set(CRYPTO_SRCS
498        "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/crypto/fastpbkdf2.c"
499        "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/crypto/crypto_mbedtls.c"
500        "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c"
501        "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/crypto/crypto_mbedtls-rsa.c"
502        "${WPA_SUPPLICANT_COMPONENT_DIR}/esp_supplicant/src/crypto/crypto_mbedtls-ec.c"
503         # Add internal RC4 as RC4 has been removed from mbedtls
504         "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/rc4.c"
505        )
506        if(NOT CONFIG_MBEDTLS_CIPHER_DES_ENABLED)
507          set(CRYPTO_SRCS ${CRYPTO_SRCS} "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/des-internal.c")
508        endif()
509        # Enabling this only for WiFi is probably not a good idea since MbedTLS
510        # uses generic crypto init/update functions for this. That causes
511        # binary size increment since all the other enabled module
512        # functions will also linked in. Even after not using direct MbedTLS APIs
513        # for these, these API are still faster since these all will be using
514        # AES APIs which is using hardware AES blocks.
515        if(NOT CONFIG_MBEDTLS_MAC_CMAC_ENABLED)
516            set(CRYPTO_SRCS ${CRYPTO_SRCS} "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-omac1.c")
517        endif()
518        if(NOT CONFIG_MBEDTLS_NIST_KW_C)
519            set(CRYPTO_SRCS ${CRYPTO_SRCS}
520            "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-wrap.c"
521            "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-unwrap.c")
522        endif()
523        if(NOT CONFIG_MBEDTLS_NIST_KW_C OR NOT CONFIG_MBEDTLS_CMAC_C OR NOT CONFIG_MBEDTLS_CCM_C)
524            set(CRYPTO_SRCS ${CRYPTO_SRCS} "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-ccm.c")
525        endif()
526    else()
527      set(CRYPTO_SRCS
528        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/rc4.c"
529        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-ctr.c"
530        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-cbc.c"
531        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-ccm.c"
532        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-internal-dec.c"
533        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-internal-enc.c"
534        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-internal.c"
535        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-omac1.c"
536        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-unwrap.c"
537        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/aes-wrap.c"
538        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/crypto_internal-cipher.c"
539        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/crypto_internal-modexp.c"
540        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/crypto_internal-rsa.c"
541        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/crypto_internal.c"
542        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/des-internal.c"
543        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/md4-internal.c"
544        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/md5-internal.c"
545        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/md5.c"
546        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha1-internal.c"
547        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha1-pbkdf2.c"
548        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha1.c"
549        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha256-internal.c"
550        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha256.c"
551        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha384-internal.c"
552        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha512-internal.c"
553        "${WPA_SUPPLICANT_COMPONENT_DIR}/src/crypto/sha256.c"
554        )
555    endif()
556
557    zephyr_sources_ifdef(
558      CONFIG_BUILD_ONLY_NO_BLOBS
559      ../port/wifi/wifi_stubs.c
560      ../port/phy/phy_stubs.c
561      )
562
563    zephyr_sources(
564      src/wifi/esp_wifi_adapter.c
565      src/coex/esp_coex_adapter.c
566      ../port/wifi/wifi_init.c
567      ${WPA_SUPPLICANT_SRCS}
568      ${ESP_SUPPLICANT_SRCS}
569      ${TLS_SRCS}
570      ${CRYPTO_SRCS}
571      )
572
573    zephyr_compile_definitions(
574      __ets__
575      ESP_SUPPLICANT
576      IEEE8021X_EAPOL
577      EAP_PEER_METHOD
578      EAP_MSCHAPv2
579      EAP_TTLS
580      EAP_TLS
581      EAP_PEAP
582      USE_WPA2_TASK
583      CONFIG_WPS
584      USE_WPS_TASK
585      CONFIG_ECC
586      CONFIG_IEEE80211W
587      CONFIG_SHA256
588      CONFIG_NO_RADIUS
589      CONFIG_FAST_PBKDF2
590      CONFIG_CRYPTO_INTERNAL
591      )
592
593    zephyr_compile_definitions(CONFIG_ESP_WIFI_ENABLED)
594    zephyr_compile_definitions(CONFIG_SOC_WIFI_SUPPORTED)
595    zephyr_compile_definitions_ifdef(CONFIG_ESP32_WIFI_MBEDTLS_CRYPTO CONFIG_CRYPTO_MBEDTLS)
596    zephyr_compile_definitions_ifdef(CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE CONFIG_WPA3_SAE)
597    zephyr_compile_definitions_ifdef(CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA CONFIG_OWE_STA)
598    zephyr_compile_definitions_ifdef(CONFIG_ESP32_WIFI_ENABLE_SAE_PK CONFIG_SAE_PK)
599    zephyr_compile_definitions_ifdef(CONFIG_ESP32_WIFI_SOFTAP_SAE_SUPPORT CONFIG_SAE)
600
601    zephyr_link_libraries(mbedTLS)
602
603  endif()
604
605  zephyr_link_libraries_ifdef(CONFIG_NEWLIB_LIBC c)
606
607endif()
608