From 0b9fc84353a07e5f5e6966643f008d30648c16db Mon Sep 17 00:00:00 2001 From: Marcel Verdult Date: Mon, 26 Oct 2026 16:33:44 +0100 Subject: [PATCH] lilygo_tlora_v2_1: build with -Os again instead of -O0 The variant set `build_unflags = -Os` and added `-Os -ffunction-sections -fdata-sections` to `build_flags`. PlatformIO applies build_unflags after merging build_flags, so it removes every -Os, the framework one and the variant one alike. Every translation unit of the 9 LilyGo_TLora_V2_1_1_6_* envs (269 to 305 per env) was compiled without any -O option, i.e. at GCC's default -O0 (checked in compile_commands.json and in DW_AT_producer). The Arduino ESP32 framework already passes -Os -ffunction-sections -fdata-sections, like for every other ESP32 board, so both lines go. Measured on upstream/dev 46216b2d, all 9 envs build: flash -280 KB to -462 KB per env (-23 % to -35 %), companion_radio_ble 97.5 % -> 75.2 % of the app partition, static RAM -48 to -64 bytes. --- variants/lilygo_tlora_v2_1/platformio.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/variants/lilygo_tlora_v2_1/platformio.ini b/variants/lilygo_tlora_v2_1/platformio.ini index dc60b6f75e4..cbc595dc46c 100644 --- a/variants/lilygo_tlora_v2_1/platformio.ini +++ b/variants/lilygo_tlora_v2_1/platformio.ini @@ -1,7 +1,6 @@ [LilyGo_TLora_V2_1_1_6] extends = esp32_base board = ttgo-lora32-v1 ; LILYGO T-LoRa V2.1-1.6 ESP32 with SX1276 -build_unflags = -Os build_type = release ; Set build type to release board_build.partitions = min_spiffs.csv ; get around 4mb flash limit build_flags = @@ -9,7 +8,6 @@ build_flags = ${sensor_base.build_flags} -UENV_INCLUDE_GPS -I variants/lilygo_tlora_v2_1 - -Os -ffunction-sections -fdata-sections ; Optimize for size -D LILYGO_TLORA ; LILYGO T-LoRa V2.1-1.6 ESP32 with SX1276 -D P_LORA_DIO_0=26 ; SX1276 DIO0 interrupt pin -D P_LORA_DIO_1=33 ; SX1276 DIO1 interrupt pin