Giter VIP home page Giter VIP logo

hal_espressif's Introduction

Espressif IoT Development Framework

ESP-IDF is the development framework for Espressif SoCs supported on Windows, Linux and macOS.

ESP-IDF Release and SoC Compatibility

The following table shows ESP-IDF support of Espressif SoCs where alt text and alt text denote preview status and support, respectively. In preview status the build is not yet enabled and some crucial parts could be missing (like documentation, datasheet). Please use an ESP-IDF release where the desired SoC is already supported.

Chip v3.3 v4.0 v4.1 v4.2 v4.3 v4.4
ESP32 alt text alt text alt text alt text alt text alt text
ESP32-S2 alt text alt text alt text
ESP32-C3 alt text alt text
ESP32-S3 alt text alt text Announcement
ESP32-H2 alt text Announcement

Espressif SoCs released before 2016 (ESP8266 and ESP8285) are supported by RTOS SDK instead.

Developing With ESP-IDF

Setting Up ESP-IDF

See https://idf.espressif.com/ for links to detailed instructions on how to set up the ESP-IDF depending on chip you use.

Note: Each SoC series and each ESP-IDF release has its own documentation. Please see Section Versions on how to find documentation and how to checkout specific release of ESP-IDF.

Non-GitHub forks

ESP-IDF uses relative locations as its submodules URLs (.gitmodules). So they link to GitHub. If ESP-IDF is forked to a Git repository which is not on GitHub, you will need to run the script tools/set-submodules-to-github.sh after git clone. The script sets absolute URLs for all submodules, allowing git submodule update --init --recursive to complete. If cloning ESP-IDF from GitHub, this step is not needed.

Finding a Project

As well as the esp-idf-template project mentioned in Getting Started, ESP-IDF comes with some example projects in the examples directory.

Once you've found the project you want to work with, change to its directory and you can configure and build it.

To start your own project based on an example, copy the example project directory outside of the ESP-IDF directory.

Quick Reference

See the Getting Started guide links above for a detailed setup guide. This is a quick reference for common commands when working with ESP-IDF projects:

Setup Build Environment

(See the Getting Started guide listed above for a full list of required steps with more details.)

  • Install host build dependencies mentioned in the Getting Started guide.
  • Run the install script to set up the build environment. The options include install.bat or install.ps1 for Windows, and install.sh or install.fish for Unix shells.
  • Run the export script on Windows (export.bat) or source it on Unix (source export.sh) in every shell environment before using ESP-IDF.

Configuring the Project

  • idf.py set-target <chip_name> sets the target of the project to <chip_name>. Run idf.py set-target without any arguments to see a list of supported targets.
  • idf.py menuconfig opens a text-based configuration menu where you can configure the project.

Compiling the Project

idf.py build

... will compile app, bootloader and generate a partition table based on the config.

Flashing the Project

When the build finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this automatically by running:

idf.py -p PORT flash

Replace PORT with the name of your serial port (like COM3 on Windows, /dev/ttyUSB0 on Linux, or /dev/cu.usbserial-X on MacOS. If the -p option is left out, idf.py flash will try to flash the first available serial port.

This will flash the entire project (app, bootloader and partition table) to a new chip. The settings for serial port flashing can be configured with idf.py menuconfig.

You don't need to run idf.py build before running idf.py flash, idf.py flash will automatically rebuild anything which needs it.

Viewing Serial Output

The idf.py monitor target uses the idf_monitor tool to display serial output from Espressif SoCs. idf_monitor also has a range of features to decode crash output and interact with the device. Check the documentation page for details.

Exit the monitor by typing Ctrl-].

To build, flash and monitor output in one pass, you can run:

idf.py flash monitor

Compiling & Flashing Only the App

After the initial flash, you may just want to build and flash just your app, not the bootloader and partition table:

  • idf.py app - build just the app.
  • idf.py app-flash - flash just the app.

idf.py app-flash will automatically rebuild the app if any source files have changed.

(In normal development there's no downside to reflashing the bootloader and partition table each time, if they haven't changed.)

Erasing Flash

The idf.py flash target does not erase the entire flash contents. However it is sometimes useful to set the device back to a totally erased state, particularly when making partition table changes or OTA app updates. To erase the entire flash, run idf.py erase-flash.

This can be combined with other targets, ie idf.py -p PORT erase-flash flash will erase everything and then re-flash the new app, bootloader and partition table.

Resources

hal_espressif's People

Contributors

0xjakob avatar antmak avatar bluemoodbhd avatar costaud avatar david-cermak avatar dazza0 avatar dobairoland avatar esp-marius avatar ginkgm avatar heyinling avatar hfudev avatar icarus113 avatar igrr avatar isl2017 avatar jack0c avatar konstantinkondrashov avatar krzychb avatar liuzfesp avatar mahavirj avatar projectgus avatar renzbagaporo avatar spritetm avatar suda-morris avatar sylvioalves avatar tianhaoesp avatar timxia avatar weijian-espressif avatar wmy-espressif avatar wujiangang avatar yulong-espressif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hal_espressif's Issues

[ESP32] XTAL hardcoded to 40MHz.

