ESP32 的 Zephyr hello world 应用程序失败

Zephyr hello world application failed for ESP32

OS: Ubuntu 18.04,64 位(新安装)
Zephyr 版本:2.2.99
Zephyr SDK 版本:0.11.2
xtensa-esp32-elf-gcc 版本:5.2.0 --build=x86_64-build_pc-linux-gnu

根据 Zephyr 和 esp 的入门指南,我们已经设置了环境变量。

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"

我们正在构建 hello_world 应用程序:

west build -b esp32 samples/hello_world

[84/122] 构建 ASM 对象 modules/xtensa/CMakeFiles/modules_xtensa_hal.dir/src/hal/cache_asm.S.obj
失败: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/包括-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:汇编消息:
/home/swapna/Documents/Workspace/Zephyr_ESP/zp/modules/hal/xtensa/src/hal/cache_asm.S:186: 错误:未知操作码或格式名称 'declfunc'

环境路径有误。

1. ESPRESSIF_TOOLCHAIN_PATH

使用 esp_guide 构建 esp32 的 hello world 应用程序。
根据有关如何构建工具链路径的文档,在

中设置

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

更改了此设置并再次尝试构建。再次构建失败 error

  1. 构建仍然失败。我在github上查看了esp32相关的issues。遇到 this
    因此,我根据提交中提到的更改修改了代码。
    瞧!有效。在 esp32 上成功构建并烧录。

这是环境设置的更新版本: https://docs.zephyrproject.org/latest/boards/xtensa/esp32/doc/index.html

您现在可以使用 west espressif installwest espressif update 来管理工具链。不过,您需要在环境变量中提供工具链二进制文件的路径,即将其添加到您的 ~/.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