[ESP-IDF5.1] Fix ESP32-classic and -S3 build become larger using LTO

See this explanation about `text-section-literals`: https://stackoverflow.com/questions/19532826/what-does-a-dangerous-relocation-error-mean
This commit is contained in:
TD-er
2023-11-28 17:11:36 +01:00
parent a218cf2501
commit 47ea77a226
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -45,6 +45,10 @@ extra_scripts = post:tools/pio/post_esp32.py
; fix the platform package to use gcc-ar and gcc-ranlib to enable lto linker plugin
; more detail: https://embeddedartistry.com/blog/2020/04/13/prefer-gcc-ar-to-ar-in-your-buildsystems/
; pre:tools/pio/apply_patches.py
; When using LTO, make sure NOT to use -mtext-section-literals
; -mtext-section-literals may be required when building large builds
; However LTO cannot optimize builds with text section literals and thus will result in quite a lot larger builds (80k - 140k larger)
build_unflags = -Wall
-fno-lto
build_flags = ${core_esp32_IDF5_1__3_0_0.build_flags}
@@ -100,9 +104,10 @@ build_unflags = ${esp32_base.build_unflags}
[esp32_common_LittleFS]
extends = esp32_base_idf5
build_flags = ${esp32_base_idf5.build_flags}
-mtext-section-literals
; -mtext-section-literals
-DESP32_CLASSIC
-DUSE_LITTLEFS
build_unflags = ${esp32_base_idf5.build_unflags}
extra_scripts = ${esp32_common.extra_scripts}
board_build.filesystem = littlefs
lib_ignore = ${esp32_always.lib_ignore}
+1 -1
View File
@@ -22,7 +22,7 @@ lib_ignore = ${esp32_common_LittleFS.lib_ignore}
ESP32_ping
${esp32_base_idf5.lib_ignore}
build_flags = ${esp32_base_idf5.build_flags}
-mtext-section-literals
; -mtext-section-literals
-DFEATURE_ARDUINO_OTA=1
-DUSE_LITTLEFS
-DESP32S3