EmbeddedNim / nephyr

Nim wrapper for Zephyr
Apache License 2.0
27 stars 2 forks source link

Devel still required? #1

Open girvo opened 2 years ago

girvo commented 2 years ago

Just wanted to check that Nim devel is still needed for this. Got Zephyr up and running on it's own for my board but wanted to try this out instead of Nesper as per our quick convo in the Issues for that initially, but my VSCode had issues with choosenim for whatever reason (despite being sure the PATH variables were correct and so on) and I had to install v1.6.4 manually

girvo commented 2 years ago

Okay I tested it all myself, and it very much seems it is. No worries there, though the bigger issue I have is that I'm running all of this on Windows and it appears all the env-var handling your samples/board stuff requires is Linux? Do you know if WSL will work; I do remember reading that Zephyr is not a fan of WSL2 due to the VMs that get in the way. I see you've got VSCode dev containers setup -- are they for Linux containers on Linux or are you running them elsewhere?

Sorry for the heap of issues and comments the last few days!

elcritch commented 2 years ago

Hi @girvo, yes there's still lots of ongoing development though I've been focused on the Nim-based networking/rpc layer lately.

Yes we're currently using Linux and/or WSL2 for development. Zephyr works on WSL2 fine, however, flashing the firmware can be a pain. The VSCode dev containers is used on Windows to open a dev environment inside a WSL2 container. Everything works great except for flashing. Currently you need to flash from Windows and need to know how to do that manually for your board.

Eventually I'd like to get Zephyr running natively on Windows. The limitations are mostly due to handling the folder setup that Zephyr expects and getting Nephyr to match that. There is shorter term goal to get rid of the env files toward a full nephyrcli to handle that which would help. I've made some progress Nephyrcli.

Out of curiosity, what board are you using?

girvo commented 2 years ago

Oh thats perfect! I'll move to WSL2 instead then, thats great. I can flash it easy enough myself :) idf.py is straightforward. Worst case I can use west outside the WSL2 to send the firmware anyway in Windows directly, though I imagine getting JTAG up and running for debugging might be more complex there.

So this is for an ESP32-based project (FireBeetle ESP32 for this current task, but our own custom board is the eventual target). One thing I've run into is the latest version of Zephyr I managed to get samples/basic/blinky built and flashed (the C version not the Nim version) with the Espressif toolchain, but with the patched version that Nephyr uses (from what I can see) it doesn't work -- though this is in Windows.

Will I be able to get Nephyr up and running on ESP32, modulo the correct overlay and so on? Is the toolchain issue I ran into with west build on the C version just down to Windows path stuff again?

(.venv) PS C:\Users\JoshGirvin\zephyrproject\zephyr> west build -p auto -b esp32 samples/basic/blinky
-- west build: generating a build system
Including boilerplate (Zephyr base (cached)): C:/Users/JoshGirvin/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: C:/Users/JoshGirvin/zephyrproject/zephyr/samples/basic/blinky
-- Zephyr version: 2.7.0 (C:/Users/JoshGirvin/zephyrproject/zephyr), build: zephyr-v2.7.0-121-g38c201254c98
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: esp32
-- Cache files will be written to: C:/Users/JoshGirvin/zephyrproject/zephyr/.cache
(.venv) PS C:\Users\JoshGirvin\zephyrproject\zephyr> $env:ESPRESSIF_TOOLCHAIN_PATH="$env:USERPROFILE\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf"
(.venv) PS C:\Users\JoshGirvin\zephyrproject\zephyr> $env:Path += "$env:ESPRESSIF_TOOLCHAIN_PATH\bin"
(.venv) PS C:\Users\JoshGirvin\zephyrproject\zephyr> west build -p auto -b esp32 samples/basic/blinky
-- west build: generating a build system
Including boilerplate (Zephyr base (cached)): C:/Users/JoshGirvin/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: C:/Users/JoshGirvin/zephyrproject/zephyr/samples/basic/blinky
-- Zephyr version: 2.7.0 (C:/Users/JoshGirvin/zephyrproject/zephyr), build: zephyr-v2.7.0-121-g38c201254c98
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: esp32
-- Cache files will be written to: C:/Users/JoshGirvin/zephyrproject/zephyr/.cache
-- Found toolchain: espressif (C:/Users/JoshGirvin/.espressif/tools/xtensa-esp32-elf)
CMake Error at C:/Users/JoshGirvin/zephyrproject/zephyr/cmake/compiler/gcc/generic.cmake:9 (message):

  User-configuration:

  ZEPHYR_TOOLCHAIN_VARIANT: espressif

  Internal variables:

  CROSS_COMPILE:
  C:/Users/JoshGirvin/.espressif/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-

  TOOLCHAIN_HOME: C:/Users/JoshGirvin/.espressif/tools/xtensa-esp32-elf

Call Stack (most recent call first):
  C:/Users/JoshGirvin/zephyrproject/zephyr/cmake/generic_toolchain.cmake:42 (include)
  C:/Users/JoshGirvin/zephyrproject/zephyr/cmake/app/boilerplate.cmake:540 (include)
  C:/Users/JoshGirvin/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  C:/Users/JoshGirvin/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
  CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' '-DWEST_PYTHON=C:\Users\JoshGirvin\zephyrproject\.venv\Scripts\python.exe' '-BC:\Users\JoshGirvin\zephyrproject\zephyr\build' '-SC:\Users\JoshGirvin\zephyrproject\zephyr\samples\basic\blinky' -GNinja

All those files it's looking for in .espressif actually do exist, but it's failing somewhere.

I'll try to set it up with WSL2 directly for building, and see how far along I get with it anyway.

What do your patches in nephyr-v2.7-branch-patched add/remove? My other option was to borrow your bindings and handle outputting the C files from my Nim source files directly inside a Zephyr sample, but I imagine its more complicated than that.

Regardless, its likely something due to the fact that I setup Zephyr as v3.0.0 initially by following their steps, and I think blitzing this and starting again is a good idea. I'll attempt that today as well, see if I can't compile a C version inside WSL2 and then setup Nephyr.

girvo commented 2 years ago

Okay, so good news (and bad news)!

Good news; WSL2 definitely works a LOT better, and I got the whole toolchain up and running.

Bad news, I have a type error against the headers somewhere when running nimble zephyr_build even though the compile worked.

Was I not supposed to run west update after init-ing your branch of Zephyr?

[99/359] Building C object zephyr/lib/posix/CMakeFiles/lib__posix.dir/clock.c.obj
FAILED: zephyr/lib/posix/CMakeFiles/lib__posix.dir/clock.c.obj 
ccache /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DBUILD_VERSION=zephyr-v2.7.0-121-g38c201254c98 -DCONFIG_DPP -DCONFIG_ECC -DCONFIG_IEEE80211W -DCONFIG_SHA256 -DCONFIG_WPA3_SAE -DEAP_MSCHAPv2 -DEAP_PEAP -DEAP_PEER_METHOD -DESP32_WORKAROUND -DESPRESSIF_USE -DESP_PLATFORM -DESP_SUPPLICANT -DIEEE8021X_EAPOL -DKERNEL -DMBEDTLS_CONFIG_FILE=\"config-tls-generic.h\" -DUSE_WPA2_TASK -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__ZEPHYR__=1 -D__ets__ -I/home/josh/zephyrproject/zephyr/kernel/include -I/home/josh/zephyrproject/zephyr/arch/xtensa/include -I/home/josh/zephyrproject/zephyr/include -I/home/josh/zephyrproject/nephyr_examples/app_blinky/build_esp32/zephyr/include/generated -I/home/josh/zephyrproject/zephyr/soc/xtensa/esp32 -I/home/josh/zephyrproject/zephyr/soc/xtensa/esp32/include -I/home/josh/zephyrproject/zephyr/lib/libc/newlib/include -I/home/josh/zephyrproject/zephyr/subsys/net/l2 -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/include/bt -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/include/crypto -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/include/wifi -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/hal/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/hal/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_hw_support/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_hw_support/port/esp32 -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_hw_support/port/esp32/private_include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_common/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_rom/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_rom/esp32/ld -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/xtensa/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/xtensa/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/soc/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/soc/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/soc/esp32/private_include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/include/soc -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/src/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/driver/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/soc/soc/esp32 -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_wifi/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/efuse/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/efuse/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_system/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_wifi/esp32/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_timer/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_timer/private_include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_netif/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/esp_event/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/log/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/wpa_supplicant/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/wpa_supplicant/port/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/wpa_supplicant/src -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/wpa_supplicant/include/esp_supplicant -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/wpa_supplicant/src/crypto -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/spi_flash/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/spi_flash/private_include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/bootloader_support/include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/newlib/priv_include -I/home/josh/zephyrproject/modules/hal/espressif/zephyr/esp32/../../components/bootloader_support/include_bootloader -I/home/josh/zephyrproject/modules/crypto/mbedtls/mbedtls/include -I/home/josh/zephyrproject/zephyr/modules/mbedtls/configs -I/home/josh/zephyrproject/zephyr/include/posix -Os -imacros /home/josh/zephyrproject/nephyr_examples/app_blinky/build_esp32/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -imacros /home/josh/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=/home/josh/zephyrproject/nephyr_examples/app_blinky=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/josh/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/josh/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -mlongcalls -std=c99 -MD -MT zephyr/lib/posix/CMakeFiles/lib__posix.dir/clock.c.obj -MF zephyr/lib/posix/CMakeFiles/lib__posix.dir/clock.c.obj.d -o zephyr/lib/posix/CMakeFiles/lib__posix.dir/clock.c.obj -c /home/josh/zephyrproject/zephyr/lib/posix/clock.c
In file included from /home/josh/zephyrproject/zephyr/include/posix/signal.h:9,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:178,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/zephyrproject/zephyr/include/posix/posix_types.h:45:3: error: conflicting types for 'pthread_attr_t'
 } pthread_attr_t;
   ^~~~~~~~~~~~~~
