-
Notifications
You must be signed in to change notification settings - Fork 269
Description
Hi!
I'm working on a LoRa project using the Wireless Stick Lite V3 (ESP32-S3) board with PlatformIO. I've encountered some significant compilation issues that stem from library incompatibility, and I want to share my findings.
Error Description
The current stable version of the Heltec ESP32 Dev-Boards library (2.1.5) fails to compile on modern PlatformIO environments when targeting the Wireless Stick Lite V3 (which uses the ESP32-S3 chip).
The fatal error occurs during the compilation of the radio subsystem (radio.c) when including headers from the current ESP32-S3 SDK (rtc_io.h). The compiler suggests using the modern macro name, confirming the incompatibility:
In file included from .pio/libdeps/lora_test/Heltec ESP32 Dev-Boards/src/radio/radio.c:15:
C:/.../framework-arduinoespressif32/tools/sdk/esp32s3/include/driver/include/driver/rtc_io.h: In function 'rtc_gpio_is_valid_gpio':
C:/.../rtc_io.h:31:24: error: 'GPIO_PIN_COUNT' undeclared (first use in this function); did you mean 'SOC_GPIO_PIN_COUNT'?
return (gpio_num < GPIO_PIN_COUNT && rtc_io_num_map[gpio_num] >= 0);
^~~~~~~~~~~~~~
SOC_GPIO_PIN_COUNT
Root Cause Analysis
The issue stems from a structural change in the official Espressif Arduino Core implemented for newer chips (like the ESP32-S3):
Legacy Macro (Required by Heltec 2.1.5): GPIO_PIN_COUNT
Modern Macro (Defined by SDK): SOC_GPIO_PIN_COUNT
The Heltec library code relies on the deprecated GPIO_PIN_COUNT definition, which no longer exists in the modern SDK headers that PlatformIO downloads for the ESP32-S3 chip.
Workaround (Essential for PlatformIO Users)
To successfully compile the Heltec library version 2.1.5 on recent PlatformIO environments, the following build flags must be added to the project's platformio.ini to manually map the macro:
[env:lora_test]
; ...
build_flags =
; MACRO MAPPING: Solves the undeclared error
-D GPIO_PIN_COUNT=SOC_GPIO_PIN_COUNT