aboutsummaryrefslogtreecommitdiffstats
path: root/device.lds
blob: d4ca9f19bedc9bd5394f784101f42ac1eadf16cf (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
OUTPUT_ARCH("riscv")

ENTRY(_start)

MEMORY
{
        /* 0x0000_0000 is an alias for 0x08000_0000 */
        FLASH(rwx) : ORIGIN = 0x00000000, LENGTH = 128K
        RAM(rw) : ORIGIN = 0x20000000, LENGTH = 32K
}

PHDRS
{
        text PT_LOAD;
        bss PT_NULL;
        rodata PT_LOAD;
        data PT_LOAD;
}

SECTIONS
{
        .text : {
                PROVIDE(_text_start = .);
                *(.text.init) *(.text .text.*)
                PROVIDE(_text_end = .);
        } >FLASH AT>FLASH :text

        PROVIDE(__global_pointer$ = . + 2048);

        .rodata : {
                PROVIDE(_rodata_start = .);
                *(.rodata .rodata.*)
                PROVIDE(_rodata_end = .);
        } >FLASH AT>FLASH :rodata

        . = ALIGN(4096);

        .data : {
                PROVIDE(_data_start = .);
                *(.sdata .sdata.*) *(.data .data.*)
                PROVIDE(_data_end = .);
        } >RAM AT>RAM :data

        .bss : {
                PROVIDE(_bss_start = .);
                *(.sbss .sbss.*) *(.bss .bss.*)
                PROVIDE(_bss_end = .);
        } >RAM AT>RAM :bss

        . = ALIGN(2);
        PROVIDE(_memory_start = ORIGIN(RAM));
        PROVIDE(_memory_end = _memory_start + LENGTH(RAM));
        PROVIDE(_stack_top = _memory_end);
}