Skip to content

Define loader writable data startup contract#17

Open
ericlewis wants to merge 1 commit into
target-specific-addressesfrom
define-loader-runtime-contract
Open

Define loader writable data startup contract#17
ericlewis wants to merge 1 commit into
target-specific-addressesfrom
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

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 added firmware Firmware hooks, patching, and version-specific code build Build system and compile changes labels May 10, 2026
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