Repository navigation
build: no C++ exceptions or RTTI - #7
Merged
Merged
Conversation
Nothing in the firmware needs them: the games and emulator cores are C, nothing uses dynamic_cast or typeid, and the three exception sites were optional. The terminate handler's rethrow-to-print is under __cpp_exceptions; JK's frame-buffer reserve() checks the heap first instead of catching bad_alloc; OpenJKDF2 1e9b699 parses its settings without throwing (a corrupt file used to terminate the engine). The image is 283 KB smaller (.eh_frame's 169 KB, 66 KB of code, 47 KB of read-only data), all of it PSRAM that code no longer occupies. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ESP-IDF Size Report for 'Tab5 Emu'
FLASH uses app .bin size or json2 flash sum. RAM sums DRAM+IRAM via idf_size. Percentages shown when totals are available. |
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.
Turns off
CONFIG_COMPILER_CXX_EXCEPTIONSandCONFIG_COMPILER_CXX_RTTI. Nothing in the firmware needs them: the games and emulator cores are C, nothing usesdynamic_castortypeid, and the three places that used exceptions didn't need to.Changes
sdkconfig.defaults: both options are off, with a comment explaining why.main/main.cpp: the terminate handler's rethrow-to-print part is compiled only under__cpp_exceptions.components/jk/src/jk.cpp: the frame-bufferreserve()calls check free PSRAM (largest block and total) first, instead of catchingstd::bad_alloc.1e9b699(esp32p4):stdJSONparses settings with nlohmann's non-throwingparse(..., nullptr, false). Before this, a corrupt or truncatedopenjkdf2.jsonterminated the engine; now it reads as empty settings.Size
The image is 283 KB smaller (9,182,032 → 8,892,304 bytes):
.eh_frame: −169 KBWith XIP from PSRAM, all of that is PSRAM the code no longer occupies.
Testing (Tab5)
I ran an autostart soak test of about 8 minutes: Phantom Menace → Jedi Knight → MGS → Chrono Trigger → Minish Cap → Sonic 2 → Jedi Knight → Phantom Menace, wrapping round to TPM and JK again. That was 10 launches, about 45 s each.
sdkconfigthemselves (or delete it), becausesdkconfig.defaultsdoesn't override it.🤖 Generated with Claude Code