link.lds 3.7 KB
Newer Older
1
/* Define the flash max size */
G
greedyhao 已提交
2
__max_flash_size = 1024k;
3

G
greedyhao 已提交
4
__data_ram_size = 8k;
G
greedyhao 已提交
5
__stack_ram_size = 4k;
G
greedyhao 已提交
6 7
__comm_ram_size = 42k;
__heap_ram_size = 70k;
G
greedyhao 已提交
8

9 10
__base = 0x10000000;

G
greedyhao 已提交
11 12 13
__data_vma = 0x11000;
__stack_vma = __data_vma + __data_ram_size;
__comm_vma = __stack_vma + __stack_ram_size;
G
greedyhao 已提交
14 15 16
__heap_vma = __comm_vma + __comm_ram_size;

__ram1_vma = 0x50000;
17 18 19 20 21

MEMORY
{
    init            : org = __base,             len = 512
    flash(rx)       : org = __base + 512,       len = __max_flash_size
G
greedyhao 已提交
22 23
    comm(rx)        : org = __comm_vma,         len = __comm_ram_size

G
greedyhao 已提交
24 25
    data            : org = __data_vma,         len = __data_ram_size
    stack           : org = __stack_vma,        len = __stack_ram_size
G
greedyhao 已提交
26 27
    heap            : org = __heap_vma,         len = __heap_ram_size
    ram1(rx)        : org = __ram1_vma,         len = 0x7a00
28 29 30 31 32 33 34 35
}

SECTIONS
{
    .init : {
        *(.reset)
    } > init

G
greedyhao 已提交
36
    .ram1 __ram1_vma : {
37 38 39 40 41 42
        . = ALIGN(4);
        /* section information for initial */
        __rt_init_start = .;
        KEEP(*(SORT(.rti_fn*)))
        __rt_init_end = .;

G
greedyhao 已提交
43 44 45 46 47 48 49
        . = ALIGN(4);
        PROVIDE(__ctors_start__ = .);
        KEEP (*(SORT(.init_array.*)))
        KEEP (*(.init_array))
        PROVIDE(__ctors_end__ = .);

        . = ALIGN(4);
G
greedyhao 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
        *save-restore.o (.text* .rodata*)
        *libcpu*cpu*context_gcc.o (.text* .rodata*)
        *libcpu*cpu*interrupt.o (.text* .rodata*)
        *libcpu**.o (.rodata*)

        *components*drivers*misc*pin.o(.text*)
        *components*drivers*misc*adc.o(.text*)

        . = ALIGN(4);
        *src*ipc.o (.text* .rodata*)
        *src*irq.o (.text* .rodata*)
        *src*object.o (.text* .rodata*)
        *src*thread.o (.text* .rodata*)
        *src*timer.o (.text* .rodata*)
        *src*mempool.o (.text* .rodata*)
        *src*scheduler.o (.text* .rodata*)
        *src*clock.o (.text* .rodata*)
        *src*kservice.o (.text* .rodata*)
        *src*device.o (.text* .rodata*)
        *src*idle.o (.text* .rodata*)
        *src*components.o (.text* .rodata*)
G
greedyhao 已提交
71 72
    } > ram1 AT > flash

G
greedyhao 已提交
73
    .comm __comm_vma : {
G
greedyhao 已提交
74
        . = ALIGN(4);
G
greedyhao 已提交
75
        KEEP(*(.vector))
G
greedyhao 已提交
76 77 78
        *(.irq*)
        /*applications**.o (.text .rodata)*/
        *hal_libraries*ab32vg1_hal**.o (.text .rodata)
G
greedyhao 已提交
79 80
        *(.text.unlikely)
        *(.text.startup)
G
greedyhao 已提交
81 82 83 84 85 86
        *hal_drivers**.o (.rodata)
        *audio*drv_sound.o (.rodata)
        *system_ab32vgx.o (.rodata)
        EXCLUDE_FILE(*lib_a**.o *cp-demangle.o *cp-demangle.o 
        *src*mem.o *src*memheap.o *dfs**.o *components.o *drivers*sdio**.o *cmd.o *msh_file.o
        *drv_sdio.o *drv_wdt.o) *(.rodata.str1.4)
G
greedyhao 已提交
87
        EXCLUDE_FILE(*lib_a**.o *unwind*.o) *(.srodata)
G
greedyhao 已提交
88 89
        *(.rela*)
        *(.data*)
G
greedyhao 已提交
90
        *(.sdata*)
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
    } > comm AT > flash

    .bss (NOLOAD):
    {
        __bss_start = .;
        *(COMMON)
        *(.bss)
        *(.sbss)
        *(.buf*)
        __bss_end = .;
    } > data
    __bss_size = __bss_end - __bss_start;

    .stack (NOLOAD) : {
        __irq_stack_start = .;
G
greedyhao 已提交
106
        . = __stack_ram_size;
107 108 109 110
        __irq_stack = .;
    } > stack
    __irq_stack_size = __irq_stack - __irq_stack_start;

G
greedyhao 已提交
111
    .heap (NOLOAD) : {
G
greedyhao 已提交
112 113 114 115
        __heap_start = .;
        . = __heap_ram_size;
        __heap_end = .;
    } > heap
G
greedyhao 已提交
116 117

    .flash : {
118 119 120 121 122 123 124 125 126 127
        . = ALIGN(4);
        __fsymtab_start = .;
        KEEP(*(FSymTab))
        __fsymtab_end = .;

        . = ALIGN(4);
        __vsymtab_start = .;
        KEEP(*(VSymTab))
        __vsymtab_end = .;

G
greedyhao 已提交
128
        . = ALIGN(4);
G
greedyhao 已提交
129 130
        *(.text*)
        *(.rodata*)
G
greedyhao 已提交
131
        *(.srodata*)
G
greedyhao 已提交
132 133
        . = ALIGN(512);
    } > flash
134 135 136 137 138
}

/* Calc the lma */
__bank_size = SIZEOF(.flash);
__comm_lma = LOADADDR(.comm);
G
greedyhao 已提交
139 140
__comm_size = SIZEOF(.comm);
__ram1_lma = LOADADDR(.ram1);
G
greedyhao 已提交
141
__ram1_size = SIZEOF(.ram1);