build: expand SIZE_OPTIMISED_SRC to cover init/config/telemetry paths - #1330
build: expand SIZE_OPTIMISED_SRC to cover init/config/telemetry paths#1330nerdCopter wants to merge 11 commits into
Conversation
Adds 41 files to SIZE_OPTIMISED_SRC in make/source.mk, forcing -Os instead of default optimization on cold paths not on the gyro/PID control loop: flash drivers (5), telemetry protocols (12), GPS/ gps_rescue/position (3), rangefinder (3), sensor init (3), display/ IO drivers (10), CMS menus (2), esc_sensor/camera_control/vtx_beesign (3). Build-flag-only change, no source logic modified. Files verified present at listed paths in upstream/master @ 7651c15 (not the issue's original file list, since master may have moved files since filing). Task-rate check in fc/fc_tasks.c confirms TASK_GPS (100Hz), TASK_ALTITUDE (40Hz), TASK_TELEMETRY (250Hz polling) are all below the gyro/PID hot loop. Measured flash delta (arm-none-eabi-size, xpack GCC 9.3.1) vs upstream/master: - HELIOSPRING: -8293 B - TMOTORF7: -7868 B - MATEKF411: -6692 B - WORMFC: -7457 B RAM flat (+/-50 B). make clean && CCACHE_DISABLE=1 make test: 39/39 unit test binaries PASS, 0 warnings, 0 errors. Bench targets (HELIOSPRING TUNERCF405 SKYSTARSF405AIO PYRODRONEF7 FOXEERF722V4 FOXEERF405 APEXF7 TMOTORF7): 8/8 succeeded. Compile-only targets (MATEKF411 NBDHMBF4PRO WORMFC ALIENWHOOPF7 CRAZYFLIE2): 5/5 succeeded. Zero warnings/errors across both sets under CCACHE_DISABLE=1. Closes emuflight#1221 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
ChangesSize-optimized source coverage
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
AI generated comment @coderabbitai review Local |
|
✅ Action performedFull review finished. |
AI Generated pull-request
Closes #1221
Change
Adds 41 files to
SIZE_OPTIMISED_SRCinmake/source.mk, forcing-Osinstead of defaultoptimization on init/config/telemetry paths not on the gyro/PID control loop. Build-flag-only
change — no source logic modified in any listed file.
drivers/flash.c,drivers/flash_m25p16.c,drivers/flash_w25m.c,drivers/flash_w25n.c,drivers/flash_w25q128fv.ctelemetry/telemetry.c,telemetry/crsf.c,telemetry/ghst.c,telemetry/srxl.c,telemetry/frsky_hub.c,telemetry/hott.c,telemetry/jetiexbus.c,telemetry/smartport.c,telemetry/ltm.c,telemetry/mavlink.c,telemetry/msp_shared.c,telemetry/ibus.c,telemetry/ibus_shared.cio/gps.c,flight/gps_rescue.c,flight/position.cdrivers/rangefinder/rangefinder_hcsr04.c,drivers/rangefinder/rangefinder_lidartf.c,sensors/rangefinder.csensors/initialisation.c,sensors/barometer.c,sensors/compass.cio/ledstrip.c,io/pidaudio.c,io/rcdevice.c,io/rcdevice_cam.c,io/displayport_max7456.c,io/displayport_msp.c,io/displayport_hdzero_osd.c,io/displayport_oled.c,io/displayport_srxl.c,io/displayport_crsf.ccms/cms_menu_failsafe.c,cms/cms_menu_gps_rescue.csensors/esc_sensor.c,drivers/camera_control.c,io/vtx_beesign.cAll 41 paths verified present in
upstream/master@7651c15373by direct filesystem check —not taken from the issue's original file list, since master may have moved files since filing.
Why these are safe for
-OsTask-rate check in
fc/fc_tasks.c:TASK_GPS100 Hz,TASK_ALTITUDE40 Hz,TASK_TELEMETRY250 Hz polling — all well below the gyro/PID hot loop (
TASK_GYROPID/TASK_ACCup to 1000 Hz+).GPS rescue only runs during an active rescue, not steady-state flight. None of the added files
are in
SPEED_OPTIMISED_SRC(pid/gyro/imu/mixer/scheduler/rx hot paths, DMA/SPI/timer drivers)and none overlap with the existing
SIZE_OPTIMISED_SRCentries.findstring-based compile-rule matching checked for accidental substring collisions (e.g.drivers/flash.ccannot matchdrivers/flash_m25p16.c— the search requires.cimmediatelyafter
flash); none found.Measured flash/RAM delta
arm-none-eabi-size(xpack GCC 9.3.1, pinned bymake/tools.mk), before =upstream/master@7651c15373, after = this branch. Flash =.text + .data; RAM =.data + .bss.Flash reduction ~6.7-8.3 KB per target — at/slightly above the issue's own 3-8 KB/512KB-target
estimate. RAM flat, as expected (
-Osaffects code gen, not data layout).Build verification
make clean && CCACHE_DISABLE=1 make test: 39/39 unit test binaries PASS, 0 compiler warnings,0 errors. (One pre-existing, unrelated
/usr/bin/ld: ... LOAD segment with RWX permissionswarning appears on host test binaries — confirmed unrelated:
src/test/Makefileusesclangfor host tests and does not reference
SIZE_OPTIMISED_SRCat all.)Bench targets (
HELIOSPRING TUNERCF405 SKYSTARSF405AIO PYRODRONEF7 FOXEERF722V4 FOXEERF405 APEXF7 TMOTORF7): 8/8 succeeded, 0 warnings, 0 errors,CCACHE_DISABLE=1.Compile-only targets (
MATEKF411 NBDHMBF4PRO WORMFC ALIENWHOOPF7 CRAZYFLIE2): 5/5 succeeded,0 warnings, 0 errors,
CCACHE_DISABLE=1.Scope note vs. BF 4.5-maintenance
BF 4.5-maintenance's own
SIZE_OPTIMISED_SRC(mk/source.mk) is narrower — it does not force-Oson telemetry, GPS, rangefinder, flash drivers, displayport drivers,ledstrip.c,pidaudio.c,rcdevice*.c,camera_control.c, orvtx_beesign.c. This change is anEF-original flash-budget optimization (issue #1221), not a BF-parity backport.
Review status
Local
coderabbit review --agent --base upstream/master -c AGENTS.mdhit an external ratelimit on first attempt; not re-run before opening this PR. Self-review performed (see above).
Summary by CodeRabbit