aboutsummaryrefslogtreecommitdiffhomepage
path: root/targets/avr.ld
blob: 293a06d7d325157dc60f1a21b7ec7b63abbd4c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

MEMORY
{
    FLASH_TEXT (rw) : ORIGIN = 0,                      LENGTH = __flash_size - _bootloader_size
    RAM (xrw)       : ORIGIN = 0x800000 + __ram_start, LENGTH = __ram_size
}

ENTRY(main)

SECTIONS
{
    .text :
    {
        KEEP(*(.vectors))
        KEEP(*(.text.__vector_RESET))
        KEEP(*(.text.main)) /* main must follow the reset handler */
        *(.text)
        *(.text.*)
        *(.progmem)
        *(.progmem.*)
        . = ALIGN(16); /* needed with ld.lld for some reasoon */
    }

    .stack (NOLOAD) :
    {
        . += _stack_size;
        _stack_top = .;
    } >RAM

    _sidata = LOADADDR(.data);

    .data :
    {
        _sdata = .;        /* used by startup code */
        *(.rodata)
        *(.rodata.*)
        *(.data)
        *(.data*)
        _edata = .;        /* used by startup code */
    } >RAM AT>FLASH_TEXT

    .bss :
    {
        _sbss = .;         /* used by startup code */
        *(.bss)
        *(.bss*)
        *(COMMON)
        _ebss = .;         /* used by startup code */
    } >RAM
}

/* For the memory allocator. */
_heap_start = _ebss;
_heap_end = ORIGIN(RAM) + LENGTH(RAM);
_globals_start = _sdata;
_globals_end = _ebss;