Repository navigation
Save 8 to 17 KB of flash on ESP32 boards - #11629
Open
mikeysklar wants to merge 1 commit into
Open
mikeysklar wants to merge 1 commit into
mikeysklar wants to merge 1 commit into
Conversation
CircuitPython never enables CONFIG_COMPILER_CXX_EXCEPTIONS (IDF default n). In that case IDF's cxx component wraps libgcc's unwinder and libstdc++'s throw entry points with stubs that abort, so C++ code such as nvs_flash does not pull in libgcc's unwinder. CircuitPython lists IDF components by hand and left cxx out, so the unwinder was linked anyway. The existing -u __cxx_init_dummy and -u __cxa_guard_dummy flags also matched nothing (ld does not error on an unresolved -u). Add cxx to the component list and pass the same --wrap list as esp-idf/components/cxx/CMakeLists.txt. Linking cxx also brings in cxx_init.cpp, which sets the libstdc++ emergency exception pool to 0. Feather ESP32-C6: 15,872 bytes less flash, 160 bytes less static RAM. Metro ESP32-S3: 8,592 bytes less flash, 32 bytes less static RAM. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
What
ESP32 boards no longer carry C++ error handling code that can never run.
Why
It frees flash.
C++ exceptions are already off, but the code to handle them was still linked.
nvmsurvives reset, wifi, soft reset_bleioscan, C6 / S3The other boards were built, not run.
Written with Claude Code, which also ran the tests above. I reviewed the code and this description.
🤖 Generated with Claude Code