Skip to content

Define loader writable data startup contract#8

Closed
ericlewis wants to merge 1 commit into
codex/target-specific-addressesfrom
codex/define-loader-runtime-contract
Closed

Define loader writable data startup contract#8
ericlewis wants to merge 1 commit into
codex/target-specific-addressesfrom
codex/define-loader-runtime-contract

Conversation

@ericlewis

Copy link
Copy Markdown
Collaborator

Summary

  • Add explicit .data and .bss sections to the loader linker script.
  • Add linker assertions that fail if writable loader state appears without startup support.
  • Move alignment so an empty .data section does not create fake bytes.

Why

This loader starts without the normal C startup code. That means no one copies .data or clears .bss before it runs. If a future change adds global writable data, it could act wrong on the Playdate. This makes the build stop until startup support exists.

Verification

  • python3 generate_start.py
  • cmake -S . -B /tmp/playbrew-verify-loader-runtime-contract
  • cmake --build /tmp/playbrew-verify-loader-runtime-contract
  • arm-none-eabi-objdump -h /tmp/playbrew-verify-loader-runtime-contract/loaderRevA
  • git diff --check

@ericlewis ericlewis changed the title [codex] Define loader writable data startup contract Define loader writable data startup contract May 10, 2026
@ericlewis ericlewis requested a review from scratchminer May 10, 2026 04:42
@ericlewis ericlewis self-assigned this May 10, 2026
@ericlewis ericlewis added build Build system and compile changes firmware Firmware hooks, patching, and version-specific code labels May 10, 2026
@ericlewis ericlewis marked this pull request as ready for review May 10, 2026 04:44
Why: This loader starts without the normal C startup code. That means no one copies .data or clears .bss before the loader runs. If a future change adds global writable data, it could act wrong on the Playdate. This makes the linker stop the build if that unsafe state is added before real startup support exists.
@ericlewis ericlewis force-pushed the codex/define-loader-runtime-contract branch from 8719545 to 67c1a29 Compare May 10, 2026 05:09
@ericlewis ericlewis changed the base branch from main to codex/target-specific-addresses May 10, 2026 05:10
@ericlewis

Copy link
Copy Markdown
Collaborator Author

Replaced by #17 with the cleaned branch name.

@ericlewis ericlewis closed this May 10, 2026
@ericlewis ericlewis deleted the codex/define-loader-runtime-contract branch May 10, 2026 05:14
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 firmware Firmware hooks, patching, and version-specific code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant