diff --git a/platforms/platformio.esp32c2.ini b/platforms/platformio.esp32c2.ini index cda2a13..3a6e628 100644 --- a/platforms/platformio.esp32c2.ini +++ b/platforms/platformio.esp32c2.ini @@ -13,5 +13,32 @@ platform = https://github.com/pioarduino/platform-espressif32/releases/download/ board = esp32-c2-devkitm-1 framework = arduino +; ============================================================ +; SIZE OPTIMIZATION (recommended for production builds) +; ------------------------------------------------------------ +; Drops a Blink-class build ~35-40% by killing the default +; debug-log strings, libstdc++ exception machinery, and +; per-function-section bloat. Comment out (or set +; build_type = debug) when you need verbose logs / exception +; decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +; ============================================================ +build_type = release +build_flags = + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g + lib_deps = FastLED \ No newline at end of file diff --git a/platforms/platformio.esp32c3.ini b/platforms/platformio.esp32c3.ini index 393b17f..61385f6 100644 --- a/platforms/platformio.esp32c3.ini +++ b/platforms/platformio.esp32c3.ini @@ -18,5 +18,32 @@ framework = arduino ; connected — boards powered from a wall adapter then hang in setup() the ; moment user code touches Serial. Leave Serial on the UART (default). +; ============================================================ +; SIZE OPTIMIZATION (recommended for production builds) +; ------------------------------------------------------------ +; Drops a Blink-class build ~35-40% by killing the default +; debug-log strings, libstdc++ exception machinery, and +; per-function-section bloat. Comment out (or set +; build_type = debug) when you need verbose logs / exception +; decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +; ============================================================ +build_type = release +build_flags = + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g + lib_deps = FastLED \ No newline at end of file diff --git a/platforms/platformio.esp32c5.ini b/platforms/platformio.esp32c5.ini index 80dbb88..60e623a 100644 --- a/platforms/platformio.esp32c5.ini +++ b/platforms/platformio.esp32c5.ini @@ -17,9 +17,30 @@ framework = arduino ; 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. +; +; SIZE OPTIMIZATION (lines below the PARLIO flags) drops a Blink-class build +; ~35-40% by killing default debug-log strings, libstdc++ exception machinery, +; and per-function-section bloat. Comment them out (or set build_type = debug) +; when you need verbose logs / exception decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +build_type = release build_flags = -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g lib_deps = FastLED diff --git a/platforms/platformio.esp32c6.ini b/platforms/platformio.esp32c6.ini index 78d7177..201a013 100644 --- a/platforms/platformio.esp32c6.ini +++ b/platforms/platformio.esp32c6.ini @@ -35,9 +35,30 @@ monitor_filters = ; interface, which only enumerates when a USB host is connected — sketches ; that touch Serial in setup() then hang when the board is powered from a ; wall adapter instead of a PC. +; +; SIZE OPTIMIZATION (lines below the PARLIO flags) drops a Blink-class build +; ~35-40% by killing default debug-log strings, libstdc++ exception machinery, +; and per-function-section bloat. Comment them out (or set build_type = debug) +; when you need verbose logs / exception decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +build_type = release build_flags = -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g board_build.flash_mode = dio board_upload.flash_size = 4MB diff --git a/platforms/platformio.esp32dev.ini b/platforms/platformio.esp32dev.ini index 7554e1d..678755b 100644 --- a/platforms/platformio.esp32dev.ini +++ b/platforms/platformio.esp32dev.ini @@ -13,5 +13,37 @@ platform = https://github.com/pioarduino/platform-espressif32/releases/download/ board = esp32dev framework = arduino +; ============================================================ +; SIZE OPTIMIZATION (recommended for production builds) +; ------------------------------------------------------------ +; Without these flags, a FastLED + Arduino-ESP32 build typically +; links a ~600 KB binary because the default Arduino-ESP32 build +; carries CORE_DEBUG_LEVEL=5 (every log string compiled in), +; full libstdc++ exception machinery, and unstripped per-function +; sections. With them you drop ~35-40% (Blink: 631 KB -> 408 KB +; in FastLED's own CI). +; +; Want verbose ESP-IDF logs / exception decoder while developing? +; Comment out the block below OR set build_type = debug. +; +; Reference: https://github.com/FastLED/FastLED/pull/3268 +; ============================================================ +build_type = release +build_flags = + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g + lib_deps = FastLED \ No newline at end of file diff --git a/platforms/platformio.esp32h2.ini b/platforms/platformio.esp32h2.ini index fe4708f..d803c35 100644 --- a/platforms/platformio.esp32h2.ini +++ b/platforms/platformio.esp32h2.ini @@ -17,9 +17,30 @@ framework = arduino ; 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. +; +; SIZE OPTIMIZATION (lines below the PARLIO flags) drops a Blink-class build +; ~35-40% by killing default debug-log strings, libstdc++ exception machinery, +; and per-function-section bloat. Comment them out (or set build_type = debug) +; when you need verbose logs / exception decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +build_type = release build_flags = -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g lib_deps = FastLED diff --git a/platforms/platformio.esp32p4.ini b/platforms/platformio.esp32p4.ini index 0ca70b3..f39a2c0 100644 --- a/platforms/platformio.esp32p4.ini +++ b/platforms/platformio.esp32p4.ini @@ -28,9 +28,30 @@ board_build.partitions = huge_app.csv ; it has no effect on Serial routing while CDC_ON_BOOT=0, so we leave it ; unset here. P4's upstream default is 0 (TinyUSB); C3/C5/C6/H2 force it to ; 1 (HWCDC) via platform.txt. +; +; SIZE OPTIMIZATION (lines below the PARLIO flags) drops a Blink-class build +; ~35-40% by killing default debug-log strings, libstdc++ exception machinery, +; and per-function-section bloat. Comment them out (or set build_type = debug) +; when you need verbose logs / exception decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +build_type = release build_flags = -DCONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 -DCONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g lib_deps = FastLED diff --git a/platforms/platformio.esp32s2.ini b/platforms/platformio.esp32s2.ini index 605e1b8..85a2124 100644 --- a/platforms/platformio.esp32s2.ini +++ b/platforms/platformio.esp32s2.ini @@ -13,5 +13,32 @@ platform = https://github.com/pioarduino/platform-espressif32/releases/download/ board = lolin_s2_mini framework = arduino +; ============================================================ +; SIZE OPTIMIZATION (recommended for production builds) +; ------------------------------------------------------------ +; Drops a Blink-class build ~35-40% by killing the default +; debug-log strings, libstdc++ exception machinery, and +; per-function-section bloat. Comment out (or set +; build_type = debug) when you need verbose logs / exception +; decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +; ============================================================ +build_type = release +build_flags = + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g + lib_deps = FastLED \ No newline at end of file diff --git a/platforms/platformio.esp32s3.ini b/platforms/platformio.esp32s3.ini index c0877d3..41c095b 100644 --- a/platforms/platformio.esp32s3.ini +++ b/platforms/platformio.esp32s3.ini @@ -23,10 +23,36 @@ upload_protocol = esptool ; The exception decoder is a useful tool for debugging that is difficult ; to enable in the Arduino IDE. But in platformio it will decode the ; 0x0f4852c0 addreesses into the actual function names. -monitor_filters = +monitor_filters = default esp32_exception_decoder +; ============================================================ +; SIZE OPTIMIZATION (recommended for production builds) +; ------------------------------------------------------------ +; Drops a Blink-class build ~35-40% by killing the default +; debug-log strings, libstdc++ exception machinery, and +; per-function-section bloat. Comment out (or set +; build_type = debug) when you need verbose logs / exception +; decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +; ============================================================ +build_type = release +build_flags = + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g lib_deps = FastLED diff --git a/platforms/platformio.esp8266.ini b/platforms/platformio.esp8266.ini index 8bbf0ef..9c4cb7c 100644 --- a/platforms/platformio.esp8266.ini +++ b/platforms/platformio.esp8266.ini @@ -13,5 +13,30 @@ platform = espressif8266 board = esp01 framework = arduino +; ============================================================ +; SIZE OPTIMIZATION (recommended for production builds) +; ------------------------------------------------------------ +; ESP8266 is tighter on flash than ESP32 and benefits even more +; from the strip flags. Comment out (or set build_type = debug) +; if you need verbose logs / exception decoding while developing. +; Note: ESP8266 uses NONOS SDK so the ESP-IDF-only +; CORE_DEBUG_LEVEL / ESP_LOG_NONE defines aren't applicable here. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +; ============================================================ +build_type = release +build_flags = + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g + lib_deps = FastLED \ No newline at end of file diff --git a/platforms/platformio.seeed_xiao_esp32s3.ini b/platforms/platformio.seeed_xiao_esp32s3.ini index 7edff01..4382589 100644 --- a/platforms/platformio.seeed_xiao_esp32s3.ini +++ b/platforms/platformio.seeed_xiao_esp32s3.ini @@ -13,5 +13,32 @@ platform = https://github.com/pioarduino/platform-espressif32/releases/download/ board = seeed_xiao_esp32s3 framework = arduino +; ============================================================ +; SIZE OPTIMIZATION (recommended for production builds) +; ------------------------------------------------------------ +; Drops a Blink-class build ~35-40% by killing the default +; debug-log strings, libstdc++ exception machinery, and +; per-function-section bloat. Comment out (or set +; build_type = debug) when you need verbose logs / exception +; decoding while developing. +; Reference: https://github.com/FastLED/FastLED/pull/3268 +; ============================================================ +build_type = release +build_flags = + -DCORE_DEBUG_LEVEL=0 + -DLOG_LOCAL_LEVEL=ESP_LOG_NONE + -Os + -fno-exceptions + -fno-rtti + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -ffunction-sections + -fdata-sections + -flto=auto + -Wl,--gc-sections +build_unflags = + -Og + -g + lib_deps = FastLED \ No newline at end of file