Hi everyone,
I’ve been trying to update Jared’s zephyrtools
manifest and its toolchain configuration to support Raspberry Pico
, Espressif ESP32
and STM32
boards, so that I can use zephyrtools VSCode extension
for these boards as well as nRF Connect SDK
/ Vanilla Zephyr builds.
I was able to get successful builds for rpi_pico
and Adafruit_feather_stm32f405
but ran into issues with xiao_esp32s3
. For the latter, I was able to build successfully using my own workspace with VSCode pointing to the same zephyr-sdk toolchain as when using zephyr tools. So, not quite sure why I got an error for an ESP32 build.
@jaredwolff, Have I missed some change needed in zephyrtools configuration for the Xtensa
boards?
I’d like to use zephyrtools
extension for both ARM and Xtensa builds as it makes the whole build process much
easier and more flexible. Thank you.
Here are the changes I made to extend support for ARM & Xtensa boards.
west-vanilla.yml
modifications
- removed the following from the import: name-blocklist:
– hal_rpi_pico
– hal_espressif
– hal_xtensa
– hal_stm32
- ran west update to get the hal, device tree bindings, etc.
For Xtensa, copied the Xtensa Espressif SDK into .zephyrtools/toolchain/zephyr-sdk-0.15.1
and also to /opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk
to support the esp32-s3 and esp32-s2 builds.
- xtensa-espressif_esp32s3_zephyr-elf
- xtensa-espressif_esp32s2_zephyr-elf
- Results
As I anticipated, the builds for the ARM boards rpi_pico
and adafruit_feather_stm32f405
built fine. There were no issues at all.
However, with xiao_esp32s3
builds I ran into issues.
For both ARM and the Xtensa builds, although I’m using west-vanilla, the
host-tool and toolchain used were from the path below instead of ~/.zephyrtools.
-- Found host-tools: zephyr 0.16.1 (/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk)
I expected zephyrtools
zephyr-sdk to be used.
.zephyrtools/toolchain/zephyr-sdk-0.15.1
I tried setting ZEPHYR_SDK_INSTALL_DIR
to the zephyrtools zephyr-sdk containing the
Espressif toolchain but still got a build error.
However, when I used my own zephyr_vanilla_zephyrproject.code-workspace
with VSCode and set ZEPHYR_SDK_INSTALL_DIR
then build worked fine for esp32s3. So, I expected zephyrtools to also work with the same toolchain.
VSCode: zephyr_vanilla_zephyrproject.code-workspace
"settings": {
"terminal.integrated.env.osx": {
"PATH": "$HOME/zephyrproject350/zephyr/scripts",
"ZEPHYR_BASE": "${env:HOME}/zephyrproject350/zephyr",
"ZEPHYR_SDK_INSTALL_DIR": "/opt/zephyr-sdk-0.16.4",
}
Any suggestions how I can fix the error below and also force zephyrtools to use its toolchain
for vanilla-zephyr builds?
Here’s the build output with errors.
The error occurs when attempting to build ‘EspIdfBootloader’.
**[152/163] Performing build step for 'EspIdfBootloader'
FAILED: esp-idf/src/EspIdfBootloader-stamp/EspIdfBootloader-build**
* Executing task: west build -b xiao_esp32s3 -p
-- west build: making build dir /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world
-- CMake version: 3.24.2
-- Using NCS Toolchain 2.5.20231017.141038581733 for building. (/opt/nordic/ncs/toolchains/20d68df7e5/cmake)
CMake Deprecation Warning at /Users/quasar1015/Documents/2024_aqw_demo/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE
instead.
Call Stack (most recent call first):
/Users/quasar1015/Documents/2024_aqw_demo/zephyr/cmake/modules/python.cmake:16 (find_package)
/Users/quasar1015/Documents/2024_aqw_demo/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
/Users/quasar1015/Documents/2024_aqw_demo/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
/Users/quasar1015/Documents/2024_aqw_demo/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:5 (find_package)
-- Found Python3: /opt/nordic/ncs/toolchains/20d68df7e5/bin/python3 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: /Users/quasar1015/Library/Caches/zephyr
-- Zephyr version: 3.5.0 (/Users/quasar1015/Documents/2024_aqw_demo/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: xiao_esp32s3
-- Found host-tools: zephyr 0.16.1 (/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk)
-- Found Dtc: /opt/nordic/ncs/toolchains/20d68df7e5/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
-- Found BOARD.dts: /Users/quasar1015/Documents/2024_aqw_demo/zephyr/boards/xtensa/xiao_esp32s3/xiao_esp32s3.dts
-- Generated zephyr.dts: /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/zephyr/dts.cmake
/Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/zephyr/zephyr.dts:40.39-47.5: Warning (interrupt_provider): /soc/interrupt-controller@600c2000: Missing #address-cells in interrupt provider
Parsing /Users/quasar1015/Documents/2024_aqw_demo/zephyr/Kconfig
Loaded configuration '/Users/quasar1015/Documents/2024_aqw_demo/zephyr/boards/xtensa/xiao_esp32s3/xiao_esp32s3_defconfig'
Merged configuration '/Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/prj.conf'
Configuration saved to '/Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/zephyr/.config'
Kconfig header saved to '/Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/xtensa-espressif_esp32s3_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s3_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s3_zephyr-elf/bin/ld.bfd (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: /opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/xtensa-espressif_esp32s3_zephyr-elf/bin/xtensa-espressif_esp32s3_zephyr-elf-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build
-- west build: building application
[1/163] Preparing syscall dependency handling
[7/163] Generating include/generated/version.h
-- Zephyr version: 3.5.0 (/Users/quasar1015/Documents/2024_aqw_demo/zephyr), build: zephyr-v3.5.0
[151/163] Performing configure step for 'EspIdfBootloader'
-- Found Git: /usr/local/bin/git (found version "2.43.0")
-- 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: /opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/xtensa-espressif_esp32s3_zephyr-elf/bin/xtensa-espressif_esp32s3_zephyr-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/xtensa-espressif_esp32s3_zephyr-elf/bin/xtensa-espressif_esp32s3_zephyr-elf-gcc - 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: /opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/xtensa-espressif_esp32s3_zephyr-elf/bin/xtensa-espressif_esp32s3_zephyr-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32s3
-- Project sdkconfig file /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/sdkconfig
-- Adding linker script /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/soc/esp32s3/ld/esp32s3.peripherals.ld
-- Adding linker script /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_rom/esp32s3/ld/esp32s3.rom.ld
-- Adding linker script /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_rom/esp32s3/ld/esp32s3.rom.api.ld
-- Adding linker script /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_rom/esp32s3/ld/esp32s3.rom.libgcc.ld
-- Adding linker script /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_rom/esp32s3/ld/esp32s3.rom.newlib.ld
-- Adding linker script /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld
-- Adding linker script /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32s3/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32s3 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: /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/bootloader /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/bootloader_support /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/efuse /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp32s3 /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_common /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_hw_support /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_rom /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esp_system /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/freertos /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/hal /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/log /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/bootloader/subproject/main /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/bootloader/subproject/components/micro-ecc /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/newlib /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/partition_table /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/soc /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/spi_flash /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader
**[152/163] Performing build step for 'EspIdfBootloader'
FAILED: esp-idf/src/EspIdfBootloader-stamp/EspIdfBootloader-build** /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/src/EspIdfBootloader-stamp/EspIdfBootloader-build
cd /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader && /usr/local/Cellar/cmake/3.24.2/bin/cmake --build . && /usr/local/Cellar/cmake/3.24.2/bin/cmake -E touch /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/src/EspIdfBootloader-stamp/EspIdfBootloader-build
[1/101] Generating project_elf_src_esp32s3.c
[2/101] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/soc_include_legacy_warn.c.obj
[3/101] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32s3/gdma_periph.c.obj
[4/101] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32s3.c.obj
...
...
[98/101] Linking C static library esp-idf/main/libmain.a
[99/101] Linking C executable bootloader.elf
[100/101] Generating binary image from built executable
FAILED: .bin_timestamp /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader/.bin_timestamp
cd /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader && /opt/nordic/ncs/toolchains/20d68df7e5/bin/python3 /Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py/esptool/esptool.py --chip esp32s3 elf2image --flash_mode dio --flash_freq 80m --flash_size 2MB --dont-append-digest -o /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader/bootloader.bin /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader/bootloader.elf && /usr/local/Cellar/cmake/3.24.2/bin/cmake -E echo "Generated /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader/bootloader.bin" && /usr/local/Cellar/cmake/3.24.2/bin/cmake -E md5sum /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader/bootloader.bin > /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build/esp-idf/build/bootloader/.bin_timestamp
Traceback (most recent call last):
File "/Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py/esptool/esptool/loader.py", line 57, in <module>
import serial.tools.list_ports as list_ports
File "/opt/nordic/ncs/toolchains/20d68df7e5/lib/python3.9/site-packages/serial/tools/list_ports.py", line 31, in <module>
from serial.tools.list_ports_posix import comports
File "/opt/nordic/ncs/toolchains/20d68df7e5/lib/python3.9/site-packages/serial/tools/list_ports_posix.py", line 33, in <module>
from serial.tools.list_ports_osx import comports
File "/opt/nordic/ncs/toolchains/20d68df7e5/lib/python3.9/site-packages/serial/tools/list_ports_osx.py", line 26, in <module>
import ctypes
File "/opt/nordic/ncs/toolchains/20d68df7e5/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/opt/nordic/ncs/toolchains/20d68df7e5/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so, 2): Symbol not found: __dyld_shared_cache_contains_path
Referenced from: /opt/nordic/ncs/toolchains/20d68df7e5/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so (which was built for Mac OS X 11.0)
Expected in: /usr/lib/libSystem.B.dylib
in /opt/nordic/ncs/toolchains/20d68df7e5/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py/esptool/esptool.py", line 31, in <module>
import esptool
File "/Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py/esptool/esptool/__init__.py", line 41, in <module>
from esptool.cmds import (
File "/Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py/esptool/esptool/cmds.py", line 14, in <module>
from .bin_image import ELFFile, ImageSegment, LoadFirmwareImage
File "/Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py/esptool/esptool/bin_image.py", line 14, in <module>
from .loader import ESPLoader
File "/Users/quasar1015/Documents/2024_aqw_demo/modules/hal/espressif/components/esptool_py/esptool/esptool/loader.py", line 62, in <module>
% (sys.VERSION, sys.executable)
AttributeError: module 'sys' has no attribute 'VERSION'
ninja: build stopped: subcommand failed.
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /Users/quasar1015/Documents/2024_aqw_demo/demo/hello_world/build
* The terminal process "/bin/bash '-l', '-c', 'west build -b xiao_esp32s3 -p'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.