Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack optimizations #223

Merged
merged 6 commits into from
May 7, 2023
Merged

Conversation

mthiesen
Copy link
Contributor

@mthiesen mthiesen commented May 7, 2023

I have optimized the stack usage of a lot of functions, as we were having issues with stack overflows recently.

These are the functions I have optimized:

Function Stack usage before Stack usage after
fp_open_custom() 528 48
setCustomTheme() 1680 424
getCustomTheme() 1696 376
setDisplayOptions() 1288 272
getDisplayOptions() 1272 128
setLedOptions() 1856 248
getLedOptions() 1048 80
setAddonOptions() 1600 240
getAddonOptions() 1104 176
getGamepadOptions() 704 208
setGamepadOptions() 760 128
setSplashImage() 1184 168
setPS4Options() 896 128
setPinMappings() 616 328
addStaticThemes() 864 384
Storage::setDefaultSplashImage() 1032 16
ConfigManager::setSplashImage() 1032 8

This should give us a lot more stack space headroom especially in webconfig mode.

Also, I have enabled PICO_USE_STACK_GUARDS in Debug builds to make it easier to find and diagnose stack overflows.

Copy link
Contributor

@arntsonl arntsonl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So fresh, so clean!! This is huge for keeping our memory down and adding new features, thank you!

@arntsonl arntsonl merged commit 8fea035 into OpenStickCommunity:main May 7, 2023
4 checks passed
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.

None yet

2 participants