From 0b8e6c08d923b0287d41cddf24c2db7bda15891a Mon Sep 17 00:00:00 2001 From: zackees Date: Fri, 19 Jun 2026 18:04:26 -0700 Subject: [PATCH] feat(platforms): add PARLIO ISR-IRAM flags for ESP32 C5/C6/H2/P4 Add the two required PARLIO TX ISR build flags (CONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM and CONFIG_PARLIO_TX_ISR_CACHE_SAFE) to every ESP32 chip whose SoC capabilities expose PARLIO. Without these flags the FastLED PARLIO driver's TX ISR sits in flash and takes cache-miss stalls during execution, silently corrupting LED timing. - Update esp32c5, esp32c6, esp32h2 envs with the PARLIO flags and bump their pioarduino platform-package to 55.03.35 for consistency. - Add a new esp32p4 env with the PARLIO flags, huge_app partitions and ARDUINO_USB_MODE=1. - Add a comment block next to the flags pointing future maintainers at FastLED src/platforms/esp/32/drivers/parlio/ as the canonical PARLIO-capable chipset list, so the env list stays in sync if new PARLIO-capable chips appear. S3 / C3 / C2 / S2 / original-ESP32 envs are intentionally left without the PARLIO flags; those chips don't have the peripheral and the flags would falsely imply they do. Closes #9 Co-Authored-By: Claude Opus 4.7 (1M context) --- platforms/platformio.esp32c5.ini | 12 ++++++++++-- platforms/platformio.esp32c6.ini | 15 +++++++++------ platforms/platformio.esp32h2.ini | 12 ++++++++++-- platforms/platformio.esp32p4.ini | 27 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 platforms/platformio.esp32p4.ini diff --git a/platforms/platformio.esp32c5.ini b/platforms/platformio.esp32c5.ini index 762ab1d..80dbb88 100644 --- a/platforms/platformio.esp32c5.ini +++ b/platforms/platformio.esp32c5.ini @@ -9,9 +9,17 @@ ; https://docs.platformio.org/page/projectconf.html [env:esp32c5] -platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.30-2/platform-espressif32.zip +platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.35/platform-espressif32.zip board = esp32-c5-devkitc-1 framework = arduino +; PARLIO ISR flags: only set on chips with the PARLIO peripheral (C5/C6/H2/P4). +; Without these the FastLED PARLIO TX ISR sits in flash and takes cache-miss +; stalls during execution, silently corrupting LED protocol timing. +; See FastLED src/platforms/esp/32/drivers/parlio/ for the canonical chipset list. +build_flags = + -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 + -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + lib_deps = - FastLED \ No newline at end of file + FastLED diff --git a/platforms/platformio.esp32c6.ini b/platforms/platformio.esp32c6.ini index 7dfd8f2..c593d3c 100644 --- a/platforms/platformio.esp32c6.ini +++ b/platforms/platformio.esp32c6.ini @@ -10,13 +10,10 @@ [env:esp32c6] ; the esp32c6 part can be renamed to anything you want. -; Note that this special platform override is used to bring in the -; idf5.1 toolchain that is now included in Arduino 2.3.1+, and may -; not be necessary in the near future. -platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip +platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.35/platform-espressif32.zip framework = arduino -; This is a popular ESP32-S3 board. board = esp32-c6-devkitc-1 +board_build.partitions = huge_app.csv upload_protocol = esptool monitor_speed = 115200 @@ -29,8 +26,14 @@ monitor_filters = default esp32_exception_decoder -; ---- CRITICAL: enable USB CDC serial ---- +; PARLIO ISR flags: only set on chips with the PARLIO peripheral (C5/C6/H2/P4). +; Without these the FastLED PARLIO TX ISR sits in flash and takes cache-miss +; stalls during execution, silently corrupting LED protocol timing. +; See FastLED src/platforms/esp/32/drivers/parlio/ for the canonical chipset list. build_flags = + -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 + -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + ; ---- CRITICAL: enable USB CDC serial ---- -D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 diff --git a/platforms/platformio.esp32h2.ini b/platforms/platformio.esp32h2.ini index dedd82c..fe4708f 100644 --- a/platforms/platformio.esp32h2.ini +++ b/platforms/platformio.esp32h2.ini @@ -9,9 +9,17 @@ ; https://docs.platformio.org/page/projectconf.html [env:esp32h2] -platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10/platform-espressif32.zip +platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.35/platform-espressif32.zip board = esp32-h2-devkitm-1 framework = arduino +; PARLIO ISR flags: only set on chips with the PARLIO peripheral (C5/C6/H2/P4). +; Without these the FastLED PARLIO TX ISR sits in flash and takes cache-miss +; stalls during execution, silently corrupting LED protocol timing. +; See FastLED src/platforms/esp/32/drivers/parlio/ for the canonical chipset list. +build_flags = + -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 + -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + lib_deps = - FastLED \ No newline at end of file + FastLED diff --git a/platforms/platformio.esp32p4.ini b/platforms/platformio.esp32p4.ini new file mode 100644 index 0000000..7b81f03 --- /dev/null +++ b/platforms/platformio.esp32p4.ini @@ -0,0 +1,27 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32p4] +platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.35/platform-espressif32.zip +board = esp32-p4-evboard +framework = arduino +board_build.partitions = huge_app.csv + +; PARLIO ISR flags: only set on chips with the PARLIO peripheral (C5/C6/H2/P4). +; Without these the FastLED PARLIO TX ISR sits in flash and takes cache-miss +; stalls during execution, silently corrupting LED protocol timing. +; See FastLED src/platforms/esp/32/drivers/parlio/ for the canonical chipset list. +build_flags = + -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 + -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + -DARDUINO_USB_MODE=1 + +lib_deps = + FastLED