zephyr: Lora sender sample build error for esp32
Describe the bug
When building a project with the esp32 , I get build errors for example:
-- Generating done -- Build files have been written to: C:/Users/houssine/zephyrproject/zephyr/build [70/139] Building C object zephyr/lib/posix/CMakeFiles/lib__posix.dir/pthread_common.c.obj FAILED: zephyr/lib/posix/CMakeFiles/lib__posix.dir/pthread_common.c.obj C:\Users\houssine\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -DKERNEL -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__ZEPHYR__=1 -I../kernel/include -I../arch/xtensa/include -I../include -Izephyr/include/generated -I../soc/xtensa/esp32 -I../soc/xtensa/esp32/include -I../lib/libc/newlib/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/adapter/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/adapter/include/crypto -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/adapter/include/wifi -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_common/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_rom/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/xtensa/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/xtensa/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/esp32/private_include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/src/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/driver/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/esp32 -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_wifi/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/efuse/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/efuse/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_system/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_wifi/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_timer/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_timer/private_include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_netif/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_event/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/log/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/port/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/src -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/include/esp_supplicant -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/src/crypto -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/spi_flash/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/spi_flash/private_include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/bootloader_support/include -Os -imacros C:/Users/houssine/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -imacros C:/Users/houssine/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -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 -fmacro-prefix-map=C:/Users/houssine/zephyrproject/zephyr/samples/drivers/lora/send=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/houssine/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/houssine/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -mlongcalls -std=c99 -MD -MT zephyr/lib/posix/CMakeFiles/lib__posix.dir/pthread_common.c.obj -MF zephyr\lib\posix\CMakeFiles\lib__posix.dir\pthread_common.c.obj.d -o zephyr/lib/posix/CMakeFiles/lib__posix.dir/pthread_common.c.obj -c C:/Users/houssine/zephyrproject/zephyr/lib/posix/pthread_common.c In file included from C:/Users/houssine/zephyrproject/zephyr/lib/posix/pthread_common.c:10: ../include/posix/time.h:90:15: error: static declaration of 'clock_gettime' follows non-static declaration __syscall int clock_gettime(clockid_t clock_id, struct timespec *ts); ^~~~~~~~~~~~~ In file included from ../include/posix/time.h:12, from C:/Users/houssine/zephyrproject/zephyr/lib/posix/pthread_common.c:10: c:\users\houssine\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\time.h:187:5: note: previous declaration of 'clock_gettime' was here int clock_gettime (clockid_t clock_id, struct timespec *tp); ^~~~~~~~~~~~~ In file included from C:/Users/houssine/zephyrproject/zephyr/lib/posix/pthread_common.c:10: ../include/posix/time.h:94:5: error: conflicting types for 'timer_create' int timer_create(clockid_t clockId, struct sigevent *evp, timer_t *timerid); ^~~~~~~~~~~~ In file included from ../include/posix/time.h:12, from C:/Users/houssine/zephyrproject/zephyr/lib/posix/pthread_common.c:10: c:\users\houssine\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\time.h:192:5: note: previous declaration of 'timer_create' was here int timer_create (clockid_t clock_id, ^~~~~~~~~~~~ [71/139] Building C object zephyr/lib/posix/CMakeFiles/lib__posix.dir/nanosleep.c.obj FAILED: zephyr/lib/posix/CMakeFiles/lib__posix.dir/nanosleep.c.obj C:\Users\houssine\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -DKERNEL -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__ZEPHYR__=1 -I../kernel/include -I../arch/xtensa/include -I../include -Izephyr/include/generated -I../soc/xtensa/esp32 -I../soc/xtensa/esp32/include -I../lib/libc/newlib/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/adapter/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/adapter/include/crypto -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/adapter/include/wifi -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_common/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_rom/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/xtensa/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/xtensa/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/esp32/private_include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/src/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/driver/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/soc/soc/esp32 -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_wifi/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/efuse/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/efuse/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_system/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_wifi/esp32/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_timer/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_timer/private_include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_netif/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/esp_event/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/log/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/port/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/src -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/include/esp_supplicant -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/wpa_supplicant/src/crypto -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/spi_flash/include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/spi_flash/private_include -IC:/Users/houssine/zephyrproject/modules/hal/espressif/zephyr/../components/bootloader_support/include -Os -imacros C:/Users/houssine/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -imacros C:/Users/houssine/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -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 -fmacro-prefix-map=C:/Users/houssine/zephyrproject/zephyr/samples/drivers/lora/send=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/houssine/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/houssine/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -mlongcalls -std=c99 -MD -MT zephyr/lib/posix/CMakeFiles/lib__posix.dir/nanosleep.c.obj -MF zephyr\lib\posix\CMakeFiles\lib__posix.dir\nanosleep.c.obj.d -o zephyr/lib/posix/CMakeFiles/lib__posix.dir/nanosleep.c.obj -c C:/Users/houssine/zephyrproject/zephyr/lib/posix/nanosleep.c In file included from C:/Users/houssine/zephyrproject/zephyr/lib/posix/nanosleep.c:12: ../include/posix/time.h:90:15: error: static declaration of 'clock_gettime' follows non-static declaration __syscall int clock_gettime(clockid_t clock_id, struct timespec *ts); ^~~~~~~~~~~~~ In file included from ../include/posix/time.h:12, from C:/Users/houssine/zephyrproject/zephyr/lib/posix/nanosleep.c:12: c:\users\houssine\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\time.h:187:5: note: previous declaration of 'clock_gettime' was here int clock_gettime (clockid_t clock_id, struct timespec *tp); ^~~~~~~~~~~~~ In file included from C:/Users/houssine/zephyrproject/zephyr/lib/posix/nanosleep.c:12: ../include/posix/time.h:94:5: error: conflicting types for 'timer_create' int timer_create(clockid_t clockId, struct sigevent *evp, timer_t *timerid); ^~~~~~~~~~~~ In file included from ../include/posix/time.h:12, from C:/Users/houssine/zephyrproject/zephyr/lib/posix/nanosleep.c:12: c:\users\houssine\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\time.h:192:5: note: previous declaration of 'timer_create' was here int timer_create (clockid_t clock_id, ^~~~~~~~~~~~ [75/139] Building C object zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_esp32.c.obj ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\Users\houssine\zephyrproject\zephyr\build'
To Reproduce
Steps to reproduce the behavior:
- Build using
west build -b esp32 samples\drivers\lora\send
Expected behavior send a message with lora.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 38 (11 by maintainers)
Hi, please, update Zephyr to latest main, run
west updatethenwest espressif update.Notice that now ESP32 uses Zephyr-SDK 0.14.1. Please, also run
export ZEPHYR_TOOLCHAIN_VARIANT="zephyr"so that it uses the SDK as expected.In case you have issues running
west updateregardinghal_espressif, try deletinghal_espressiffolder and runwest updateagain.If this is still an issue preventing lora to be used on ESP32 maybe we can keep this open to track the missing feature?
Oh, thank you so much!
It works since I switched to
spi2, and I fixed thegpio1bank forGPIO35andGPIO34, and I used a single group only!All in all, all you told me to change.
I struggled with this recently. Chip version
0x00is exactly what I was getting, before I had the SPI correctly setup.I don’t know if its the cause of your issue, but I think your pin assignment for DIO D1 & D2 needs to change. On the ESP32, pins above
GPIO31are on port&gpio1not&gpio0. See here for more details.Hi @sylvioalves It is working now. The issue was that I was working with an all version of Zephyr code. I notice that
west updateupdates all the sub-repositories of zephyr project but doesn’t update the main repository. Thus, I needed to do agit pullin the root of zephyr project and a newwest updateafterwards. Then, the modules were updated (specially the hal_espressif) and everyhting works now fine. I think that we can close the issue. Thank very much!