Skip to content

UEFI target groundwork: runtime: split baremetal memory setup#5360

Merged
deadprogram merged 3 commits into
tinygo-org:devfrom
sparques:pr/runtime-baremetal-memory
Jun 6, 2026
Merged

UEFI target groundwork: runtime: split baremetal memory setup#5360
deadprogram merged 3 commits into
tinygo-org:devfrom
sparques:pr/runtime-baremetal-memory

Conversation

@sparques

@sparques sparques commented May 1, 2026

Copy link
Copy Markdown
Contributor

I am back with another attempt trying to get UEFI as a target.

Summary:

This PR moves baremetal-specific memory symbol declarations and initialization out of src/runtime/baremetal.go into a separate file, src/runtime/baremetal_memory.go.

The extracted code covers:

  • _heap_start / _heap_end
  • _globals_start / _globals_end
  • _stack_top
  • the default growHeap() implementation for baremetal targets

Why:

baremetal.go currently mixes general baremetal runtime behavior with the default linker-symbol-based memory layout. Splitting the memory setup into its own file makes that boundary explicit and makes it easier for targets with nonstandard memory initialization to evolve without adding more special cases to the main baremetal runtime file.
For my purposes, eventually baremetal_memory.go will have a //go:build baremetal && !uefi or something to that effect.

Behavior:

This is intended to be a pure refactor. There should be no functional change for existing baremetal targets.

@deadprogram

Copy link
Copy Markdown
Member

@sparques can you please rebase this against the latest dev branch? Thanks.

@deadprogram

Copy link
Copy Markdown
Member

Thanks for your work on this @sparques seems like a good direction. Now squash/merging.

@deadprogram
deadprogram merged commit 7b3dc19 into tinygo-org:dev Jun 6, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants