1# SPDX-License-Identifier: Apache-2.0 2 3if(CONFIG_SOC_SERIES_ESP32S2) 4 5 zephyr_compile_options(-Wno-unused-variable) 6 7 zephyr_include_directories( 8 include 9 include/crypto 10 include/wifi 11 ../esp_shared/include 12 ../esp_shared/include/wifi 13 ../esp_shared/components/include 14 ../../components/hal/esp32s2/include 15 ../../components/hal/include 16 ../../components/hal/platform_port/include 17 ../../components/esp_hw_support/port/esp32s2 18 ../../components/esp_hw_support/port/esp32s2/private_include 19 ../../components/esp_hw_support/include/soc 20 ../../components/esp_hw_support/include 21 ../../components/esp_common/include 22 ../../components/esp_pm/include 23 ../../components/esp_rom/include 24 ../../components/esp_rom/esp32s2/ld 25 ../../components/esp_rom/include/esp32s2/rom 26 ../../components/esp32s2/include 27 ../../components/driver/include 28 ../../components/soc/esp32s2/include 29 ../../components/xtensa/include 30 ../../components/xtensa/esp32s2/include 31 ../../components/soc/include 32 ../../components/soc/include/soc 33 ../../components/driver/esp32s2/include 34 ../../components/esp_system/include 35 ../../components/esp_system/port/include 36 ../../components/esp_system/port/public_compat 37 ../../components/esp_wifi/esp32s2/include 38 ../../components/esp_wifi/include 39 ../../components/esp_phy/include 40 ../../components/esp_phy/include/esp32s2 41 ../../components/esp_phy/esp32s2/include 42 ../../components/esp_timer/include 43 ../../components/esp_timer/private_include 44 ../../components/esp_netif/include 45 ../../components/esp_event/include 46 ../../components/log/include 47 ../../components/wpa_supplicant/include 48 ../../components/wpa_supplicant/port/include 49 ../../components/wpa_supplicant/src 50 ../../components/wpa_supplicant/include/esp_supplicant 51 ../../components/wpa_supplicant/esp_supplicant/src 52 ../../components/wpa_supplicant/esp_supplicant/include 53 ../../components/wpa_supplicant/src/utils 54 ../../components/wpa_supplicant/src/eap_peer 55 ../../components/spi_flash/include 56 ../../components/spi_flash/include/spi_flash 57 ../../components/spi_flash/private_include 58 ../../components/bootloader_support/include 59 ../../components/efuse/include 60 ../../components/efuse/include/esp32s2 61 ../../components/efuse/esp32s2/include 62 ../../components/bootloader_support/include_bootloader 63 ../../components/heap/include 64 ../../components/mbedtls/port/include 65 ../../components/efuse/include 66 ../../components/efuse/private_include 67 ../../components/efuse/esp32s2/include 68 ../../components/efuse/esp32s2/private_include 69 ) 70 71 zephyr_link_libraries( 72 gcc 73 -T${CMAKE_CURRENT_SOURCE_DIR}/src/linker/esp32s2.rom.alias.ld 74 -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/esp32s2/ld/esp32s2.rom.ld 75 -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/esp32s2/ld/esp32s2.rom.api.ld 76 -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/esp32s2/ld/esp32s2.rom.libgcc.ld 77 -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-funcs.ld 78 -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-data.ld 79 -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_rom/esp32s2/ld/esp32s2.rom.spiflash.ld 80 -T${CMAKE_CURRENT_SOURCE_DIR}/../../components/soc/esp32s2/ld/esp32s2.peripherals.ld 81 ) 82 83 zephyr_compile_definitions(ESP_PLATFORM) 84 85 zephyr_link_libraries_ifdef( 86 CONFIG_HEAP_MEM_POOL_SIZE 87 gcc 88 "-Wl,--wrap=k_calloc" 89 "-Wl,--wrap=k_malloc" 90 ) 91 92 zephyr_sources_ifdef( 93 CONFIG_SOC_FLASH_ESP32 94 ../esp_shared/src/host_flash/cache_utils.c 95 ../../components/spi_flash/flash_mmap.c 96 ../../components/spi_flash/esp32s2/spi_flash_rom_patch.c 97 ../../components/spi_flash/flash_ops.c 98 ../../components/spi_flash/esp32s2/flash_ops_esp32s2.c 99 ) 100 101 zephyr_compile_definitions( 102 CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 103 CONFIG_SPI_FLASH_USE_LEGACY_IMPL 104 ) 105 106 zephyr_library_sources_ifdef(CONFIG_COUNTER_TMR_ESP32 ../../components/hal/timer_hal.c) 107 108 zephyr_sources_ifdef( 109 CONFIG_ESP32_SPIM 110 ../../components/hal/spi_hal.c 111 ../../components/hal/spi_hal_iram.c 112 ../../components/soc/lldesc.c 113 ../../components/soc/esp32s2/spi_periph.c 114 ) 115 116 zephyr_sources_ifdef( 117 CONFIG_ESP_SPIRAM 118 ../esp_shared/src/host_flash/cache_utils.c 119 ../../components/spi_flash/flash_ops.c 120 ../../components/esp_hw_support/port/esp32s2/spiram.c 121 ../../components/esp_hw_support/port/esp32s2/spiram_psram.c 122 ../../components/bootloader_support/src/bootloader_common.c 123 ) 124 125 zephyr_sources_ifdef( 126 CONFIG_I2C_ESP32 127 ../../components/hal/i2c_hal_iram.c 128 ../../components/hal/i2c_hal.c 129 ) 130 131 zephyr_sources_ifdef( 132 CONFIG_UART_ESP32 133 ../../components/hal/uart_hal.c 134 ../../components/hal/uart_hal_iram.c 135 ) 136 137 zephyr_sources_ifdef( 138 CONFIG_PWM_LED_ESP32 139 ../../components/soc/esp32s2/ledc_periph.c 140 ../../components/hal/ledc_hal_iram.c 141 ../../components/hal/ledc_hal.c 142 ) 143 144 zephyr_sources_ifdef( 145 CONFIG_PCNT_ESP32 146 ../../components/hal/pcnt_hal.c 147 ) 148 149 zephyr_sources_ifdef( 150 CONFIG_DAC_ESP32 151 ../../components/hal/dac_hal.c 152 ../../components/soc/esp32s2/dac_periph.c 153 ../esp_shared/components/driver/dac_common.c 154 ../esp_shared/components/driver/rtc_io_hal.c 155 ../esp_shared/components/driver/rtc_io.c 156 ) 157 158 zephyr_sources_ifdef( 159 CONFIG_ADC_ESP32 160 ../../components/hal/adc_hal.c 161 ../esp_shared/components/driver/adc_common.c 162 ../esp_shared/components/driver/rtc_io_hal.c 163 ../esp_shared/components/driver/rtc_io.c 164 src/esp_adc_cal/esp_adc_cal.c 165 ) 166 167 # FIXME: depending on Zephyr Kconfig options here is wrong 168 if(CONFIG_PM OR CONFIG_POWEROFF) 169 zephyr_sources( 170 ../esp_shared/components/driver/gpio.c 171 ../esp_shared/components/driver/rtc_io.c 172 ../esp_shared/components/esp_hw_support/sleep_modes.c 173 ../esp_shared/components/esp_pm/pm_impl.c 174 ../../components/esp_system/port/brownout.c 175 ../../components/hal/esp32s2/brownout_hal.c 176 ../../components/hal/esp32s2/touch_sensor_hal.c 177 ) 178 endif() 179 180 zephyr_sources_ifdef( 181 CONFIG_ESP32_TEMP 182 ../../components/driver/esp32s2/rtc_tempsensor.c 183 ) 184 185 zephyr_sources_ifdef( 186 CONFIG_INPUT_ESP32_TOUCH_SENSOR 187 ../esp_shared/components/driver/rtc_io_hal.c 188 ../esp_shared/components/driver/rtc_io.c 189 ../../components/soc/esp32s2/touch_sensor_periph.c 190 ../../components/hal/esp32s2/touch_sensor_hal.c 191 ../../components/hal/touch_sensor_hal.c 192 ) 193 194 if (CONFIG_MCUBOOT) 195 zephyr_include_directories( 196 ../../components/esp_rom/esp32s2 197 ../esp_shared/include/boot 198 ) 199 200 zephyr_sources( 201 ../../components/bootloader_support/src/esp32s2/bootloader_soc.c 202 ../../components/bootloader_support/src/bootloader_efuse_esp32s2.c 203 ../../components/bootloader_support/src/bootloader_flash.c 204 ../../components/bootloader_support/src/bootloader_flash_config_esp32s2.c 205 ../../components/bootloader_support/src/bootloader_mem.c 206 ../../components/bootloader_support/src/bootloader_clock_init.c 207 ../../components/bootloader_support/src/bootloader_console.c 208 ../../components/bootloader_support/src/bootloader_random.c 209 ../../components/bootloader_support/src/bootloader_random_esp32s2.c 210 ../../components/esp_hw_support/cpu_util.c 211 ../../components/esp_rom/patches/esp_rom_uart.c 212 ../../components/esp_rom/patches/esp_rom_sys.c 213 ../../components/hal/mpu_hal.c 214 ../esp_shared/src/boot/esp_loader.c 215 ../esp_shared/src/boot/bootloader_wdt.c 216 ../esp_shared/src/boot/bootloader_init_common.c 217 src/boot/bootloader_init.c 218 ) 219 endif() 220 221 zephyr_sources( 222 ../../components/esp_hw_support/regi2c_ctrl.c 223 ../../components/soc/esp32s2/adc_periph.c 224 ../../components/soc/esp32s2/gpio_periph.c 225 ../../components/soc/esp32s2/rtc_io_periph.c 226 ../../components/esp_hw_support/cpu_util.c 227 ../../components/esp_hw_support/esp_clk.c 228 ../../components/esp_hw_support/port/esp32s2/rtc_clk.c 229 ../../components/esp_hw_support/port/esp32s2/rtc_init.c 230 ../../components/esp_hw_support/port/esp32s2/rtc_time.c 231 ../../components/esp_hw_support/port/esp32s2/rtc_clk_init.c 232 ../../components/esp_hw_support/port/esp32s2/rtc_sleep.c 233 ../../components/esp_hw_support/mac_addr.c 234 ../../components/esp_hw_support/port/esp32s2/regi2c_ctrl.c 235 ../../components/esp_system/port/soc/esp32s2/clk.c 236 ../../components/esp_system/port/soc/esp32s2/reset_reason.c 237 ../../components/driver/periph_ctrl.c 238 ../../components/hal/wdt_hal_iram.c 239 ../../components/hal/interrupt_controller_hal.c 240 ../../components/hal/esp32s2/interrupt_descriptor_table.c 241 ../../components/esp_timer/src/ets_timer_legacy.c 242 ../../components/esp_timer/src/esp_timer_impl_lac.c 243 ../../components/esp_timer/src/esp_timer.c 244 ../../components/log/log_noos.c 245 ../../components/log/log.c 246 ../../components/efuse/esp32s2/esp_efuse_fields.c 247 ../../components/efuse/esp32s2/esp_efuse_table.c 248 ../../components/efuse/esp32s2/esp_efuse_rtc_table.c 249 ../../components/efuse/esp32s2/esp_efuse_utility.c 250 ../../components/efuse/esp32s2/esp_efuse_rtc_table.c 251 ../../components/efuse/src/esp_efuse_api.c 252 ../../components/efuse/src/esp_efuse_api_key_esp32xx.c 253 ../../components/efuse/src/esp_efuse_utility.c 254 ../esp_shared/src/common/esp_system_api.c 255 ../esp_shared/src/common/heap_caps.c 256 ) 257 258 ## WIFI definitions 259 if (CONFIG_WIFI_ESP32) 260 261 #TODO: Additional WPA supplicant feature like Enterprise mode etc. are yet to be supported. 262 set(WPA_SUPPLICANT_SRCS "src/wpa_supplicant/port/os_xtensa.c" 263 "../../components/wpa_supplicant/src/ap/ap_config.c" 264 "../../components/wpa_supplicant/src/ap/ieee802_1x.c" 265 "../../components/wpa_supplicant/src/ap/wpa_auth.c" 266 "../../components/wpa_supplicant/src/ap/wpa_auth_ie.c" 267 "../../components/wpa_supplicant/src/common/sae.c" 268 "../../components/wpa_supplicant/src/common/wpa_common.c" 269 "../../components/wpa_supplicant/src/crypto/aes-ctr.c" 270 "../../components/wpa_supplicant/src/crypto/aes-siv.c" 271 "../../components/wpa_supplicant/src/crypto/sha256-kdf.c" 272 "../../components/wpa_supplicant/src/crypto/sha256-prf.c" 273 "../../components/wpa_supplicant/src/crypto/aes-cbc.c" 274 "../../components/wpa_supplicant/src/crypto/aes-ccm.c" 275 "../../components/wpa_supplicant/src/crypto/aes-internal-dec.c" 276 "../../components/wpa_supplicant/src/crypto/aes-internal-enc.c" 277 "../../components/wpa_supplicant/src/crypto/aes-internal.c" 278 "../../components/wpa_supplicant/src/crypto/aes-omac1.c" 279 "../../components/wpa_supplicant/src/crypto/aes-unwrap.c" 280 "../../components/wpa_supplicant/src/crypto/aes-wrap.c" 281 "../../components/wpa_supplicant/src/crypto/aes-omac1.c" 282 "../../components/wpa_supplicant/src/crypto/sha256-tlsprf.c" 283 "../../components/wpa_supplicant/src/tls/bignum.c" 284 "../../components/wpa_supplicant/src/crypto/ccmp.c" 285 "../../components/wpa_supplicant/src/crypto/crypto_mbedtls-bignum.c" 286 "../../components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c" 287 "../../components/wpa_supplicant/src/crypto/crypto_ops.c" 288 "../../components/wpa_supplicant/src/crypto/crypto_internal-cipher.c" 289 "../../components/wpa_supplicant/src/crypto/crypto_internal-modexp.c" 290 "../../components/wpa_supplicant/src/crypto/crypto_internal-rsa.c" 291 "../../components/wpa_supplicant/src/crypto/crypto_internal.c" 292 "../../components/wpa_supplicant/src/crypto/des-internal.c" 293 "../../components/wpa_supplicant/src/crypto/dh_group5.c" 294 "../../components/wpa_supplicant/src/crypto/dh_groups.c" 295 "../../components/wpa_supplicant/src/crypto/md4-internal.c" 296 "../../components/wpa_supplicant/src/crypto/md5-internal.c" 297 "../../components/wpa_supplicant/src/crypto/md5.c" 298 "../../components/wpa_supplicant/src/crypto/ms_funcs.c" 299 "../../components/wpa_supplicant/src/crypto/rc4.c" 300 "../../components/wpa_supplicant/src/crypto/sha1-internal.c" 301 "../../components/wpa_supplicant/src/crypto/sha1-pbkdf2.c" 302 "../../components/wpa_supplicant/src/crypto/sha1-prf.c" 303 "../../components/wpa_supplicant/src/crypto/sha1.c" 304 "../../components/wpa_supplicant/src/crypto/sha256-internal.c" 305 "../../components/wpa_supplicant/src/crypto/sha256.c" 306 "../../components/wpa_supplicant/src/eap_peer/eap.c" 307 "../../components/wpa_supplicant/src/eap_peer/eap_common.c" 308 "../../components/wpa_supplicant/esp_supplicant/src/esp_hostap.c" 309 "../../components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c" 310 "../../components/wpa_supplicant/esp_supplicant/src/esp_wpas_glue.c" 311 "../../components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c" 312 "../../components/wpa_supplicant/src/rsn_supp/pmksa_cache.c" 313 "../../components/wpa_supplicant/src/rsn_supp/wpa.c" 314 "../../components/wpa_supplicant/src/rsn_supp/wpa_ie.c" 315 "../../components/wpa_supplicant/src/utils/common.c" 316 "../../components/wpa_supplicant/src/utils/ext_password.c" 317 "../../components/wpa_supplicant/src/utils/uuid.c" 318 "../../components/wpa_supplicant/src/utils/wpabuf.c" 319 "../../components/wpa_supplicant/src/utils/wpa_debug.c" 320 "../../components/wpa_supplicant/src/utils/json.c" 321 ) 322 323 zephyr_sources( 324 src/wifi/esp_wifi_adapter.c 325 ../../components/esp_phy/src/phy_init.c 326 ../../components/esp_phy/src/lib_printf.c 327 ${WPA_SUPPLICANT_SRCS} 328 ) 329 330 zephyr_compile_definitions( 331 __ets__ 332 ESP_SUPPLICANT 333 IEEE8021X_EAPOL 334 EAP_PEER_METHOD 335 EAP_MSCHAPv2 336 EAP_PEAP 337 EAP_TTLS 338 EAP_TLS 339 EAP_FAST 340 USE_WPA2_TASK 341 ESPRESSIF_USE 342 ESP32_WORKAROUND 343 CONFIG_ECC 344 CONFIG_IEEE80211W 345 CONFIG_WPA3_SAE 346 CONFIG_SHA256 347 CONFIG_DPP 348 CONFIG_WNM 349 ) 350 351 zephyr_link_libraries( 352 net80211 353 core 354 pp 355 coexist 356 phy 357 mbedTLS 358 ## esp-idf wifi libs refer gcc libs symbols, so linked in libgcc 359 gcc 360 -L${CMAKE_CURRENT_SOURCE_DIR}/../blobs/lib/esp32s2 361 ) 362 363 endif() ## CONFIG_WIFI_ESP32 364 365 zephyr_link_libraries_ifdef(CONFIG_NEWLIB_LIBC c) 366 367endif() 368