Repository navigation
boards: free flash in the STM32G431 cansock and stm32l0538-disco:nsh configurations - #22081
Merged
Merged
Conversation
nucleo-g431rb:cansock and b-g431b-esc1:cansock use 130600 of the 131072 bytes of flash, and ordinary changes in core components push them over the limit. Disable the dd tool, which the SocketCAN demo does not use, and the per-thread copies of emulated TLS variables, which no code in these images uses. This frees about 3.7 KB. NET_STATISTICS and the CAN tools are kept. Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
The configuration already uses full LTO and uses 64760 of the 65536 bytes of flash, so ordinary changes in core components push it over the limit. Disable the NSH alias command and the per-thread copies of emulated TLS variables, which no code in this image uses. Also enable LIBC_ATOMIC_NOINLINE: the atomic operations then disable and restore the interrupts in one copy of each function instead of an inline sequence at every call. Together this frees 3288 bytes. Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
zyfeier
marked this pull request as ready for review
November 20, 2026 02:18
zyfeier
requested review from
Donny9,
raiden00pl and
xiaoxiang781216
as code owners
November 20, 2026 02:18
GUIDINGLI
approved these changes
Nov 20, 2026
xiaoxiang781216
approved these changes
Nov 20, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three small-flash configurations are within a few hundred bytes of
their limit on master, so ordinary changes in core components make the
Linux (arm-stm32l-u-g)CI job fail on unrelated PRs:For example,
nucleo-g431rb:cansockoverflows by 88 bytes in the CI ofan open PR that only changes the scheduler.
This PR disables features these configurations do not need, so each of
them gets about 4 KB of headroom:
ddtool, which the SocketCANdemo does not use, and
TLS_EMUTLS.NET_STATISTICSand the CANtools (
candump,cansend) are kept.aliascommand andTLS_EMUTLS, and enableLIBC_ATOMIC_NOINLINE(added in libc/machine: add an option to not inline the atomic functions #22053) sothat the interrupt-disabling atomic operations are built once instead
of inlined at every call.
TLS_EMUTLSonly gives per-thread copies of__threadvariables. Noneof these images has any:
nmfinds no__emutls_v.*symbol, sodisabling it changes no behavior.
Impact
ddis no longer in the two cansock configurations, andaliasis no longer instm32l0538-disco:nsh. No other command orfeature changes.
Testing
Host: Ubuntu, Arm GNU Toolchain 13.2.Rel1 (the CI version), master
ed12237. make builds use
EXTRAFLAGS="-Wno-cpp -Werror"as in CI.The CMake builds that CI runs also link:
nucleo-g431rb:cansock127040 B,
stm32l0538-disco:nsh61520 B.make savedefconfiggives no diff for the three configurations, andtools/checkpatch.sh -c -u -m -gpasses.Not tested on hardware.