I’m new to RIOT, and I tried to build some examples for different platforms. I was able to build blinky for the board Re-Mote (revb) from Zolertia, but I failed for ESP32-wroom-32 (which is my current target platform).
There are several issues when compiling, so I suspect something is wrong in my installation, or I’m using a newer compiler that treats former warnings as errors.
The compiler complains about implicit conversions for uint32_t to esp_log_level_t. For example, in cpu/esp32/startup.c I have to add a cast to esp_log_level_t before LOG_DEBUG (e.g. lines 243, 244).
[…]RIOT/cpu/esp32/startup.c:243:31: error: implicit conversion from ‘enum ’ to ‘esp_log_level_t’ [-Werror=enum-conversion]
243 | esp_log_level_set(“wifi”, LOG_DEBUG);
The format tags in cpu/esp32/syscalls.c (lines 385, 386) do not match the type (long unsigned int)
[…]RIOT/cpu/esp32/syscalls.c:385:11: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘uint32_t’ {aka ‘long unsigned int’} [-Werror=format=]
385 | DEBUG("%s TIMERG0 wdtconfig0=%08x wdtconfig1=%08x wdtconfig2=%08x "
This is where I’m stuck:
[…]RIOT/build/pkg/esp32_sdk/components/esp_system/port/cpu_start.c:604:5: error: ‘memcpy’ offset [0, 23] is out of the bounds [0, 0] [-Werror=array-bounds]
I tried two environments, openSUSE Tumbleweed as the native one and Ubuntu 22.04 LTS in a VM. I observe the same behavior in both environments.
In order to build I use
[...]examples/blinky$ make BOARD=esp32-wroom-32
Operating System Environment
Operating System: "openSUSE Tumbleweed"
Kernel: Linux 6.1.12-1-default x86_64 x86_64
System shell: GNU bash, Version 5.2.15(1)-release (x86_64-suse-linux)
make's shell: GNU bash, Version 5.2.15(1)-release (x86_64-suse-linux)
Looks like your compiler is newer than what comes with IDF. Since those warnings are in our code we should eventually fix them - but best you use compiler from the esp32 setup script which is currently GGC 8.4
But note: I was unable to actually get working binaries with toolchains other than the one @gschorcht provides. For now I would highly recommend to either compile with BUILD_IN_DOCKER=1 or installing the toolchain @gschorcht provides e.g. via the convenience install script found here: RIOT/install.sh at master · RIOT-OS/RIOT · GitHub.
RIOT currently still uses ESP-IDF 4.4, which is only compilable with GCC 8.4. Please note that the GCC 8.4 was the officially released toolchain from Espressif until 2 weeks ago. The current toolchain GCC 12.2, released 2 weeks ago, requires ESP-IDF 5.1.
As @maribu said you could use BUILD_IN_DOCKER=1 but installing the toolchain locally as mentioned by @benpicco and described here should be just as easy. For short
cd <RIOT directory>
dist/tools/esptools/install.sh esp32
. dist/tools/esptools/export.sh esp32
make BOARD=esp32-wroom-32 -C examples/blinky
The target argument esp32 in command install.sh and setup.sh could be replaced by esp32c3, esp32s2, esp32s3 or all to install and export the toolchain for another ESP32x SoCs or just for all ESP32x SoCs.
It’s a pity somehow that each project seems to require a separate version of compilers and libs. I’ll probably set up a separate Ubuntu guest to avoid messing up my other build environments. I’m not really a friend of Docker, actually.
That’s not complaining against you. I know how difficult it is to lift a complex project to a new tool chain. I’ll report my results later.
Me either. Off topic but, I use mkosi to build throw-away containers when I need to run some vendor’s install script to see what it will do to my system. Then decide if I actually want to install their stuff on my host, or setup a more permanent container instead. fakeroot is another great tool to run installers that want to be run as root, without actually giving it root access.