linker-scripts

Write and modify GNU ld linker scripts for embedded targets.

159|20|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/mohitmishra786/low-level-dev-skills --skill linker-scripts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: linker-scripts
Source: https://github.com/mohitmishra786/low-level-dev-skills/tree/main/skills/embedded/linker-scripts
Command: npx skills add https://github.com/mohitmishra786/low-level-dev-skills --skill linker-scripts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you understand, write, and debug linker scripts for embedded systems, ensuring your code and data are placed precisely where they need to be in memory.

Core Features & Use Cases

  • Linker Script Creation: Guides you through defining memory regions, sections, and symbol placement.
  • VMA vs. LMA Understanding: Explains the difference and how to manage load and runtime addresses.
  • Startup Initialization: Details how .data and .bss sections are initialized.
  • Use Case: You need to place a critical interrupt handler in fast internal RAM on an STM32 microcontroller. This Skill will show you how to define a custom section and attribute the handler to it.

Quick Start

Use the linker-scripts skill to generate a basic linker script for an STM32F4 microcontroller with 512KB of Flash and 128KB of RAM.

Frequently Asked Questions about linker-scripts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a GNU ld linker script for an embedded bare-metal target?

To write a GNU ld linker script for embedded bare-metal targets, you use the MEMORY and SECTIONS commands to define memory regions and place code. Directives like PROVIDE, KEEP, and ALIGN help control symbol placement and section boundaries.

What is the difference between VMA and LMA in a linker script?

VMA (Virtual Memory Address) is where the section runs at runtime, while LMA (Load Memory Address) is where it is loaded. Managing VMA vs LMA correctly in a linker script is essential for code relocation in embedded systems.

How do I place a specific function in fast internal RAM using a linker script?

To place a function in fast internal RAM, you define a custom memory region in the linker script and attribute the function to that section. This ensures critical code, like an interrupt handler on an STM32, is placed precisely where needed.

How does startup code initialize .bss and .data sections?

Startup code initializes .bss and .data sections by copying initialized data from flash to RAM and zeroing the .bss section. The linker script defines the section boundaries and symbols needed for this startup initialization process.

When do I need to use the KEEP directive in a linker script?

You use the KEEP directive in a linker script when you need to prevent the garbage collector from removing seemingly unused sections. This is crucial for retaining specific startup code or interrupt vector tables in embedded bare-metal projects.