aboutsummaryrefslogtreecommitdiff
path: root/linker/ls.ld
blob: 916438baf4e8d250daba372cf15d516851a6c3c8 (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
MEMORY
{
  flash : org = 0x00000000, len = 512k
  sram : org = 0x20003800, len = 18k
}

SECTIONS
{
  . = ORIGIN(flash);

  .text : ALIGN(0x04) {
    *(.sinit);
    *(.sinit.1);

    /* The ch573 starts execution at address 0x0000, so we have to make sure the
     * on_reset function is put at the beginning of the flash. */
    *(.isr_routines.on_reset);

    /* The rest of the code. */
    *(.text);
  } >flash AT>flash

  ISR_VECTOR_IN_FLASH = LOADADDR(.isr_vector);
  .isr_vector : ALIGN(0x04) {
    ISR_VECTOR_START = .;
    *(.isr_vector);
    *(.isr_vector.routines);
    ISR_VECTOR_STOP = .;
  } >sram AT>flash

  DATA_VALUES_IN_FLASH = LOADADDR(.data);
  .data : ALIGN(0x04) {
    . = ALIGN(0x04);
    DATA_SEGMENT_START = .;
    *(.data);
    *(.data.*);
    *(.sdata);
    *(.rodata.*);
    *(.srodata.*);
    . = ALIGN(0x04);
    DATA_SEGMENT_STOP = .;
  } >sram AT>flash

  .bss : ALIGN(0x04) {
    . = ALIGN(0x04);
    BSS_START = .;
    *(.bss);
    BSS_STOP = .;
    HEAP_START = .;
  } >sram
}