Skip to content

shave off 5544 bytes with LTO#13

Draft
H3wastooshort wants to merge 1 commit into
atomozero:mainfrom
H3wastooshort:patch-LTO
Draft

shave off 5544 bytes with LTO#13
H3wastooshort wants to merge 1 commit into
atomozero:mainfrom
H3wastooshort:patch-LTO

Conversation

@H3wastooshort

@H3wastooshort H3wastooshort commented Jul 21, 2026

Copy link
Copy Markdown

I have messed around with the original MeshCore firmware, trying to fit it into the PSoC4's memory. I that process, I have managed to make Link-Time Optimization work, by marking some internal functions as "used", so they don't get removed. This saves about 5kB on this project, but needs my slightly modified fork of CubeCell-Arduino. Feel free to fork my fork, if you intend to merge this.

before:

RAM:   [=====     ]  52.4% (used 8584 bytes from 16384 bytes)
Flash: [==========]  99.5% (used 130432 bytes from 131072 bytes)

with LTO:

RAM:   [=====     ]  51.6% (used 8448 bytes from 16384 bytes)
Flash: [==========]  95.3% (used 124888 bytes from 131072 bytes)

As i have not tested these changes in production, I am keeping this a Draft for now.

@H3wastooshort
H3wastooshort marked this pull request as draft July 21, 2026 16:03
@H3wastooshort

Copy link
Copy Markdown
Author

testing on real hardware sadly results in a bootloop with LTO enabled.
my CubeCell-Arduino Fork also strips out some unused SX1262 driver code though. This shaves off 520 bytes of flash.

stock CubeCell-Arduino

RAM:   [=====     ]  52.4% (used 8584 bytes from 16384 bytes)
Flash: [==========]  99.6% (used 130504 bytes from 131072 bytes)

my fork

RAM:   [=====     ]  51.3% (used 8408 bytes from 16384 bytes)
Flash: [==========]  99.2% (used 129984 bytes from 131072 bytes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant