Skip to content

boards/stm32f3: nucleo-f302r8:ihm07m1_b16: enable LTO to fit flash#19454

Merged
jerpelea merged 1 commit into
apache:masterfrom
anjiahao1:nucleo-f302r8-ihm07m1-lto
Jul 16, 2026
Merged

boards/stm32f3: nucleo-f302r8:ihm07m1_b16: enable LTO to fit flash#19454
jerpelea merged 1 commit into
apache:masterfrom
anjiahao1:nucleo-f302r8-ihm07m1-lto

Conversation

@anjiahao1

Copy link
Copy Markdown
Contributor

Summary

  • The nucleo-f302r8:ihm07m1_b16 (FOC motor control) configuration no
    longer links: the image overflows the STM32F302R8 64 KiB flash region
    by ~470 bytes.
  • Enable GNU Full LTO (CONFIG_LTO_FULL=y) for this configuration so
    cross-module dead-code elimination brings the image back under the
    flash limit.

Impact

  • Is new feature added? Is existing feature changed? NO.
  • Impact on user? NO.
  • Impact on build? YES — this config now builds with LTO; link time and
    memory usage increase, but the image fits flash (88% used vs. previous
    overflow).
  • Impact on hardware? NO.
  • Impact on documentation? NO.
  • Impact on security? NO.
  • Impact on compatibility? NO.
  • Anything else? LTO_FULL is marked EXPERIMENTAL in Kconfig; chosen here
    because the config is otherwise unbuildable within 64 KiB.

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host(s): Ubuntu, arm-none-eabi-gcc 12.2.1
  • Target(s): nucleo-f302r8:ihm07m1_b16 (STM32F302R8, 64 KiB flash)
  • Build: ./tools/configure.sh nucleo-f302r8:ihm07m1_b16 && make

Testing logs before change (link fails — flash overflowed):

arm-none-eabi-ld: region `flash' overflowed by 472 bytes
Memory region         Used Size  Region Size  %age Used
           flash:       66008 B        64 KB    100.72%

Testing logs after change (links cleanly with LTO):

Memory region         Used Size  Region Size  %age Used
           flash:       57740 B        64 KB     88.10%
            sram:        5688 B        16 KB     34.72%

PR verification Self-Check

  • This PR introduces only one functional change.
  • I have updated all required description fields above.
  • My PR adheres to Contributing Guidelines and Documentation (git commit title and message, coding standard, etc).
  • My PR is still work in progress (not ready for review).
  • My PR is ready for review and can be safely merged into a codebase.

The ihm07m1_b16 (FOC motor control) configuration overflows the
STM32F302R8 64 KiB flash region by ~470 bytes, so it no longer links.
Enable GNU Full LTO (CONFIG_LTO_FULL=y); cross-module dead-code
elimination brings the image back under the limit (flash drops from
~66.0 KiB to ~57.7 KiB, 88%).

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
@github-actions github-actions Bot added Size: XS The size of the change in this PR is very small Board: arm labels Jul 16, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@jerpelea
jerpelea merged commit 16df6dc into apache:master Jul 16, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Board: arm Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants