From e4273a9313ffd027fd008fdfdcb790b6b002853a Mon Sep 17 00:00:00 2001 From: MarekZegare4 Date: Mon, 22 Jun 2026 17:38:04 +0200 Subject: [PATCH] build(solo): -Os for e-ink + GAT562 30S solo envs to shrink flash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirror the OLED solo size optimisation (44ae2745) on the remaining solo builds so CI artifacts ship the reduced firmware too. The nRF52 Arduino core defaults to -Ofast (≈ -O3 + -ffast-math); overriding with build_unflags = -Ofast + -Os reclaims ~200 KB with no feature loss. E-ink solo: Flash 62.1% (440140 B) GAT562 solo_ble: SUCCESS GAT562 solo_dual: Flash 61.9% (441164 B) Co-Authored-By: Claude Opus 4.8 --- variants/gat562_30s_mesh_kit/platformio.ini | 12 ++++++++++++ variants/wio-tracker-l1-eink/platformio.ini | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/variants/gat562_30s_mesh_kit/platformio.ini b/variants/gat562_30s_mesh_kit/platformio.ini index cf1ba750..d299155a 100644 --- a/variants/gat562_30s_mesh_kit/platformio.ini +++ b/variants/gat562_30s_mesh_kit/platformio.ini @@ -116,6 +116,11 @@ lib_deps = extends = GAT562_30S_Mesh_Kit board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld board_upload.maximum_size = 712704 +; Optimise for size, not speed: the nRF52 Arduino core defaults to -Ofast +; (≈ -O3 + -ffast-math), which bloats flash by ~200 KB on this feature-rich +; solo build. -Os keeps every feature, fits comfortably, and is actually safer +; for float (no fast-math reassociation). Speed is irrelevant for the UI/mesh. +build_unflags = -Ofast build_flags = ${GAT562_30S_Mesh_Kit.build_flags} -I examples/companion_radio/ui-new @@ -130,6 +135,7 @@ build_flags = -D UI_HAS_JOYSTICK_UPDOWN=1 -D ADVERT_NAME='"@@MAC"' -D ENV_INCLUDE_GPS=1 + -Os ; QSPIFLASH disabled: QSPI IO0/IO2 pins (P0.30/P0.28) conflict with joystick LEFT/UP ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -148,6 +154,11 @@ lib_deps = extends = GAT562_30S_Mesh_Kit board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld board_upload.maximum_size = 712704 +; Optimise for size, not speed: the nRF52 Arduino core defaults to -Ofast +; (≈ -O3 + -ffast-math), which bloats flash by ~200 KB on this feature-rich +; solo build. -Os keeps every feature, fits comfortably, and is actually safer +; for float (no fast-math reassociation). Speed is irrelevant for the UI/mesh. +build_unflags = -Ofast build_flags = ${GAT562_30S_Mesh_Kit.build_flags} -I examples/companion_radio/ui-new @@ -164,6 +175,7 @@ build_flags = -D ENV_INCLUDE_GPS=1 -D DUAL_SERIAL=1 -D ENABLE_SCREENSHOT + -Os ; QSPIFLASH disabled: QSPI IO0/IO2 pins (P0.30/P0.28) conflict with joystick LEFT/UP ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 diff --git a/variants/wio-tracker-l1-eink/platformio.ini b/variants/wio-tracker-l1-eink/platformio.ini index d95ce9ce..9570b259 100644 --- a/variants/wio-tracker-l1-eink/platformio.ini +++ b/variants/wio-tracker-l1-eink/platformio.ini @@ -72,9 +72,15 @@ extra_scripts = post:create-uf2.py ; Dual BLE+USB with added Solo [env:WioTrackerL1Eink_companion_solo_dual] extends = WioTrackerL1Eink +; Optimise for size, not speed: the nRF52 Arduino core defaults to -Ofast +; (≈ -O3 + -ffast-math), which bloats flash by ~200 KB on this feature-rich +; solo build. -Os keeps every feature, fits comfortably, and is actually safer +; for float (no fast-math reassociation). Speed is irrelevant for the UI/mesh. +build_unflags = -Ofast build_flags = ${WioTrackerL1Eink.build_flags} -D DUAL_SERIAL=1 -D ENABLE_SCREENSHOT + -Os extra_scripts = post:create-uf2.py ; Dual BLE+USB with screenshot support (development/debug)