aboutsummaryrefslogtreecommitdiff
path: root/linker/linker_script.ld
blob: 9a9f5b3b3e72cb60f21ebb5d8c8e72e02cb8450d (plain) (blame)
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
MEMORY
{
  flash : org = 0x08000000, len = 256k
  sram1 : org = 0x20000000, len = 48k
  sram2 : org = 0x10000000, len = 16k
}

SECTIONS
{
  /* This is where the code goes. */
  . = ORIGIN(flash);
  .text : {
    *(.vectors); /* All .vector sections go here. */
    *(.text);    /* All .text sections go here. */
  } >flash

  .data : {
    /* Data segment as defined in the flash. */
    INIT_DATA_VALUES = LOADADDR(.data);

    /* Data segment where it will be in memory. */
    DATA_SEGMENT_START = .;
    *(.data);
    DATA_SEGMENT_STOP = .;

    INIT_ROUTINES_FLASH_START =
       LOADADDR(.data) + (DATA_SEGMENT_STOP - DATA_SEGMENT_START);

    INITS_START = .;
    *(.init0);
    *(.init1);
    *(.init2);
    *(.init3);
    *(.init4);
    *(.init5);
    *(.init6);
    *(.init7);
    INITS_END = .;

    INIT_ROUTINES_FLASH_STOP =
       LOADADDR(.data) + (INITS_END - DATA_SEGMENT_START);

    /* Align by 4 so we can optimize the copier to use uint32's. */
    . = ALIGN(0x04);

    *(.noinit);
  } >sram1 AT>flash

  BSS_START = .;
  .bss : {
    *(.bss);
    . = ALIGN(0x04);
  } > sram1
  BSS_END = .;
}