Repository navigation
Build LilyGo T-Lora V2.1 1.6 with -Os again instead of -O0 - #3685
Open
marcelverdult wants to merge 1 commit into
Open
marcelverdult wants to merge 1 commit into
marcelverdult wants to merge 1 commit into
Conversation
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 46216b2, 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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[LilyGo_TLora_V2_1_1_6]invariants/lilygo_tlora_v2_1/platformio.inihasPlatformIO applies
build_unflagsafter merging all build flags, so it removes every-Os: the one the Arduino ESP32 framework passes and the one the variant adds itself. No other-Ois left, so all 9LilyGo_TLora_V2_1_1_6_*environments are compiled at GCC's default-O0. The lines came with #62 ("Configure build environment for optimizing firmware size"); the effect is the opposite.The framework already passes
-Os -ffunction-sections -fdata-sections, as for every other ESP32 board, so this removes both lines.Evidence
On
dev46216b2, before and after this change, PlatformIO 6.2.0:compile_commands.jsonof all 9 environments: before, none of the 269 to 305 translation units per environment has an-Ooption; after, every one has-Os.DW_AT_producerofsrc/Mesh.cpp.o(_repeater): beforeGNU C++11 8.4.0 -mlongcalls -ggdb -std=gnu++11 ..., afterGNU C++11 8.4.0 -mlongcalls -ggdb -Os -std=gnu++11 ....pio run, app partitionmin_spiffs.csv(1966080 bytes):Heltec_v3_repeaterandTbeam_SX1276_repeater, as a control, are unchanged.Stack. #62 also raised
ARDUINO_LOOP_STACK_SIZEto 16384 after crashes while signing. That stays. With-Osthe ed25519 frames shrink a lot (-fstack-usagewith the same compile lines:fe_mul3632 -> 192 bytes,fe_sq2144 -> 144), so stack headroom only grows. Whether the crashes back then came from-O0I have not verified.Not tested on hardware. I do not have a T-Lora V2.1 1.6. This changes the generated code of the whole firmware for these environments, so a boot, advert, receive and send check by someone with the board would be welcome.
Related. #2614 and #1648 change the same file further down (
build_flagsof single environments); no textual conflict with these two lines.