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