In file included from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/types.h:239,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:28,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/_pthreadtypes.h:75:3: note: previous declaration of 'pthread_attr_t' was here
 } pthread_attr_t;
   ^~~~~~~~~~~~~~
In file included from /home/josh/zephyrproject/zephyr/include/posix/signal.h:9,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:178,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/zephyrproject/zephyr/include/posix/posix_types.h:47:15: error: conflicting types for 'pthread_t'
 typedef void *pthread_t;
               ^~~~~~~~~
In file included from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/types.h:239,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:28,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/_pthreadtypes.h:32:20: note: previous declaration of 'pthread_t' was here
 typedef __uint32_t pthread_t;            /* identify a thread */
                    ^~~~~~~~~
In file included from /home/josh/zephyrproject/zephyr/include/posix/signal.h:9,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:178,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/zephyrproject/zephyr/include/posix/posix_types.h:58:3: error: conflicting types for 'pthread_mutex_t'
 } pthread_mutex_t;
   ^~~~~~~~~~~~~~~
In file included from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/types.h:239,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:28,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/_pthreadtypes.h:154:20: note: previous declaration of 'pthread_mutex_t' was here
 typedef __uint32_t pthread_mutex_t;      /* identify a mutex */
                    ^~~~~~~~~~~~~~~
In file included from /home/josh/zephyrproject/zephyr/include/posix/signal.h:9,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:178,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/zephyrproject/zephyr/include/posix/posix_types.h:62:3: error: conflicting types for 'pthread_mutexattr_t'
 } pthread_mutexattr_t;
   ^~~~~~~~~~~~~~~~~~~
In file included from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/types.h:239,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:28,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/_pthreadtypes.h:169:3: note: previous declaration of 'pthread_mutexattr_t' was here
 } pthread_mutexattr_t;
   ^~~~~~~~~~~~~~~~~~~
In file included from /home/josh/zephyrproject/zephyr/include/posix/signal.h:9,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:178,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/zephyrproject/zephyr/include/posix/posix_types.h:67:3: error: conflicting types for 'pthread_cond_t'
 } pthread_cond_t;
   ^~~~~~~~~~~~~~
In file included from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/types.h:239,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:28,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/_pthreadtypes.h:176:20: note: previous declaration of 'pthread_cond_t' was here
 typedef __uint32_t pthread_cond_t;       /* identify a condition variable */
                    ^~~~~~~~~~~~~~
In file included from /home/josh/zephyrproject/zephyr/include/posix/signal.h:9,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:178,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/zephyrproject/zephyr/include/posix/posix_types.h:70:3: error: conflicting types for 'pthread_condattr_t'
 } pthread_condattr_t;
   ^~~~~~~~~~~~~~~~~~
In file included from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/types.h:239,
                 from /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/time.h:28,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/sys/_pthreadtypes.h:186:3: note: previous declaration of 'pthread_condattr_t' was here
 } pthread_condattr_t;         /* a condition attribute object */
   ^~~~~~~~~~~~~~~~~~
In file included from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/zephyrproject/zephyr/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 /home/josh/zephyrproject/zephyr/include/posix/time.h:113,
                 from /home/josh/zephyrproject/zephyr/include/posix/time.h:12,
                 from /home/josh/zephyrproject/zephyr/lib/posix/clock.c:8:
/home/josh/.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);
     ^~~~~~~~~~~~~
[116/359] Performing configure step for 'EspIdfBootloader'
CMake Warning at /home/josh/zephyrproject/modules/hal/espressif/tools/cmake/idf.cmake:24 (message):
  IDF_PATH environment variable not found.  Setting IDF_PATH to
  '/home/josh/zephyrproject/modules/hal/espressif'.
Call Stack (most recent call first):
  /home/josh/zephyrproject/modules/hal/espressif/tools/cmake/project.cmake:7 (include)
  CMakeLists.txt:34 (include)

