image.png

Memory Model

  1. Flash Memory :
  2. SRAM :

Linker Script

The script has 4 features:

Memory

MEMORY
{
    name [(attr)] : ORIGIN = origin, LENGTH = len
    …
}

E.g.

MEMORY
{
    FLASH(rx) : ORIGIN = 0x08000000, LENGTH = 512K
    SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}

Sections

SECTIONS
{
    …
}

E.g.

SECTIONS
{
    .text :
    {
        *(.text)   /* merge all .text sections of input files */
    }> FLASH
}

Sections (cont.)

The 3 relevant sections:

Startup Code

Contains:

  1. Reset Handler
  2. Interrupt Vector Table

VMA and LMA

Getting familiar with the script (cont.)