Skip to content

Generate loader startup include during build#10

Open
ericlewis wants to merge 3 commits into
mainfrom
generate-start-inc-cmake
Open

Generate loader startup include during build#10
ericlewis wants to merge 3 commits into
mainfrom
generate-start-inc-cmake

Conversation

@ericlewis

Copy link
Copy Markdown
Collaborator

Summary

  • Let generate_start.py write to an optional output path.
  • Generate start.inc inside the CMake build directory.
  • Add that generated include directory to both loader targets.

Why

A new checkout does not have src/loader/start.inc because that file is generated and ignored by git. The loader still needs it to compile. This makes CMake run the generator so people do not need to know a hidden manual step.

Verification

  • rm -f src/loader/start.inc
  • cmake -S . -B /tmp/playbrew-verify-generate-start-inc-cmake
  • cmake --build /tmp/playbrew-verify-generate-start-inc-cmake
  • test ! -e src/loader/start.inc
  • git diff --check

ericlewis added 2 commits May 10, 2026 00:33
Why: A new checkout did not have src/loader/start.inc because that file is generated and ignored by git. The loader still needs that file to compile, so the build failed unless someone knew to run a Python script first. This makes CMake run the generator and use the generated file from the build folder.
Why: The loader runs in the middle of Playdate firmware code. The firmware still needs its saved CPU values after the loader runs. Before this change, the loader call could change those values and make the firmware jump back to the wrong place or use the wrong inputs. This saves the important values, runs the loader, restores them, and then goes back to firmware.
@ericlewis ericlewis added build Build system and compile changes tooling Developer scripts and workflow tooling labels May 10, 2026
Preserve firmware state in startup trampoline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build system and compile changes tooling Developer scripts and workflow tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants