f9d04ed885d8bd0888ba61f90e2abade48ebdbf8
[fw/openocd] / contrib / loaders / flash / msp432 / msp432p401x / msp432p401x.lds
1 /******************************************************************************
2 *
3 * Copyright (C) 2012-2018 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 MEMORY {
36         MAIN_FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00040000
37         INFO_FLASH (RX) : ORIGIN = 0x00200000, LENGTH = 0x00004000
38         SRAM_CODE_0(RWX): ORIGIN = 0x01000000, LENGTH = 0x00000110
39         SRAM_CODE_1(RWX): ORIGIN = 0x01000110, LENGTH = 0x00000030
40         SRAM_CODE_2(RWX): ORIGIN = 0x01000150, LENGTH = 0x00000040
41         SRAM_CODE_3(RWX): ORIGIN = 0x01000190, LENGTH = 0x00000F70
42         SRAM_CODE_4(RWX): ORIGIN = 0x01001170, LENGTH = 0x00000200
43         SRAM_DATA  (RW) : ORIGIN = 0x20002000, LENGTH = 0x00001000
44 }
45
46 REGION_ALIAS("REGION_INTVECT", SRAM_CODE_0);
47 REGION_ALIAS("REGION_RESET", SRAM_CODE_1);
48 REGION_ALIAS("REGION_DESCRIPTOR", SRAM_CODE_2);
49 REGION_ALIAS("REGION_TEXT", SRAM_CODE_3);
50 REGION_ALIAS("REGION_BSS", SRAM_CODE_3);
51 REGION_ALIAS("REGION_DATA", SRAM_DATA);
52 REGION_ALIAS("REGION_STACK", SRAM_CODE_4);
53 REGION_ALIAS("REGION_HEAP", SRAM_DATA);
54 REGION_ALIAS("REGION_ARM_EXIDX", SRAM_CODE_3);
55 REGION_ALIAS("REGION_ARM_EXTAB", SRAM_CODE_3);
56
57
58 SECTIONS {
59         /* section for the interrupt vector area */
60         .intvecs : {
61                 KEEP (*(.intvecs))
62         } > REGION_INTVECT
63
64         PROVIDE (_vtable_base_address =
65                 DEFINED(_vtable_base_address) ? _vtable_base_address : 0x20000000);
66
67         .vtable (_vtable_base_address) : AT (_vtable_base_address) {
68                 KEEP (*(.vtable))
69         } > REGION_DATA
70
71         .descriptor :{
72                 FILL(0x00000000);
73                 . = ORIGIN(REGION_DESCRIPTOR) + LENGTH(REGION_DESCRIPTOR) - 1;
74                 BYTE(0x00);
75                 __ROM_AT = .;
76         } > REGION_DESCRIPTOR
77
78         .reset : {
79                 KEEP(*(.reset))
80         } > REGION_RESET AT> REGION_RESET
81
82         .text : {
83                 CREATE_OBJECT_SYMBOLS
84                 KEEP (*(.text))
85                 *(.text.*)
86                 . = ALIGN(0x4);
87                 KEEP (*(.ctors))
88                 . = ALIGN(0x4);
89                 KEEP (*(.dtors))
90                 . = ALIGN(0x4);
91                 __init_array_start = .;
92                 KEEP (*(.init_array*))
93                 __init_array_end = .;
94                 KEEP (*(.init))
95                 KEEP (*(.fini*))
96         } > REGION_TEXT AT> REGION_TEXT
97
98         .rodata : {
99                 *(.rodata)
100                 *(.rodata.*)
101         } > REGION_TEXT AT> REGION_TEXT
102
103         .ARM.exidx : {
104                 __exidx_start = .;
105                 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
106                 __exidx_end = .;
107         } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX
108
109         .ARM.extab : {
110                 KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*))
111         } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB
112
113         __etext = .;
114
115         .data : {
116                 __data_load__ = LOADADDR (.data);
117                 __data_start__ = .;
118                 KEEP (*(.data))
119                 KEEP (*(.data*))
120                 . = ALIGN (4);
121                 __data_end__ = .;
122         } > REGION_DATA AT> REGION_TEXT
123
124         .bss : {
125                 __bss_start__ = .;
126                 *(.shbss)
127                 KEEP (*(.bss))
128                 *(.bss.*)
129                 *(COMMON)
130                 . = ALIGN (4);
131                 __bss_end__ = .;
132         } > REGION_BSS AT> REGION_BSS
133
134         .heap : {
135                 __heap_start__ = .;
136                 end = __heap_start__;
137                 _end = end;
138                 __end = end;
139                 KEEP (*(.heap))
140                 __heap_end__ = .;
141                 __HeapLimit = __heap_end__;
142         } > REGION_HEAP AT> REGION_HEAP
143
144         .stack (NOLOAD) : ALIGN(0x8) {
145                 _stack = .;
146                 KEEP(*(.stack))
147         } > REGION_STACK AT> REGION_STACK
148
149         __stack_top = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK);
150         PROVIDE(__stack = __stack_top);
151 }