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