Skip to content

Commit 7413be3

Browse files
committed
unify the linker GC flags to be used everywhere
We enabled theses flags in most directs more or less directly but with varying inconsistencies. For example native does not have it, but native-tft have it. This makes the native linux build go from 86M to 43M.
1 parent d8ad18f commit 7413be3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

platformio.ini

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ extra_scripts =
2222
; of code is a heap corruption bug!
2323
; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc
2424
; The Radiolib stuff will speed up building considerably. Exclud all the stuff we dont need.
25-
build_flags = -Wno-missing-field-initializers
26-
25+
build_flags =
26+
-Wno-missing-field-initializers
2727
-Wno-format
2828
-Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,"${platformio.build_dir}"/output.map
2929
-DUSE_THREAD_NAMES
@@ -59,6 +59,10 @@ build_flags = -Wno-missing-field-initializers
5959
#-D OLED_PL=1
6060
#-D DEBUG_HEAP=1 ; uncomment to add free heap space / memory leak debugging logs
6161
#-D DEBUG_LOOP_TIMING=1 ; uncomment to add main loop timing logs
62+
-ffunction-sections
63+
-fdata-sections
64+
-Wl,--gc-sections
65+
-Wl,--as-needed
6266

6367
monitor_speed = 115200
6468
monitor_filters = direct

variants/native/portduino/platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ build_type = release
2727
lib_deps =
2828
${native_base.lib_deps}
2929
${device-ui_base.lib_deps}
30-
build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections
30+
build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon
3131
-D RAM_SIZE=16384
3232
-D USE_X11=1
3333
-D HAS_TFT=1
@@ -55,7 +55,7 @@ build_type = release
5555
lib_deps =
5656
${native_base.lib_deps}
5757
${device-ui_base.lib_deps}
58-
build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections -Wl,--gc-sections
58+
build_flags = ${native_base.build_flags} -Os
5959
-D RAM_SIZE=8192
6060
-D USE_FRAMEBUFFER=1
6161
-D LV_COLOR_DEPTH=32

variants/stm32/stm32.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ build_flags =
3030
-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF ; This is REQUIRED for at least traceroute debug prints - without it the length ends up uninitialized.
3131
-DDEBUG_MUTE ; You can #undef DEBUG_MUTE in certain source files if you need the logs.
3232
-fmerge-all-constants
33-
-ffunction-sections
34-
-fdata-sections
3533
-DRADIOLIB_EXCLUDE_SX128X=1
3634
-DRADIOLIB_EXCLUDE_SX127X=1
3735
-DRADIOLIB_EXCLUDE_LR11X0=1

0 commit comments

Comments
 (0)