ESP32-S3 RGB LED : undefined reference to `_xtimer_tsleep'

Hi,

I’m trying to control the LED of the ESP32-S3-DevKitC-1 v1.1 board. It differs a little bit from the v1 version, supported by RIOT by a few pin assignments, says the revision note. So, I changed GPIO pin number accordingly.

Config

I installed Espressif’s local toolchain with the install.sh script provided by RIOT, on Ubuntu 22.10.

Blinky example modified

I started off from the blinky example :

  • Changes to the makefile :
    • added USEMODULE += ws281x (tried with USEMODULE += ws281x_esp32 too).
    • set BOARD = esp32s3-devkit and BOARD_VERSION = esp32s3-devkitc-1-n8r2
  • I included ws281x.h in main.c
  • I changed the main function like in the code bellow :
#include <stdio.h>

#include "clk.h"
#include "board.h"
#include "periph_conf.h"
#include "timex.h"
#include "ztimer.h"
#include "ws281x.h"

static void delay(void)
{
    if (IS_USED(MODULE_ZTIMER)) {
        ztimer_sleep(ZTIMER_USEC, 1 * US_PER_SEC);       // << ERROR 1 >>
    }
    else {
        uint32_t loops = coreclk() / 20;
        for (volatile uint32_t i = 0; i < loops; i++) { }
    }
}


int main(void)
{
    ws281x_t ledRgb;
    uint8_t ledRgbBuf[WS281X_BYTES_PER_DEVICE * WS281X_PARAM_NUMOF];
    ws281x_params_t ledRgbParam = { .buf = ledRgbBuf, .numof = 1, .pin = GPIO38 };
    ws281x_init(&ledRgb, &ledRgbParam);
    ws281x_prepare_transmission(&ledRgb);
    color_rgb_t ledColOn = {.r = 0xFF, .g = 0x00, .b = 0x00};
    color_rgb_t ledColOff = {.r = 0x00, .g = 0x00, .b = 0x00};

    while(1)
    {
        ws281x_set(&ledRgb, 0, ledColOn);                      // << ERROR 2 >>
        ws281x_prepare_transmission(&ledRgb);
        ws281x_write(&ledRgb);
        delay();
        ws281x_set(&ledRgb, 0, ledColOff);
        ws281x_write(&ledRgb);
        delay();
    }

    return 0;
}

Linker error

<< ERROR 1 >>

If FEATURES_OPTIONAL += periph_timer is set in the makefile, I get this error log at line marked << ERROR 1 >>.

"make" -C /home/picard/riot/RIOT/sys/ztimer
/home/picard/opt/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/picard/riot/examples/blinky/bin/esp32s3-devkit/application_blinky/main.o:(.text.startup.main+0x8): undefined reference to `_xtimer_tsleep'
/home/picard/opt/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/picard/riot/examples/blinky/bin/esp32s3-devkit/application_blinky/main.o: in function `main':
/home/picard/riot/examples/blinky/main.c:84: undefined reference to `_xtimer_tsleep'
/home/picard/opt/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/picard/riot/examples/blinky/bin/esp32s3-devkit/application_blinky/main.o: in function `delay':
/home/picard/riot/examples/blinky/main.c:40: undefined reference to `_xtimer_tsleep'
collect2: error: ld returned 1 exit status
make: *** [/home/picard/riot/RIOT/Makefile.include:740 : /home/picard/riot/examples/blinky/bin/esp32s3-devkit/blinky.elf] Erreur 1

<< ERROR 2 >>

If FEATURES_OPTIONAL += periph_timer is commented out in the makefile, I get this error log at line marked << ERROR 2 >>.

"make" -C /home/picard/riot/RIOT/sys/stdio_uart
/home/picard/opt/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/picard/riot/examples/blinky/bin/esp32s3-devkit/application_blinky/main.o:(.text.startup.main+0x0): undefined reference to `_xtimer_tsleep'
/home/picard/opt/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/picard/riot/examples/blinky/bin/esp32s3-devkit/application_blinky/main.o: in function `main':
/home/picard/riot/examples/blinky/main.c:84: undefined reference to `_xtimer_tsleep'
/home/picard/opt/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/picard/riot/examples/blinky/bin/esp32s3-devkit/application_blinky/main.o: in function `_xtimer_tsleep32':
/home/picard/riot/RIOT/sys/include/xtimer/implementation.h:162: undefined reference to `_xtimer_tsleep'
collect2: error: ld returned 1 exit status
make: *** [/home/picard/riot/RIOT/Makefile.include:740 : /home/picard/riot/examples/blinky/bin/esp32s3-devkit/blinky.elf] Erreur 1

USEMODULE += xtimer was missing in the makefile. The RGB LED still doesn’t light up though…