AGENT SKILL

bare-metal

Programming without an OS: startup code (crt0), linker scripts (.ld), memory section placement, and super-loop scheduling

License 许可
MIT
最近更新
2026-11-09
Stars
★ 0
Forks
0

01 前言 Front Matter

name
bare-metal
risk
low
source
https://github.com/Mr-Nobody-Anonymous/All-skills
license
MIT
version
1.0.0
category
embedded
description
Programming without an OS: startup code (crt0), linker scripts (.ld), memory section placement, and super-loop scheduling
imported_at
2026-09-20
source_path
awesome_skills/embedded/bare-metal/SKILL.md
source_repository
Mr-Nobody-Anonymous/All-skills
disable-model-invocation
false

03 SKILL.md 正文

Bare-Metal Embedded Systems

Scope

Bare-metal development programs microcontrollers directly without an operating system, handling startup initialization, linker script layout, and deterministic execution loops.

Low-Level System Mechanics

  • Linker Script (.ld):
    • Defines MEMORY blocks (FLASH, RAM) with origins and lengths.
    • Assigns SECTIONS: .text (code), .rodata (constants), .data (initialized RAM data copied from Flash), .bss (zero-initialized RAM data), stack and heap bounds.
  • Startup Code (crt0.s / startup.c):
    1. Sets initial Stack Pointer ($SP$).
    2. Copies .data from Flash to RAM.
    3. Zeroes the .bss section in RAM.
    4. Calls system clock configuration and jumps to main().
  • Super-Loop Pattern: Foreground interrupt handlers (ISRs) capture high-priority real-time events; background while(1) loop processes accumulated event flags.

Tools & References

  • Tools: GNU Binutils (ld, objdump, readelf, nm), Make/CMake.

04 同仓库更多 Skills