0
votes

OS: Ubuntu 18.04,64bit (New Installed)
Zephyr Version: 2.2.99
Zephyr SDK Version: 0.11.2
xtensa-esp32-elf-gcc Version: 5.2.0 --build=x86_64-build_pc-linux-gnu

As per getting started guide for Zephyr and esp, we have set environment variable.

export ZEPHYR_TOOLCHAIN_VARIANT="espressif"
export ESPRESSIF_TOOLCHAIN_PATH="/home/swapna/Documents/Workspace/esp/xtensa-esp32-elf"
export ZEPHYR_SDK_INSTALL_DIR="/home/swapna/Documents/Workspace/Zephyr_ESP/zephyr-sdk"

We building hello_world application:

west build -b esp32 samples/hello_world

[84/122] Building ASM object modules/xtensa/CMakeFiles/modules_xtensa_hal.dir/src/hal/cache_asm.S.obj
FAILED: modules/xtensa/CMakeFiles/modules_xtensa_hal.dir/src/hal/cache_asm.S.obj
ccache /home/swapna/Documents/Workspace/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DBUILD_VERSION=zephyr-v2.2.0-844-g6c2451c5c0a6 -DKERNEL -D_FORTIFY_SOURCE=2 -D__ZEPHYR__=1 -I/home/swapna/Documents/Workspace/Zephyr_ESP/zp/zephyr/include -Izephyr/include/generated -I/home/swapna/Documents/Workspace/Zephyr_ESP/zp/zephyr/soc/xtensa/esp32 -I/home/swapna/Documents/Workspace/Zephyr_ESP/zp/zephyr/soc/xtensa/esp32/include -I/home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/esp-idf/zephyr/../components/esp32/include -I/home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/esp-idf/zephyr/../components/soc/esp32/include -I/home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/xtensa/include -I/home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/xtensa/zephyr/soc/esp32 -isystem /home/swapna/Documents/Workspace/Zephyr_ESP/zp/zephyr/lib/libc/minimal/include -isystem /home/swapna/Documents/Workspace/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/include -isystem /home/swapna/Documents/Workspace/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/include-fixed -Os -imacros/home/swapna/Documents/Workspace/Zephyr_ESP/zp/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -xassembler-with-cpp -imacros/home/swapna/Documents/Workspace/Zephyr_ESP/zp/zephyr/include/toolchain/zephyr_stdint.h -D_ASMLANGUAGE -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -ffunction-sections -fdata-sections -mlongcalls -nostdinc -MD -MT modules/xtensa/CMakeFiles/modules_xtensa_hal.dir/src/hal/cache_asm.S.obj -MF modules/xtensa/CMakeFiles/modules_xtensa_hal.dir/src/hal/cache_asm.S.obj.d -o modules/xtensa/CMakeFiles/modules_xtensa_hal.dir/src/hal/cache_asm.S.obj -c /home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/xtensa/src/hal/cache_asm.S
/home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/xtensa/src/hal/cache_asm.S: Assembler messages:
/home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/xtensa/src/hal/cache_asm.S:186: Error: unknown opcode or format name 'declfunc'

2

2 Answers

0
votes

There is a mistake in environment path.

1. ESPRESSIF_TOOLCHAIN_PATH

Build the esp32's hello world application using esp_guide.
As per the documentation about how to build the toolchain path is set in

$HOME/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/

Changed this setting and tried building again. Again build failed error

  1. Build still getting failed. I checked the issues related to esp32 on the github. Came across with this.
    So, I modified in the code as per the changes mentioned in the commit.
    And Voila!! It worked. Successfully build and flashed on esp32.
0
votes

Here is updated version of the environment setup: https://docs.zephyrproject.org/latest/boards/xtensa/esp32/doc/index.html

You can now use west espressif install and west espressif update to manage toolchain. Still, you need to provide path to toolchain binaries in environmental variables, i.e add this to your ~/.profile:

export ESPRESSIF_TOOLCHAIN_PATH="${HOME}/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf"
export PATH=$PATH:$ESPRESSIF_TOOLCHAIN_PATH/bin