Environment

  • Development Kit: [ESP32-SpartanEdgeAcceleratorBoard]
  • Kit version: [v1]
  • Module or chip used: [ESP32-]
  • IDF version (run git describe --tags to find it): west espressif install default proably zephyr head (git describe --tags does not work and there is no west espressif info to get any information`).
  • Build System: [CMake]
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it): (crosstool-NG esp-2020r3) 8.4.0.
  • Operating System: [FreeBSD]
  • Using an IDE?: [No]
  • Power Supply: [USB]

Problem Description

XTAL frequency seems to be hardcoded to 40MHz instead AUTO. On this SEA board that I want to add to Zephyr XTAL of 26MHz needs to be used because Serial Console output is garbaged as described in [1]. How do I change this XTAL setting from Zephyr perspective? Can we set default to AUTO? Upstream esp-idf seems to have this problem solved already?

Expected Behavior

  • Serial Console output is garbaged.
  • XTAL Configuration can be set to AUTO or changed from the Zephyr application standpoint.

Actual Behavior

Only bootloader part serial console output is readable. Then output is garbaged.

Steps to reproduce

  1. Build Zephyr Hello World example.
  2. See no expected output is produced but garbage.

Code to reproduce this issue

Zephyr Hello World example.

Debug Logs

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:7752
load:0x40078000,len:13212
load:0x40080400,len:4568
entry 0x400806f4
W (65) rtc_clk_init: Possibly invalid CONFIG_ESP32_XTAL_FREQ setting (40MHz). Detected 26 MHz.
<EE><EE>^B<EC><EC><8C>ln<8C>b^\<E0>lb<8C><F2>nn<9E>^^l<90>l<80><92>b<8C>^P<E2>^B<8C><8C>l<9C><8E>

Other items if possible

I have also opened a discussion for this issue at zephyrproject-rtos/zephyr#36827.

[1] https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#step-10-monitor

hal_espressif expects ZEPHYR_BASE environment variable to be set

ESP32 targets do not build properly when the ZEPHYR_BASE environment variable is not set (i.e. when the Zephyr CMake package from the registry is used to find the Zephyr path).

-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/devel/Dev/zephyrproject/zephyr/tests/kernel/threads/thread_apis/build/esp-idf/build/sdkconfig
Traceback (most recent call last):
  File "/home/devel/Dev/zephyrproject/modules/hal/espressif/tools/kconfig_new/confgen.py", line 42, in <module>
    sys.path.insert(0, os.path.join(os.environ['ZEPHYR_BASE'], "scripts", "kconfig"))
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'ZEPHYR_BASE'
CMake Error at /home/devel/Dev/zephyrproject/modules/hal/espressif/tools/cmake/kconfig.cmake:228 (message):
  Failed to run confgen.py
  (/usr/bin/python3.8;/home/devel/Dev/zephyrproject/modules/hal/espressif/tools/kconfig_new/confgen.py;--kconfig;/home/devel/Dev/zephyrproject/modules/hal/espressif/Kconfig;--sdkconfig-rename;/home/devel/Dev/zephyrproject/modules/hal/espressif/sdkconfig.rename;--config;/home/devel/Dev/zephyrproject/zephyr/tests/kernel/threads/thread_apis/build/esp-idf/build/sdkconfig;--env-file;/home/devel/Dev/zephyrproject/zephyr/tests/kernel/threads/thread_apis/build/esp-idf/build/bootloader/config.env).
  Error 1
Call Stack (most recent call first):
  /home/devel/Dev/zephyrproject/modules/hal/espressif/tools/cmake/build.cmake:451 (__kconfig_generate_config)
  /home/devel/Dev/zephyrproject/modules/hal/espressif/tools/cmake/project.cmake:396 (idf_build_process)
  CMakeLists.txt:41 (project)

The ZEPHYR_BASE should be sourced from the ZEPHYR_BASE CMake variable as done here:
https://github.com/zephyrproject-rtos/zephyr/blob/70a1827fc1cbe65f5a7b8217f8d6259680d3974f/cmake/modules/kconfig.cmake#L156-L157

Missing `mcuboot_assert_handler` function

Problem Description

mcuboot_assert_handler function is missing even though MCUBOOT_HAVE_ASSERT_H in mcuboot_config.h is defined to 1.

Expected Behavior

Bootloader should compile when using assert() function

Actual Behavior

Bootloader wouldn't compile due to missing mcuboot_assert_handler function

Steps to reproduce

Build MCUBoot with BOOT_SWAP_USING_MOVE option enabled.

Solution

Solution is to add mcuboot_assert_handler function to zephyr/esp_shared/src/boot/esp_loader.c or some better location.

void mcuboot_assert_handler(const char *file, int line, const char *func)
{
    ets_printf("assertion failed: file \"%s\", line %d, func: %s\n", file, line, func);
    abort();
}

pyserial dependency needs to be installed

This is specific to the west integration and somewhat related to zephyrproject-rtos/zephyr#56215.

The Espressif blob requires pyserial to be installed. However, it will only get installed if a user uses requirements-run-test.txt (not common) or gets ALL dependencies using requirements.txt per the Getting Started Guide. However, since pyserial isn't included in requirements-base.txt, anyone trying to maintain a lean build environment (like CI) will run into a dependency issue.

I'm not familiar with out west blobs work but is there a way to request additional dependencies?

samples/net/wifi does not build on saola

I have udpated with the last version of SDK , but sambles/net/wifi does not compile, hello_word works good on saola

INSTRUCTIONS

(v311zep) PS C:\pyenv\zp\zephyr> west build -b esp32s2_saola samples/net/wifi
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/pyenv/zp/zephyr/samples/net/wifi
-- CMake version: 3.26.3
-- Found Python3: C:/pyenv/v311zep/Scripts/python.exe (found suitable exact version "3.11.3") found components: Interpreter
-- Cache files will be written to: C:/pyenv/zp/zephyr/.cache
-- Zephyr version: 3.3.99 (C:/pyenv/zp/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: esp32s2_saola
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.0 (C:/pyenv/zephyr-sdk-0.16.0)
-- Found toolchain: zephyr 0.16.0 (C:/pyenv/zephyr-sdk-0.16.0)
-- Found Dtc: C:/ProgramData/chocolatey/bin/dtc.exe (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: C:/pyenv/zp/zephyr/boards/xtensa/esp32s2_saola/esp32s2_saola.dts
-- Found devicetree overlay: C:/pyenv/zp/zephyr/samples/net/wifi/boards/esp32s2_saola.overlay
-- Generated zephyr.dts: C:/pyenv/zp/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/pyenv/zp/zephyr/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/pyenv/zp/zephyr/build/zephyr/dts.cmake
Parsing C:/pyenv/zp/zephyr/Kconfig
Loaded configuration 'C:/pyenv/zp/zephyr/boards/xtensa/esp32s2_saola/esp32s2_saola_defconfig'
Merged configuration 'C:/pyenv/zp/zephyr/samples/net/wifi/prj.conf'
Merged configuration 'C:/pyenv/zp/zephyr/samples/net/wifi/boards/esp32s2_saola.conf'
Configuration saved to 'C:/pyenv/zp/zephyr/build/zephyr/.config'
Kconfig header saved to 'C:/pyenv/zp/zephyr/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/pyenv/zephyr-sdk-0.16.0/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/pyenv/zephyr-sdk-0.16.0/xtensa-espressif_esp32s2_zephyr-elf/bin/xtensa-espressif_esp32s2_zephyr-elf-gcc.exe
CMake Warning at C:/pyenv/zp/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: lib__libc__common

Excluding target from build.

CMake Warning at C:/pyenv/zp/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: drivers__ethernet

Excluding target from build.

-- Configuring done (27.8s)
-- Generating done (0.6s)
-- Build files have been written to: C:/pyenv/zp/zephyr/build
�[92m-- west build: building application
[15/404] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (C:/pyenv/zp/zephyr), build: zephyr-v3.3.0-3089-ga01dc33ef1a2
[108/404] Building C object zephyr/CMakeFiles/zephyr.dir/C_/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c.obj
FAILED: zephyr/CMakeFiles/zephyr.dir/C_/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c.obj
C:\pyenv\zephyr-sdk-0.16.0\xtensa-espressif_esp32s2_zephyr-elf\bin\xtensa-espressif_esp32s2_zephyr-elf-gcc.exe -DCONFIG_DPP -DCONFIG_ECC -DCONFIG_IEEE80211W -DCONFIG_SHA256 -DCONFIG_SPI_FLASH_ROM_DRIVER_PATCH -DCONFIG_SPI_FLASH_USE_LEGACY_IMPL -DCONFIG_WNM -DCONFIG_WPA3_SAE -DEAP_FAST -DEAP_MSCHAPv2 -DEAP_PEAP -DEAP_PEER_METHOD -DEAP_TLS -DEAP_TTLS -DESP32_WORKAROUND -DESPRESSIF_USE -DESP_PLATFORM -DESP_SUPPLICANT -DIEEE8021X_EAPOL -DKERNEL -DMBEDTLS_CONFIG_FILE="config-tls-generic.h" -DUSE_WPA2_TASK -D__ZEPHYR__=1 -D__ets__ -IC:/pyenv/zp/zephyr/kernel/include -IC:/pyenv/zp/zephyr/arch/xtensa/include -IC:/pyenv/zp/zephyr/include -IC:/pyenv/zp/zephyr/build/zephyr/include/generated -IC:/pyenv/zp/zephyr/soc/xtensa/esp32s2 -IC:/pyenv/zp/zephyr/soc/xtensa/esp32s2/include -IC:/pyenv/zp/zephyr/lib/posix/getopt/. -IC:/pyenv/zp/zephyr/subsys/net/l2 -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/include/crypto -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/include/wifi -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../esp_shared/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../esp_shared/include/wifi -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../esp_shared/components/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/hal/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/hal/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/hal/platform_port/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_hw_support/port/esp32s2 -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_hw_support/port/esp32s2/private_include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_hw_support/include/soc -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_hw_support/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_common/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_pm/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_rom/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_rom/esp32s2/ld -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_rom/include/esp32s2/rom -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/driver/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/soc/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/xtensa/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/xtensa/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/soc/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/soc/include/soc -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/driver/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_system/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_system/port/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_system/port/public_compat -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_wifi/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_wifi/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_phy/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_phy/include/esp32s2 -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_phy/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_timer/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_timer/private_include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_netif/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/esp_event/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/log/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/port/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/src -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/include/esp_supplicant -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/esp_supplicant/src -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/esp_supplicant/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/src/utils -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/wpa_supplicant/src/eap_peer -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/spi_flash/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/spi_flash/include/spi_flash -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/spi_flash/private_include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/bootloader_support/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/efuse/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/efuse/include/esp32s2 -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/efuse/esp32s2/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/bootloader_support/include_bootloader -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/heap/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/mbedtls/port/include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/efuse/private_include -IC:/pyenv/zp/modules/hal/espressif/zephyr/esp32s2/../../components/efuse/esp32s2/private_include -IC:/pyenv/zp/modules/crypto/mbedtls/include -IC:/pyenv/zp/modules/crypto/mbedtls/library -IC:/pyenv/zp/zephyr/modules/mbedtls/configs -IC:/pyenv/zp/zephyr/modules/mbedtls/include -isystem C:/pyenv/zp/zephyr/lib/libc/minimal/include -fno-strict-aliasing -Os -imacros C:/pyenv/zp/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always --sysroot=C:/pyenv/zephyr-sdk-0.16.0/xtensa-espressif_esp32s2_zephyr-elf/xtensa-espressif_esp32s2_zephyr-elf -imacros C:/pyenv/zp/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/pyenv/zp/zephyr/samples/net/wifi=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/pyenv/zp/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/pyenv/zp=WEST_TOPDIR -ffunction-sections -fdata-sections -mlongcalls -D_POSIX_THREADS -Wno-unused-variable -std=c99 -MD -MT zephyr/CMakeFiles/zephyr.dir/C_/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c.obj -MF zephyr\CMakeFiles\zephyr.dir\C_\pyenv\zp\modules\hal\espressif\components\esp_phy\src\phy_init.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/C_/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c.obj -c C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c
In file included from c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:19,
from c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\rtc.h:19,
from C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:13:
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c: In function 'esp_wifi_bt_power_domain_on':
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:27: error: 'SYSCON_WIFI_RST_EN_REG' undeclared (first use in this function)
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:71: note: in definition of macro 'TRY_STATIC_ASSERT'
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:57: note: in expansion of macro 'IS_DPORT_REG'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:216:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
216 | ASSERT_IF_DPORT_REG((reg), SET_PERI_REG_MASK);
| ^~~~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:27: note: each undeclared identifier is reported only once for each function it appears in
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:71: note: in definition of macro 'TRY_STATIC_ASSERT'
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:57: note: in expansion of macro 'IS_DPORT_REG'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:216:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
216 | ASSERT_IF_DPORT_REG((reg), SET_PERI_REG_MASK);
| ^~~~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: first argument to '__builtin_choose_expr' not a constant
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:216:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
216 | ASSERT_IF_DPORT_REG((reg), SET_PERI_REG_MASK);
| ^~~~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: expression in static assertion is not an integer
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:216:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
216 | ASSERT_IF_DPORT_REG((reg), SET_PERI_REG_MASK);
| ^~~~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: first argument to '__builtin_choose_expr' not a constant
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:204:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
204 | ASSERT_IF_DPORT_REG((addr), WRITE_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:217:13: note: in expansion of macro 'WRITE_PERI_REG'
217 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask)));
| ^~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: expression in static assertion is not an integer
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:204:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
204 | ASSERT_IF_DPORT_REG((addr), WRITE_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:217:13: note: in expansion of macro 'WRITE_PERI_REG'
217 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask)));
| ^~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: first argument to '__builtin_choose_expr' not a constant
23 | _Static_assert(__builtin_choose_expr(_builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:205:76: note: in definition of macro 'WRITE_PERI_REG'
205 | (*((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);
| ^~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:198:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
198 | ASSERT_IF_DPORT_REG((addr), READ_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:217:36: note: in expansion of macro 'READ_PERI_REG'
217 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask)));
| ^~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: expression in static assertion is not an integer
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:205:76: note: in definition of macro 'WRITE_PERI_REG'
205 | (
((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);
| ^~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:198:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
198 | ASSERT_IF_DPORT_REG((addr), READ_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:217:36: note: in expansion of macro 'READ_PERI_REG'
217 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask)));
| ^~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:51: error: 'SYSTEM_BB_RST' undeclared (first use in this function)
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:205:76: note: in definition of macro 'WRITE_PERI_REG'
205 | (
((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);
| ^~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:67: error: 'SYSTEM_FE_RST' undeclared (first use in this function)
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:205:76: note: in definition of macro 'WRITE_PERI_REG'
205 | (
((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);
| ^~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:300:9: note: in expansion of macro 'SET_PERI_REG_MASK'
300 | SET_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: first argument to '__builtin_choose_expr' not a constant
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:210:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
210 | ASSERT_IF_DPORT_REG((reg), CLEAR_PERI_REG_MASK);
| ^~~~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:301:9: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
301 | CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: expression in static assertion is not an integer
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:210:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
210 | ASSERT_IF_DPORT_REG((reg), CLEAR_PERI_REG_MASK);
| ^~~~~~~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:301:9: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
301 | CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: first argument to '__builtin_choose_expr' not a constant
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:204:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
204 | ASSERT_IF_DPORT_REG((addr), WRITE_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:211:13: note: in expansion of macro 'WRITE_PERI_REG'
211 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&((mask))));
| ^~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:301:9: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
301 | CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: expression in static assertion is not an integer
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:204:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
204 | ASSERT_IF_DPORT_REG((addr), WRITE_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:211:13: note: in expansion of macro 'WRITE_PERI_REG'
211 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(
(mask))));
| ^~~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:301:9: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
301 | CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: first argument to '__builtin_choose_expr' not a constant
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:205:76: note: in definition of macro 'WRITE_PERI_REG'
205 | (
((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);
| ^~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
125 | #define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(r), (Cannot use OP for DPORT registers use DPORT##OP));
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:198:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
198 | ASSERT_IF_DPORT_REG((addr), READ_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:211:36: note: in expansion of macro 'READ_PERI_REG'
211 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~(mask))));
| ^~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:301:9: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
301 | CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\esp_common\include\esp_assert.h:23:28: error: expression in static assertion is not an integer
23 | _Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG);
| ^~~~~~~~~~~~~~~~~~~~~
205 | (
((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val);
| ^~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:125:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
| ^~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:198:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
198 | ASSERT_IF_DPORT_REG((addr), READ_PERI_REG);
| ^~~~~~~~~~~~~~~~~~~
c:\pyenv\zp\modules\hal\espressif\components\soc\esp32s2\include\soc\soc.h:211:36: note: in expansion of macro 'READ_PERI_REG'
211 | WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~(mask))));
| ^~~~~~~~~~~~~
C:/pyenv/zp/modules/hal/espressif/components/esp_phy/src/phy_init.c:301:9: note: in expansion of macro 'CLEAR_PERI_REG_MASK'
301 | CLEAR_PERI_REG_MASK(SYSCON_WIFI_RST_EN_REG, SYSTEM_BB_RST | SYSTEM_FE_RST);
| ^~~~~~~~~~~~~~~~~~~
[110/404] Performing configure step for 'EspIdfBootloader'
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.40.0.windows.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/pyenv/zephyr-sdk-0.16.0/xtensa-espressif_esp32s2_zephyr-elf/bin/xtensa-espressif_esp32s2_zephyr-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/pyenv/zephyr-sdk-0.16.0/xtensa-espressif_esp32s2_zephyr-elf/bin/xtensa-espressif_esp32s2_zephyr-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/pyenv/zephyr-sdk-0.16.0/xtensa-espressif_esp32s2_zephyr-elf/bin/xtensa-espressif_esp32s2_zephyr-elf-gcc.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32s2
-- Project sdkconfig file C:/pyenv/zp/zephyr/build/esp-idf/build/sdkconfig
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/soc/esp32s2/ld/esp32s2.peripherals.ld
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/esp_rom/esp32s2/ld/esp32s2.rom.ld
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/esp_rom/esp32s2/ld/esp32s2.rom.api.ld
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/esp_rom/esp32s2/ld/esp32s2.rom.libgcc.ld
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-funcs.ld
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/esp_rom/esp32s2/ld/esp32s2.rom.spiflash.ld
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld
-- Adding linker script C:/pyenv/zp/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32s2/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32s2 esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: C:/pyenv/zp/modules/hal/espressif/components/bootloader C:/pyenv/zp/modules/hal/espressif/components/bootloader_support C:/pyenv/zp/modules/hal/espressif/components/efuse C:/pyenv/zp/modules/hal/espressif/components/esp32s2 C:/pyenv/zp/modules/hal/espressif/components/esp_common C:/pyenv/zp/modules/hal/espressif/components/esp_hw_support C:/pyenv/zp/modules/hal/espressif/components/esp_rom C:/pyenv/zp/modules/hal/espressif/components/esp_system C:/pyenv/zp/modules/hal/espressif/components/esptool_py C:/pyenv/zp/modules/hal/espressif/components/freertos C:/pyenv/zp/modules/hal/espressif/components/hal C:/pyenv/zp/modules/hal/espressif/components/log C:/pyenv/zp/modules/hal/espressif/components/bootloader/subproject/main C:/pyenv/zp/modules/hal/espressif/components/bootloader/subproject/components/micro-ecc C:/pyenv/zp/modules/hal/espressif/components/newlib C:/pyenv/zp/modules/hal/espressif/components/partition_table C:/pyenv/zp/modules/hal/espressif/components/soc C:/pyenv/zp/modules/hal/espressif/components/spi_flash C:/pyenv/zp/modules/hal/espressif/components/xtensa
-- Configuring done (7.2s)
-- Generating done (0.3s)
-- Build files have been written to: C:/pyenv/zp/zephyr/build/esp-idf/build/bootloader
[117/404] Building C object zephyr/CMakeFiles/zephyr.dir/C
/pyenv/zp/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\pyenv\zp\zephyr\build'
(v311zep) PS C:\pyenv\zp\zephyr> west build -b esp32s2_saola samples/hello_world
ERROR: Build directory "C:\pyenv\zp\zephyr\build" is for application "C:\pyenv\zp\zephyr\samples\net\wifi", but source directory "C:\pyenv\zp\zephyr\samples\hello_world" was specified; please clean it, use --pristine, or use --build-dir to set another build directory
FATAL ERROR: refusing to proceed without --force due to above error

----------------------------- Delete above -----------------------------
I am running WIndows 10 updated with Power shell

cannot use POWEROFF and ADC at once

Hello,

Environment

  • Development Kit: none
  • Kit version (for WroverKit/PicoKit/DevKitC): v3
  • Module or chip used: ESP32
  • IDF version (run git describe --tags to find it): ca3be15
  • Build System: zephyr west
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it):
    // 1.22.0-80-g6c4433a
  • Operating System: Linux
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

during linkage of my project I noticed the following error message:

/opt/zephyr-sdk-0.16.3/xtensa-espressif_esp32_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32_zephyr-elf/bin/ld.bfd: zephyr/libzephyr.a(rtc_io_hal.c.obj): in function `rtcio_hal_set_direction':
/home/mark/embedded_dev/modules/hal/espressif/zephyr/esp_shared/components/driver/rtc_io_hal.c:23: multiple definition of `rtcio_hal_set_direction'; zephyr/libzephyr.a(rtc_io_hal.c.obj):/home/mark/embedded_dev/modules/hal/espressif/components/hal/rtc_io_hal.c:23: first defined here
/opt/zephyr-sdk-0.16.3/xtensa-espressif_esp32_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32_zephyr-elf/bin/ld.bfd: zephyr/libzephyr.a(rtc_io_hal.c.obj): in function `rtcio_hal_isolate':
/home/mark/embedded_dev/modules/hal/espressif/zephyr/esp_shared/components/driver/rtc_io_hal.c:61: multiple definition of `rtcio_hal_isolate'; zephyr/libzephyr.a(rtc_io_hal.c.obj):/home/mark/embedded_dev/modules/hal/espressif/components/hal/rtc_io_hal.c:61: first defined here
/opt/zephyr-sdk-0.16.3/xtensa-espressif_esp32_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32_zephyr-elf/bin/ld.bfd: zephyr/libzephyr.a(rtc_io_hal.c.obj): in function `rtcio_hal_set_direction_in_sleep':
/home/mark/embedded_dev/modules/hal/espressif/zephyr/esp_shared/components/driver/rtc_io_hal.c:70: multiple definition of `rtcio_hal_set_direction_in_sleep'; zephyr/libzephyr.a(rtc_io_hal.c.obj):/home/mark/embedded_dev/modules/hal/espressif/components/hal/rtc_io_hal.c:70: first defined here
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

It can be boiled down to a problem where two versions of rtc_io_hal.c get added if both CONFIG_POWEROFF and CONFIG_ADC are enabled, namely:

  • zephyr/esp_shared/components/driver/rtc_io_hal.c (one year old)
  • components/hal/rtc_io_hal.c (three years old)

see also here and in the following lines:
https://github.com/zephyrproject-rtos/hal_espressif/blob/zephyr/zephyr/esp32/CMakeLists.txt#L180

However, I think this can be easily fixed if one replaces line 188 with the following content:
../esp_shared/components/driver/rtc_io_hal.c

Steps to reproduce

  1. copy the deep_sleep sample from the zephyr repo
  2. modify the project and enable an adc and use it in the sourcecode
  3. build the project
    ... you'll see a similar error as above

Unable to boot on ESP32 with IDF bootloader and flash encryption

Environment

  • Development Kit: ESP32-DevKitC
  • Kit version: v4
  • Module or chip used: ESP32-WROOM-32
  • IDF version: v4.3-163-g2d748a740
  • Build System: west
  • Compiler version: esp-2021r2
  • Operating System: Linux
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

Compiling the bootloader with a custom sdkconfig qhich enables secure boot and flash encryption and then starting the ESP causes a bootloop as the bootloader never manages to execute the Zephyr image. I enabled the reflashable encryption in release mode, so I can pre-encrypt the image, pad it to 16 bytes and flash it via UART. This works fine for regular IDF and Arduino code but not for Zephyr. I figured those two commits would fix it but apparently they did not for me. Is there a way to debug it further as Zephyr is never executed as far as I can tell?
265712b
a7dc3c7

Expected Behavior

ESP boots into Zephyr

Actual Behavior

Bootloop while trying to load Zephyr

Steps to reproduce

  1. Change sdkconfig to include secure boot and flash encryption and remove logging to fit before 0x8000 where the partition table is.
  2. Load latest espressif hal code from 'zephyr' branch (commit 2d748a7)
  3. Set fuses as described in IDF documentation for secure boot and flash encryption
  4. Flash custom bootloader and produced zephyr binary at correct offsets

Debug Logs

Relevant parts of sdkconfig:

#
# Bootloader config
#
CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
CONFIG_BOOTLOADER_LOG_LEVEL=3
# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
# CONFIG_BOOTLOADER_FACTORY_RESET is not set
CONFIG_BOOTLOADER_WDT_ENABLE=y
# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y
CONFIG_BOOTLOADER_APP_SECURE_VERSION=0
CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD=32
# CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE is not set
CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0
# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set
CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y
# end of Bootloader config

#
# Security features
#
CONFIG_SECURE_SIGNED_ON_BOOT=y
CONFIG_SECURE_SIGNED_ON_UPDATE=y
CONFIG_SECURE_SIGNED_APPS=y
CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME=y
CONFIG_SECURE_BOOT=y
CONFIG_SECURE_BOOT_V1_ENABLED=y
# CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH is not set
CONFIG_SECURE_BOOTLOADER_REFLASHABLE=y
CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES=y
CONFIG_SECURE_BOOT_SIGNING_KEY="signing_key.pem"
CONFIG_SECURE_BOOTLOADER_KEY_ENCODING_256BIT=y
# CONFIG_SECURE_BOOTLOADER_KEY_ENCODING_192BIT is not set
# CONFIG_SECURE_BOOT_INSECURE is not set
CONFIG_SECURE_FLASH_ENC_ENABLED=y
# CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT is not set
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_RELEASE=y
# CONFIG_SECURE_FLASH_CHECK_ENC_EN_IN_APP is not set
# end of Security features

CONFIG_ESP_ROM_HAS_CRC_LE=y
CONFIG_ESP_ROM_HAS_CRC_BE=y
CONFIG_ESP_ROM_HAS_JPEG_DECODE=y
CONFIG_ESP_ROM_SUPPORT_MULTIPLE_UART=y

#
# Serial flasher config
#
# CONFIG_ESPTOOLPY_NO_STUB is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y
CONFIG_ESPTOOLPY_FLASHMODE="dio"
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
CONFIG_ESPTOOLPY_BEFORE_RESET=y
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
CONFIG_ESPTOOLPY_BEFORE="default_reset"
CONFIG_ESPTOOLPY_AFTER_RESET=y
# CONFIG_ESPTOOLPY_AFTER_NORESET is not set
CONFIG_ESPTOOLPY_AFTER="hard_reset"
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
# end of Serial flasher config

#
# Partition Table
#
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
# CONFIG_PARTITION_TABLE_SINGLE_APP_ENCRYPTED_NVS is not set
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE_ENC_NVS is not set
# CONFIG_PARTITION_TABLE_TWO_OTA_ENCRYPTED_NVS is not set
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table

#
# Compiler options
#
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set
# CONFIG_COMPILER_OPTIMIZATION_PERF is not set
# CONFIG_COMPILER_OPTIMIZATION_NONE is not set
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set
CONFIG_COMPILER_HIDE_PATHS_MACROS=y
# CONFIG_COMPILER_CXX_EXCEPTIONS is not set
# CONFIG_COMPILER_CXX_RTTI is not set
CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set
# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set
# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set
CONFIG_COMPILER_STACK_CHECK=y
# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set
# CONFIG_COMPILER_DUMP_RTL_FILES is not set
# end of Compiler options

As I turned off logging in the bootloader there is nothing more on logs I can provide. I could create a new test environment where the bootloader has verbose logging as well, but maybe it's already known that this setup can cause issues so I didn't yet spent time on changing the offsets so both logging and encryption are doable.

Incorrect display of new lines with west espressif monitor

Environment

  • Development Kit: none
  • Module or chip used: ESP32-WROOM-32
  • IDF version (run git describe --tags to find it): 8c7ee78
  • Build System: zephyr sdk
  • Operating System: Linux
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

the line endings aren't displayed correctly using IDFs serial monitor using $ west espressif monitor

Expected Behavior

output as if I am using a normal console window.

Actual Behavior

newline not always introduces a line break. sometimes the cursor position just goes to the first character position of the last line. This is a display glitch on the host side! It is due to the missing --eol argument when starting the idf monitor from west and a bogus default value for the idf monitor.

Steps to reproduce

  1. flash any example project with text output or shell access from zephyr.
  2. connect serial console using west espressif monitor
  3. output is mangled since west espressif monitor does not interpret newline correct.

Solution

with this patch:

diff --git a/west/tools.py b/west/tools.py
index c649a7bdf..61d691049 100644
--- a/west/tools.py
+++ b/west/tools.py
@@ -136,6 +136,7 @@ class Tools(WestCommand):
         group.add_argument('-b', '--baud', default="115200", help='Serial port baud rate')
         group.add_argument('-p', '--port', help='Serial port address')
         group.add_argument('-e', '--elf', help='ELF file')
+        group.add_argument('-n', '--eol', default='CR', help='EOL to use')
 
         return parser
 
@@ -173,7 +174,7 @@ class Tools(WestCommand):
         cmd_path = Path(os.getenv("ZEPHYR_BASE")).absolute()
         if platform.system() == 'Windows':
             cmd_exec(("python.exe", monitor_path, "-p", esp_port,
-                     "-b", args.baud, elf_path), cwd=cmd_path)
+                     "-b", args.baud, elf_path, "--eol", args.eol), cwd=cmd_path)
         else:
             cmd_exec((sys.executable, monitor_path, "-p", esp_port, "-b", args.baud,
-                      elf_path), cwd=cmd_path)
+                      elf_path, "--eol", args.eol), cwd=cmd_path)

... it will just conduit the eol parameter from west espressif monitor to espressifs serial monitor. Now you can select if you want broken new lines (CR, upstream default behaviour), or working new lines (LF). with to command: west espressif monitor -n LF

WPA-Enterprise support

Is there any plan to add WPA-Enterprise support to Zephyr on Espressif platforms?

This would be a big help, letting us move a couple of projects that are currently stuck with ESP-IDF to Zephyr, which is otherwise a much better fit for us.

Delete and rename branches

@stephanosio Please, can you perform the following changes in this repository:

  1. delete branch hal_v4.3 -> it isn't being used at all.
  2. delete branch hal_v4.4.1_latest -> I accidentally push this. It can be deleted.
  3. rename default zephyr -> hal_v4.3 -> Current zephyr was based in esp-idf v4.3. As it was updated to v4.4.1, this can be renamed to hal_v4.3.
  4. rename hal_v4.4.1 to zephyr and make it default. This is the default branch set in this PR: zephyrproject-rtos/zephyr#49682

At the end, we only need 3 branches in here:
hal_v4.2 -> The initial branch used.
hal_v4.3 -> Previous after the PR mentioned above.
zephyr -> latest based on v4.4.1.

zephyr: esptool too old?

Environment

  • Development Kit: ESP32-C3-SuperMini
  • Kit version (for WroverKit/PicoKit/DevKitC): -
  • Module or chip used: ESP32-C3
  • IDF version (run git describe --tags to find it):
    • IDF not involved (zephyr west based).
    • esptool version: v4.5
    • hal/espressif version after west update: (HEAD detached at 19d2fe44ba)
  • Build System: zephyr west
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it):
    riscv64-zephyr-elf-gcc.exe (Zephyr SDK 0.16.4) 12.2.0
  • Operating System: Windows
  • (Windows only) environment type: PowerShell.
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

Zephyr: west build + west flash failed.
BUT: took the failed command, replaces out the esptool path to the standard IDF/esptool, it works.
However, this replacement is too manual and hacky to do every time...

Expected Behavior

west build; west flash should work.

Actual Behavior

Failed to flash.

Steps to reproduce

  1. Update both clean zephyr and modules/hal/espressif git dirs with west update.
  2. At zephyr git: cd \samples\hello_world; west build -b esp32c3_devkitm . Succeeded.
  3. Then flashing: cd build; west flash Failed (and this is the problem). Full message:
-- west flash: rebuilding
[1/1] C:\WINDOWS\system32\cmd.exe /C "cd /D C:\Users\jerus...zephyr/zephyr/samples/hello_world/build/zephyr/zephyr.elf"
-- west flash: using runner esp32
-- runners.esp32: reset after flashing requested
-- runners.esp32: Flashing esp32 chip on None (921600bps)
esptool.py v4.5
Found 2 serial ports
Serial port COM11
Connecting...
COM11 failed to connect: Write timeout
Serial port COM1
Connecting......................................
COM1 failed to connect: Failed to connect to Espressif device: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html

A fatal error occurred: Could not connect to an Espressif device on any of the 2 available serial ports.
FATAL ERROR: command exited with status 2: 'C:\Users\jerus\zephyr\.venv\Scripts\python.exe' 'C:/Users/jerus/zephyr/modules/hal/espressif\components\esptool_py\esptool\esptool.py' --chip auto --baud 921600 --before default_reset --after hard_reset write_flash -u --flash_mode dio --flash_freq 40m --flash_size detect 0x0 C:/Users/jerus/zephyr/zephyr/samples/hello_world/build/esp-idf/build/bootloader/bootloader.bin 0x8000 C:/Users/jerus/zephyr/zephyr/samples/hello_world/build/esp-idf/build/partitions_singleapp.bin 0x10000 'C:\Users\jerus\zephyr\zephyr\samples\hello_world\build\zephyr\zephyr.bin'
  1. HACK the failed command to:
C:/Embeddings/Espressif2/python_env/idf5.1_py3.11_env/Scripts/python.exe  C:/Embeddings/Espressif2/frameworks/esp-idf-v5.1.2/components/esptool_py/esptool/esptool.py --chip auto --baud 921600 --before default_reset --after hard_reset write_flash -u --flash_mode dio --flash_freq 40m --flash_size detect 0x0 C:/Users/jerus/zephyr/zephyr/samples/hello_world/build/esp-idf/build/bootloader/bootloader.bin 0x8000 C:/Users/jerus/zephyr/zephyr/samples/hello_world/build/esp-idf/build/partitions_singleapp.bin 0x10000 'C:\Users\jerus\zephyr\zephyr\samples\hello_world\build\zephyr\zephyr.bin'

(NOTE: I only changed the first two args, i.e., python esptool ).
It succeeds with message:

esptool.py v4.7.0
Found 2 serial ports
Serial port COM11
Connecting...
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (QFN32) (revision v0.4)
Features: WiFi, BLE, Embedded Flash 4MB (XMC)
Crystal is 40MHz
MAC: c0:4e:30:80:4d:ac
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00033fff...
Flash params set to 0x0220
Wrote 32768 bytes at 0x00000000 in 0.5 seconds (582.3 kbit/s)...
Hash of data verified.
Wrote 16384 bytes at 0x00008000 in 0.2 seconds (710.4 kbit/s)...
Hash of data verified.
Wrote 147456 bytes at 0x00010000 in 2.0 seconds (578.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

So it seems to me that esptool v4.5 carried with zephyr is tool old, while v4.7.0 is good enough.

use ifndef around defines for likely and unlikely

Please guard #define likely(x) and #define unlikely(x) with #ifndef.

zephyr/CMakeFiles/zephyr.dir/__w/zephyr/modules/hal/espressif/components/esp_timer/src/esp_timer.c.obj -c /__w/zephyr/modules/hal/espressif/components/esp_timer/src/esp_timer.c
In file included from ../../../../../../include/zephyr/toolchain.h:50,
                 from ../../../../../../include/zephyr/kernel_includes.h:19,
                 from ../../../../../../include/zephyr/kernel.h:17,
                 from /__w/zephyr/modules/hal/espressif/components/esp_timer/src/esp_timer.c:23:
../../../../../../include/zephyr/toolchain/gcc.h:250: error: "likely" redefined [-Werror]
  250 | #define likely(x)   (__builtin_expect((bool)!!(x), true) != 0L)
      | 
In file included from /__w/zephyr/modules/hal/espressif/zephyr/esp32/../../components/esp_common/include/esp_err.h:12,
                 from /__w/zephyr/modules/hal/espressif/components/esp_timer/src/esp_timer.c:11:
/__w/zephyr/modules/hal/espressif/zephyr/esp32/../../components/esp_common/include/esp_compiler.h:34: note: this is the location of the previous definition
   34 | #define likely(x)      (x)
      | 
../../../../../../include/zephyr/toolchain/gcc.h:251: error: "unlikely" redefined [-Werror]
  251 | #define unlikely(x) (__builtin_expect((bool)!!(x), false) != 0L)
      | 
/__w/zephyr/modules/hal/espressif/zephyr/esp32/../../components/esp_common/include/esp_compiler.h:37: note: this is the location of the previous definition
   37 | #define unlikely(x)    (x)

add more collaborators to this repository

Please, can you add the users below to this project? They all can approve PR.

glaubermaroto (Glauber Maroto)
uLipe (Felipe Neves)
shubhamkulkarni97 (Shubham Kulkarni)

GPIO 20 is not supported but actually used by some chips

Environment

  • Development Kit: Adafruit ESP32 Feather V2
  • Module or chip used: ESP32-PICO-V3-02 (revision 3)
  • IDF version: don't know
  • Build System: west 0.14.0, Zephyr SDK 0.15.2
  • Compiler version: xtensa-espressif_esp32_zephyr-elf-gcc (Zephyr SDK 0.15.2) 12.1.0
  • Operating System: Linux
  • Using an IDE?: Yes, VS Code
  • Power Supply: USB

Problem Description

The Adafruit board uses GPIO 20 for SCL (I2C), but this pin does not exist in the pinctl and thus cannot be configured in the device tree.

Expected Behavior

GPIO 20 can be configured as SCL for I2C0 and the bus is then functional. This does work using the Arduino libraries & sample code provided by Espressif / Adafruit and also using the fix/workaround shown below.

Actual Behavior

Compiler error, I2C0_SCL_GPIO20 is undefined.

Steps to reproduce / Code to reproduce this issue

Compile any zephyr demo (e.g. hello_world or the wifi test), but add the following device tree overlay:

&i2c0_default {
    group1 {
        pinmux = <I2C0_SDA_GPIO22>, <I2C0_SCL_GPIO20>;
        bias-pull-up;
        drive-open-drain;
        output-high;
    };
};

&i2c0 {
    sda-gpios = <&gpio0 22 GPIO_OPEN_DRAIN>;
    scl-gpios = <&gpio0 20 GPIO_OPEN_DRAIN>;
};

Possible Fix / Workaround

Applying the following fix to zephyr/esp_shared/pincfgs/esp32.yml fixes the issue:

-    gpio: [[0, 19], [21, 23], [25, 27], [32, 33]]
+    gpio: [[0, 23], [25, 27], [32, 33]]

mesh_provisioner sample gets stuck after the first "Waiting for unprovisioned beacon..." message

Environment

  • Development Kit: [ESP32-DevKitC | ESP32-C3-DevKitM]
  • Kit version (for WroverKit/PicoKit/DevKitC): [v1]
  • Module or chip used: [ESP32-WROOM-32 | ESP32-C3]
  • IDF version: commit hash: 9531c1c
  • Build System: [Zephyr west]
  • Compiler version:
    xtensa-espressif_esp32_zephyr-elf-gcc (Zephyr SDK 0.15.2) 12.1.0
    riscv64-zephyr-elf-gcc (Zephyr SDK 0.15.2) 12.1.0
  • Operating System: [Linux]
  • Using an IDE?: [No]
  • Power Supply: [USB]

Problem Description

I'm trying mesh and mesh_provisioner samples with the latest Zephyr RTOS 3.4 version, both esp32 board and esp32c3_devkitm board. "mesh" sample works fine but "mesh_provisioner" gets stuck just after the first "Waiting for unprovisioned beacon..." message. Can anyone help? I am not sure if this could be an issue or just a config setting question!

Expected Behavior

00> *** Booting Zephyr OS build zephyr-v3.4.0-1-g719dc245ef4f ***
00> Initializing...
00> Bluetooth initialized
00> Mesh initialized
00> Loading stored settings
00> Using stored CDB
00> Using stored settings
00> Waiting for unprovisioned beacon...
00> Waiting for unprovisioned beacon...
00> Device 63e634dd9332e8b60000000000000000 detected, press button 1 to provision.
00> Provisioning 63e634dd9332e8b60000000000000000
00> Waiting for node to be added...
00> Added node 0x0002
00> Configuring node 0x0002...
00> Element @ 0x0002: 4 + 0 models
00> Binding AppKey to model 0x002:0002
00> Binding AppKey to model 0x002:1000
00> Binding AppKey to model 0x002:1001
00> Configuration complete
00> Waiting for unprovisioned beacon...

Actual Behavior

*** Booting Zephyr OS build zephyr-v3.4.0-1-g719dc245ef4f ***
Initializing...
Bluetooth initialized
Mesh initialized
Loading stored settings
Using stored CDB
Using stored settings
Waiting for unprovisioned beacon...

_No more messages after here (program stucks here) _

Steps to reproduce

  1. Get and install Zephyr
  2. west blobs fetch hal_espressif
  3. cd zephyr/samples/bluetooth/mesh_provisioner
  4. west build -b esp32c3_devkitm
  5. west flash && west espressif monitor

Code to reproduce this issue

Debug Logs

*** Booting Zephyr OS build zephyr-v3.4.0-1-g719dc245ef4f ***
Initializing...
Bluetooth initialized
Mesh initialized
Loading stored settings
Using stored CDB
Using stored settings
Waiting for unprovisioned beacon...

_No more messages after here (program stucks here) _

west flash --esp-device stored in configuration file

Hello world :-)

Is it possible to store value of west flash --esp-device in some sort of configuration file so I don't have to type west flash --esp-device=/dev/cuaU0 each time on my FreeBSD box? :-)

If this feature is not available can we please add this? :-)

Thank you :-)
Tomek

ESP Log: Compilation error if CONFIG_LOG is not enabled.

Environment

  • Development Kit: Custom made
  • Module or chip used: ESP32-WROOM-32U
  • hal-espressif: c21d252
  • Zephyr: 91a6b286c9af2aad1ebbc6dbed72fcd149232b51 + PR#36378 + PR#36650
  • Build System: Zephyr/CMake
  • Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0
  • Operating System: Linux
  • Using an IDE?: No
  • Power Supply: 3.3V

Problem Description

Compilation error if CONFIG_LOG is not enabled.

...components/log/include/esp_log.h:148:26: error: 'CONFIG_LOG_DEFAULT_LEVEL' undeclared (first use in this function); did you mean 'LOG_LOCAL_LEVEL'?

Expected Behavior

Also work with CONFIG_LOG=n.

Actual Behavior

See above.

Steps to reproduce

Unset CONFIG_LOG or set CONFIG_LOG=n.

Code to reproduce this issue

N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.