Repository navigation
Description
Description / Steps to reproduce the issue
Bug Description
NuttX fails to build for ESP32-S3 with GCC 15 due to ATOMIC_VAR_INIT being removed from the toolchain.
ATOMIC_VAR_INIT was deprecated in C17 and removed in GCC 15. The esp-hal-3rdparty code pinned by NuttX 13.1 still uses it.
Toolchain
xtensa-esp-elf-gcc (crosstool-NG esp-15.2.0_20251204) 15.2.0- ESP-IDF v6.1
NuttX 13.1 pins ESP_HAL_3RDPARTY_VERSION = b90b1837cb5ad24747deb4c895246037cc206ce5 in arch/xtensa/src/esp32s3/Make.defs.
Error
CC: chip/esp-hal-3rdparty/components/esp_hw_support/esp_gpio_reserve.c
chip/esp-hal-3rdparty/components/esp_hw_support/esp_gpio_reserve.c:13:47: error: implicit declaration of function 'ATOMIC_VAR_INIT'; did you mean 'ATOMIC_FLAG_INIT'? [-Wimplicit-function-declaration]
13 | static _Atomic uint64_t s_reserved_pin_mask = ATOMIC_VAR_INIT(~(SOC_GPIO_VALID_GPIO_MASK));
| ^~~~~~~~~~~~~~~
| ATOMIC_FLAG_INIT
chip/esp-hal-3rdparty/components/esp_hw_support/esp_gpio_reserve.c:13:47: error: initializer element is not constant
make[1]: *** [Makefile:146:chip/esp-hal-3rdparty/components/esp_hw_support/esp_gpio_reserve.o] error 1
make: *** [tools/LibTargets.mk:170:arch/xtensa/src/libarch.a] error 2
Temporary Workaround
Modify arch/xtensa/src/esp32s3/esp-hal-3rdparty/components/esp_hw_support/esp_gpio_reserve.c line 13:
// from
static _Atomic uint64_t s_reserved_pin_mask = ATOMIC_VAR_INIT(~(SOC_GPIO_VALID_GPIO_MASK));
// to
static _Atomic uint64_t s_reserved_pin_mask = ~(SOC_GPIO_VALID_GPIO_MASK);
After this change, the build succeeded.
Suggested Fix
Either bump the pinned ESP_HAL_3RDPARTY_VERSION to a commit that already uses direct initialization, or document that GCC ≤ 14 is required for ESP32-S3.
### On which OS does this issue occur?
[OS: Linux]
### What is the version of your OS?
EndeavourOS Linux 7.2.9-arch1-1
### NuttX Version
releases/13.1
### Issue Architecture
[Arch: xtensa]
### Issue Area
[Area: Board support], [Area: Build System]
### Host information
### Host Info
- OS: Linux x86_64 (Arch)
- Toolchain: `xtensa-esp32s3-elf-gcc (crosstool-NG esp-15.2.0_20251204) 15.2.0`
- ESP-IDF: v6.1
- HAL version: `sync/master.c-nuttx-20260428-24-gb90b1837cb5`
- esptool: 5.6.0
- defconfig: `esp32s3-devkit:nsh`
### Verification
- [x] I have verified before submitting the report.
Activity
arch/espressif: add stdatomic.h shim for ATOMIC_VAR_INIT