-- Found Git: /usr/bin/git (found version "2.25.1") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-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: /home/josh/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/josh/zephyrproject/nephyr_examples/app_blinky/build_esp32/esp-idf/build/sdkconfig
-- Adding linker script /home/josh/zephyrproject/modules/hal/espressif/components/esp32/ld/esp32.peripherals.ld
-- Adding linker script /home/josh/zephyrproject/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/josh/zephyrproject/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/josh/zephyrproject/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/josh/zephyrproject/modules/hal/espressif/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/josh/zephyrproject/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/josh/zephyrproject/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_hw_support esp_rom esp_system esptool_py hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /home/josh/zephyrproject/modules/hal/espressif/components/bootloader /home/josh/zephyrproject/modules/hal/espressif/components/bootloader_support /home/josh/zephyrproject/modules/hal/espressif/components/efuse /home/josh/zephyrproject/modules/hal/espressif/components/esp32 /home/josh/zephyrproject/modules/hal/espressif/components/esp_common /home/josh/zephyrproject/modules/hal/espressif/components/esp_hw_support /home/josh/zephyrproject/modules/hal/espressif/components/esp_rom /home/josh/zephyrproject/modules/hal/espressif/components/esp_system /home/josh/zephyrproject/modules/hal/espressif/components/esptool_py /home/josh/zephyrproject/modules/hal/espressif/components/hal /home/josh/zephyrproject/modules/hal/espressif/components/log /home/josh/zephyrproject/modules/hal/espressif/components/bootloader/subproject/main /home/josh/zephyrproject/modules/hal/espressif/components/bootloader/subproject/components/micro-ecc /home/josh/zephyrproject/modules/hal/espressif/components/newlib /home/josh/zephyrproject/modules/hal/espressif/components/partition_table /home/josh/zephyrproject/modules/hal/espressif/components/soc /home/josh/zephyrproject/modules/hal/espressif/components/spi_flash /home/josh/zephyrproject/modules/hal/espressif/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/josh/zephyrproject/nephyr_examples/app_blinky/build_esp32/esp-idf/build/bootloader
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/josh/zephyrproject/nephyr_examples/app_blinky/build_esp32
stack trace: (most recent call last)
/tmp/nimblecache-1896840867/nimscriptapi_511982108.nim(187, 16)
/home/josh/nephyr/src/nephyr/build_utils/tasks.nim(285, 7) zephyr_buildTask
/home/josh/.choosenim/toolchains/nim-#devel/lib/system/nimscript.nim(273, 7) exec
/home/josh/.choosenim/toolchains/nim-#devel/lib/system/nimscript.nim(273, 7) Error: unhandled exception: FAILED: west build -p always -b ${BOARD} -d build_${BOARD}  [OSError]
       Tip: 2 messages have been suppressed, use --verbose to show them.
     Error: Exception raised during nimble script execution
girvo commented 2 years ago

Is that a type-error issue somewhere, an ESP-IDF mismatch, or is it because I haven't followed this; https://github.com/mcu-tools/mcuboot/blob/main/docs/readme-espressif.md

To setup MCUBoot locally for this system?

Long way of asking, what steps am I missing to get ESP32 working :)

Overlay:

/ {
    aliases {
        led0 = &led0;
    };

    leds {
        compatible = "gpio-leds";
        led0: led_0 {
            gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
            label = "LED 0";
        };
    };
};

esp32.conf:

CONFIG_WIFI=y
CONFIG_WIFI_ESP32=y
CONFIG_HEAP_MEM_POOL_SIZE=98304

CONFIG_NETWORKING=y
CONFIG_NET_L2_ETHERNET=y

CONFIG_NET_IPV6=n
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=y

CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y

CONFIG_NET_LOG=y
CONFIG_NET_SHELL=n

CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENTROPY_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_ECP_ALL_ENABLED=y

CONFIG_ESP32_WIFI_SSID="myssid"
CONFIG_ESP32_WIFI_PASSWORD="mypassword"

esp32.env:

export MCUBOOT=$HOME/projects/rtos/zephyr-mcuboot-app
export BOARD=esp32
export SENSOR_TYPE=SensorAll
source $ZEPHYR_BASE/zephyr-env.sh

That first line in the esp32.env file doesn't exist on my system, I'm guessing I need to go through the process to set it up, but is the error I'm running into even related to that?

Vince-LD commented 1 year ago

Hi @girvo,

I really want to pick up Nim for MCU programming instead of micropython (slow, eventhough I love it) and tinygo that does not really support the esp32. I was wondering if you managed to make nephyr work with your esp32 and if so, how?

I'm a complete novice to Nim and compiled languages in general so if you have any additional ressource to point me to I'd be glad to take a look at it!