1/* Define the flash max size */
2__max_flash_size = 1020k;
3
4__data_ram_size = 16k;
5__stack_ram_size = 4k;
6__comm_ram_size = 42k;
7__heap_ram_size = 52k;
8__ble_ram_size = 10k;
9
10__base = 0x10000000;
11
12__bram_vma = 0x11000;
13__heap_vma = __bram_vma + __ble_ram_size;
14__data_vma = __heap_vma + __heap_ram_size;
15__stack_vma = __data_vma + __data_ram_size;
16__comm_vma = __stack_vma + __stack_ram_size;
17
18__ram1_vma = 0x50000;
19
20MEMORY
21{
22    init            : org = __base,             len = 512
23    flash(rx)       : org = __base + 512,       len = __max_flash_size
24    comm(rx)        : org = __comm_vma,         len = __comm_ram_size
25
26    bram            : org = __bram_vma,         len = __ble_ram_size
27    data            : org = __data_vma,         len = __data_ram_size
28    stack           : org = __stack_vma,        len = __stack_ram_size
29    heap            : org = __heap_vma,         len = __heap_ram_size
30    ram1(rx)        : org = __ram1_vma,         len = 0x7a00
31}
32
33SECTIONS
34{
35    .init : {
36        *(.reset)
37    } > init
38
39    .ram1 __ram1_vma : {
40        /* section information for initial */
41        . = ALIGN(4);
42        __rt_init_start = .;
43        KEEP(*(SORT(.rti_fn*)))
44        __rt_init_end = .;
45
46        . = ALIGN(4);
47        PROVIDE(__ctors_start__ = .);
48        KEEP (*(SORT(.init_array.*)))
49        KEEP (*(.init_array*))
50        PROVIDE(__ctors_end__ = .);
51
52        /* section information for at server */
53        . = ALIGN(4);
54        __rtatcmdtab_start = .;
55        KEEP(*(RtAtCmdTab))
56        __rtatcmdtab_end = .;
57
58        . = ALIGN(4);
59        *save-restore.o (.text* .rodata*)
60        *libcpu*cpu*context_gcc.o (.text* .rodata*)
61        *libcpu*cpu*interrupt.o (.text* .rodata*)
62        *libcpu**.o (.rodata*)
63
64        *components*drivers*misc*pin.o(.text*)
65        *components*drivers*misc*adc.o(.text*)
66
67        . = ALIGN(4);
68        *src*ipc.o (.text* .rodata*)
69        *src*irq.o (.text* .rodata*)
70        *src*object.o (.text* .rodata*)
71        *src*thread.o (.text* .rodata*)
72        *src*timer.o (.text* .rodata*)
73        *src*mempool.o (.text* .rodata*)
74        *src*scheduler.o (.text* .rodata*)
75        *src*clock.o (.text* .rodata*)
76        *src*kservice.o (.text* .rodata*)
77        *src*device.o (.text* .rodata*)
78        *src*idle.o (.text* .rodata*)
79        *src*components.o (.text* .rodata*)
80    } > ram1 AT > flash
81
82    .comm __comm_vma : {
83        . = ALIGN(4);
84        KEEP(*(.vector))
85        *(.irq.cache)
86        *(.irq*)
87        *ab32vg1_hal**.o (.text* .rodata*)
88        *drv_gpio.o (.text* .rodata*)
89        *drv_usart.o (.rodata*)
90        EXCLUDE_FILE(*lib_a**.o *unwind*.o) *(.srodata*)
91        *(.rela*)
92        *(.data*)
93        *(.sdata*)
94        *(.com_text*)
95        *(.text.ble_mqueue_get)
96        *(.text.ble_mqueue_put)
97        *(.text.os_memblock_get)
98    } > comm AT > flash
99
100    .bram __bram_vma (NOLOAD) : {
101        *(.btmem.bthw)
102        *(.btmem*)
103    } > bram
104
105    .bss (NOLOAD):
106    {
107        __bss_start = .;
108        *(COMMON)
109        *(.bss)
110        *(.sbss)
111        *(.buf*)
112        __bss_end = .;
113    } > data
114    __bss_size = __bss_end - __bss_start;
115
116    .stack (NOLOAD) : {
117        __irq_stack_start = .;
118        . = __stack_ram_size;
119        __irq_stack = .;
120    } > stack
121    __irq_stack_size = __irq_stack - __irq_stack_start;
122
123    .heap (NOLOAD) : {
124        __heap_start = .;
125        . = __heap_ram_size;
126        __heap_end = .;
127    } > heap
128
129    .flash : {
130        . = ALIGN(4);
131        __fsymtab_start = .;
132        KEEP(*(FSymTab))
133        __fsymtab_end = .;
134
135        . = ALIGN(4);
136        __vsymtab_start = .;
137        KEEP(*(VSymTab))
138        __vsymtab_end = .;
139
140        . = ALIGN(4);
141        *(.text*)
142        *(.rodata*)
143        *(.srodata*)
144        . = ALIGN(512);
145    } > flash
146}
147
148/* Calc the lma */
149__bank_size = SIZEOF(.flash);
150__comm_lma = LOADADDR(.comm);
151__comm_size = SIZEOF(.comm);
152__ram1_lma = LOADADDR(.ram1);
153__ram1_size = SIZEOF(.ram1);
154