Repository navigation
Libraries: link CHGfx, CHGame and CHSd from archives - #20
Merged
Merged
Conversation
A developer using board package 0.3.0 for the sound engine and the buttons only, with their own display code, found every sketch that includes CHGame.h carrying CHGfx's 8 KB framebuffer, its chunk buffers and its SRAM converters. Arduino links a library's objects whole, and CHGfx.cpp's strong DMA1_Channel3_IRQHandler replaces the core's weak default, so the vector table keeps the handler and the handler keeps the framebuffer, drawing or not. dot_a_linkage=true in the three library.properties links each library from an archive, where an object is pulled in only when something calls into it. The audio-only sketch takes 352 B of static RAM instead of 9,712 B. The two hooks the libraries override (that handler, and osSystickHandler in Audio.cpp) sit in the same objects as gfx_begin() and audio::begin(), so a sketch that uses a feature always gets them. All 20 games' and 3 apps' release images are byte-identical with and without the flag; plain riscv-none-embed-ar indexes GCC 8's slim LTO objects, so the -Os -flto builds need no gcc-ar. The simulator does not read the flag. Recorded in board/CHANGELOG.md (Unreleased), platform/README.md, the CHGame README's RAM note and CHGame.h's header comment. Co-Authored-By: Claude Fable 5.1 <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 changed
dot_a_linkage=truein thelibrary.propertiesof CHGfx, CHGame and CHSd, so each library links from an archive and an object of it is pulled in only when the sketch calls into it. Recorded inboard/CHANGELOG.md(Unreleased),platform/README.md, the CHGame README's RAM note andCHGame.h's header comment.Why
A developer using board package 0.3.0 for
audio::andchgame_readButtons()only, with their own display code, found every sketch that includesCHGame.hcarrying CHGfx's 8 KB framebuffer, its chunk buffers and its SRAM converters. Confirmed: Arduino links a library's objects whole, andCHGfx.cpp's strongDMA1_Channel3_IRQHandlerreplaces the core's weak default, so the vector table keeps the handler and the handler keeps the framebuffer, drawing or not.For the reviewer
.binbyte-identical for all 23.osSystickHandlerinAudio.cpp) sit in the same objects asgfx_begin()andaudio::begin(), so a sketch that uses the feature always gets them. Verified in the archive build's disassembly that the SysTick handler still calls the audio code.-Os -fltobuilds produce slim LTO objects; plainriscv-none-embed-arindexes them, so the link pulls the right members with no warning and nogcc-aris needed.CHGameAudio.h, does nothing on its own (arduino-cli compiles every.cppof a discovered library, andDraw.cppincludes CHGfx.h); with the flag,#include <CHGame.h>already costs nothing. Not added.Multiple libraries were found for "CHGfx.h".🤖 Generated with Claude Code