1/******************************************************************************
2*
3* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions
7* are met:
8*
9*  Redistributions of source code must retain the above copyright
10*  notice, this list of conditions and the following disclaimer.
11*
12*  Redistributions in binary form must reproduce the above copyright
13*  notice, this list of conditions and the following disclaimer in the
14*  documentation and/or other materials provided with the
15*  distribution.
16*
17*  Neither the name of Texas Instruments Incorporated nor the names of
18*  its contributors may be used to endorse or promote products derived
19*  from this software without specific prior written permission.
20*
21* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*
33 *****************************************************************************/
34
35
36MEMORY
37{
38    FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00100000
39    SRAM (WX)  : ORIGIN = 0x20000000, LENGTH = 0x00040000
40}
41
42REGION_ALIAS("REGION_TEXT", FLASH);
43REGION_ALIAS("REGION_BSS", SRAM);
44REGION_ALIAS("REGION_DATA", SRAM);
45REGION_ALIAS("REGION_STACK", SRAM);
46REGION_ALIAS("REGION_HEAP", SRAM);
47REGION_ALIAS("REGION_ARM_EXIDX", FLASH);
48REGION_ALIAS("REGION_ARM_EXTAB", FLASH);
49
50SECTIONS {
51
52    /* section for the interrupt vector area                                 */
53    PROVIDE (_intvecs_base_address =
54        DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x0);
55
56    .intvecs (_intvecs_base_address) : AT (_intvecs_base_address) {
57        KEEP (*(.intvecs))
58    } > REGION_TEXT
59
60    PROVIDE (_vtable_base_address =
61        DEFINED(_vtable_base_address) ? _vtable_base_address : 0x20000000);
62
63    .vtable (_vtable_base_address) : AT (_vtable_base_address) {
64        KEEP (*(.vtable))
65    } > REGION_DATA
66
67    .text : {
68        CREATE_OBJECT_SYMBOLS
69        KEEP (*(.text))
70        *(.text.*)
71        . = ALIGN(0x4);
72        KEEP (*(.ctors))
73        . = ALIGN(0x4);
74        KEEP (*(.dtors))
75        . = ALIGN(0x4);
76        __init_array_start = .;
77        KEEP (*(.init_array*))
78        __init_array_end = .;
79        KEEP (*(.init))
80        KEEP (*(.fini*))
81
82        /* section information for finsh shell */
83        . = ALIGN(4);
84        __fsymtab_start = .;
85        KEEP(*(FSymTab))
86        __fsymtab_end = .;
87
88        . = ALIGN(4);
89        __vsymtab_start = .;
90        KEEP(*(VSymTab))
91        __vsymtab_end = .;
92
93        /* section information for initial. */
94        . = ALIGN(4);
95        __rt_init_start = .;
96        KEEP(*(SORT(.rti_fn*)))
97        __rt_init_end = .;
98
99        . = ALIGN(4);
100    } > REGION_TEXT AT> REGION_TEXT
101
102    .rodata : {
103        *(.rodata)
104        *(.rodata.*)
105    } > REGION_TEXT AT> REGION_TEXT
106
107    .ARM.exidx : {
108        __exidx_start = .;
109        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
110        __exidx_end = .;
111    } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX
112
113    .ARM.extab : {
114        KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*))
115    } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB
116
117    __etext = .;
118
119    .data : {
120        __data_load__ = LOADADDR (.data);
121        __data_start__ = .;
122        KEEP (*(.data))
123        KEEP (*(.data*))
124        . = ALIGN (4);
125        __data_end__ = .;
126    } > REGION_DATA AT> REGION_TEXT
127
128    .bss : {
129        __bss_start__ = .;
130        *(.shbss)
131        KEEP (*(.bss))
132        *(.bss.*)
133        *(COMMON)
134        . = ALIGN (4);
135        __bss_end__ = .;
136    } > REGION_BSS AT> REGION_BSS
137
138    .heap : {
139        __heap_start__ = .;
140        end = __heap_start__;
141        _end = end;
142        __end = end;
143        KEEP (*(.heap))
144        __heap_end__ = .;
145        __HeapLimit = __heap_end__;
146    } > REGION_HEAP AT> REGION_HEAP
147
148    .stack (NOLOAD) : ALIGN(0x8) {
149        _stack = .;
150        KEEP(*(.stack))
151    } > REGION_STACK AT> REGION_STACK
152
153    __StackTop = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK);
154    PROVIDE(__stack = __StackTop);
155
156    __end = .;
157}
158