Skip to content

How to build for ESP32-C6 #32

@riwalker

Description

@riwalker

Subject: Technical Considerations for ESP32-C6 Support
I’ve been working on a local port for the ESP32-C6 and wanted to share some specific hardware and library constraints that will need to be addressed for a stable C6 release:

Socket Limitations: The ESP32-C6 (RISC-V) currently has a limit of 8 concurrent sockets. Given that ESPixelStick manages the Web UI, MQTT, and real-time protocols (E1.31/DDP/Art-Net), we may need a more aggressive socket-recycling strategy or priority handling to prevent E1.31 packet loss when the Web UI is active.

Task Priorities: The C6 priority ceiling is lower than the Xtensa-based ESP32, capping at 15 or 16. The internal task scheduler will need to be mapped accordingly to ensure pixel output remains at the highest available priority (15) without conflicting with the WiFi stack.

ESP-IDF 5.x / Arduino 3.0 Compatibility: The C6 requires the newer toolchain, which introduces breaking changes in the core libraries:

Header Paths: Standard paths for md5.h have moved to rom/md5_hash.h.

SHA1: Implementation for WebSockets needs to transition to ESP32SHA1.h for the RISC-V architecture.

Semaphore Handling: The MQTT and AsyncTCP libraries require explicit inclusion of freertos/FreeRTOS.h and freertos/semphr.h to resolve _xSemaphore errors during compilation.

RMT Peripheral: The RMT hardware on the C6 differs from the original ESP32. Driving pixels will require the updated RMT driver (v5.x API) or the abstraction provided by Arduino 3.0.

Compiler Flags: For the build to succeed, -D ESP32 and -D ARDUINO_ARCH_ESP32 must be explicitly forced in the environment, as many downstream libraries (AsyncTCP/Mqtt) do not yet natively recognize the __riscv definition as an ESP32 variant.

I have been able to get a build to compile by patching ESPAsyncWebServer and AsyncMqttClient manually, but a formal integration would likely benefit from moving toward the newer maintained forks of the Async libraries that support the RISC-V/IDF 5.x chips.

I have tried and tried and tried.
PLEASE, PLEASE provide the platformio.ini or platformio_user.ini
i tried several ways but coudl not find the right mix.
i had to delete files, change code, and it became Whac-A-Mole of errors.
please help

I had tried the following, and variations of it:
`[env:esp32_devkitc6]
platform = https://github.com/pioarduino/platform-espressif32.git
board = esp32-c6-devkitc-1
framework = arduino

build_unflags =
-mtext-section-literals
-D ESP32

lib_deps =
; Use the standard branch, we will fix it with flags below
https://github.com/MartinMueller2003/ESPAsyncE131.git
adafruit/Adafruit PWM Servo Driver Library @ ^2.4.0
bblanchon/ArduinoJson @ ^7.3.0
djgrrr/Int64String @ ^1.1.1
https://github.com/greiman/SdFat @ ^2.3.0
https://github.com/MartinMueller2003/ESPAsyncTCP
https://github.com/MartinMueller2003/ESPAsyncWebServer
https://github.com/marvinroger/async-mqtt-client @ ^0.9.0
https://github.com/paulstoffregen/Time @ ^1.6.1

build_flags =
${env.build_flags}
-D BOARD_NAME='"esp32 devkitc6"'
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
-DUART_SCLK_APB=UART_SCLK_DEFAULT
; Fixes for C6 RISC-V / Arduino v3
-D ARDUINO_ARCH_ESP32
-D SOC_RMT_CHANNELS=4
-D portSET_INTERRUPT_MASK_FROM_ISR=0
-D __STDC_LIMIT_MACROS`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions