Statistics
| Branch: | Tag: | Revision:

mongoose / examples / NXP_K64 / kds / MK64FN1M0xxx12_flash.ld @ eaef5bd1

History | View | Annotate | Download (8.25 KB)

1
/*
2
** ###################################################################
3
**     Processors:          MK64FN1M0VDC12
4
**                          MK64FN1M0VLL12
5
**                          MK64FN1M0VLQ12
6
**                          MK64FN1M0VMD12
7
**
8
**     Compiler:            GNU C Compiler
9
**     Reference manual:    K64P144M120SF5RM, Rev.2, January 2014
10
**     Version:             rev. 2.8, 2015-02-19
11
**     Build:               b151217
12
**
13
**     Abstract:
14
**         Linker file for the GNU C Compiler
15
**
16
**     Copyright (c) 2015 Freescale Semiconductor, Inc.
17
**     All rights reserved.
18
**
19
**     Redistribution and use in source and binary forms, with or without modification,
20
**     are permitted provided that the following conditions are met:
21
**
22
**     o Redistributions of source code must retain the above copyright notice, this list
23
**       of conditions and the following disclaimer.
24
**
25
**     o Redistributions in binary form must reproduce the above copyright notice, this
26
**       list of conditions and the following disclaimer in the documentation and/or
27
**       other materials provided with the distribution.
28
**
29
**     o Neither the name of Freescale Semiconductor, Inc. nor the names of its
30
**       contributors may be used to endorse or promote products derived from this
31
**       software without specific prior written permission.
32
**
33
**     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34
**     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35
**     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36
**     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
37
**     ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38
**     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39
**     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
40
**     ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41
**     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42
**     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
**
44
**     http:                 www.freescale.com
45
**     mail:                 support@freescale.com
46
**
47
** ###################################################################
48
*/
49

    
50
/* Entry Point */
51
ENTRY(Reset_Handler)
52

    
53
HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x1000;
54
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
55
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
56

    
57
/* Specify the memory areas */
58
MEMORY
59
{
60
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
61
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
62
  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0
63
  m_data                (RW)  : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
64
  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00030000
65
}
66

    
67
/* Define output sections */
68
SECTIONS
69
{
70
  /* The startup code goes first into internal flash */
71
  .interrupts :
72
  {
73
    __VECTOR_TABLE = .;
74
    . = ALIGN(4);
75
    KEEP(*(.isr_vector))     /* Startup code */
76
    . = ALIGN(4);
77
  } > m_interrupts
78

    
79
  .flash_config :
80
  {
81
    . = ALIGN(4);
82
    KEEP(*(.FlashConfig))    /* Flash Configuration Field (FCF) */
83
    . = ALIGN(4);
84
  } > m_flash_config
85

    
86
  /* The program code and other data goes into internal flash */
87
  .text :
88
  {
89
    . = ALIGN(4);
90
    *(.text)                 /* .text sections (code) */
91
    *(.text*)                /* .text* sections (code) */
92
    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
93
    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
94
    *(.glue_7)               /* glue arm to thumb code */
95
    *(.glue_7t)              /* glue thumb to arm code */
96
    *(.eh_frame)
97
    KEEP (*(.init))
98
    KEEP (*(.fini))
99
    . = ALIGN(4);
100
  } > m_text
101

    
102
  .ARM.extab :
103
  {
104
    *(.ARM.extab* .gnu.linkonce.armextab.*)
105
  } > m_text
106

    
107
  .ARM :
108
  {
109
    __exidx_start = .;
110
    *(.ARM.exidx*)
111
    __exidx_end = .;
112
  } > m_text
113

    
114
 .ctors :
115
  {
116
    __CTOR_LIST__ = .;
117
    /* gcc uses crtbegin.o to find the start of
118
       the constructors, so we make sure it is
119
       first.  Because this is a wildcard, it
120
       doesn't matter if the user does not
121
       actually link against crtbegin.o; the
122
       linker won't look for a file to match a
123
       wildcard.  The wildcard also means that it
124
       doesn't matter which directory crtbegin.o
125
       is in.  */
126
    KEEP (*crtbegin.o(.ctors))
127
    KEEP (*crtbegin?.o(.ctors))
128
    /* We don't want to include the .ctor section from
129
       from the crtend.o file until after the sorted ctors.
130
       The .ctor section from the crtend file contains the
131
       end of ctors marker and it must be last */
132
    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
133
    KEEP (*(SORT(.ctors.*)))
134
    KEEP (*(.ctors))
135
    __CTOR_END__ = .;
136
  } > m_text
137

    
138
  .dtors :
139
  {
140
    __DTOR_LIST__ = .;
141
    KEEP (*crtbegin.o(.dtors))
142
    KEEP (*crtbegin?.o(.dtors))
143
    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
144
    KEEP (*(SORT(.dtors.*)))
145
    KEEP (*(.dtors))
146
    __DTOR_END__ = .;
147
  } > m_text
148

    
149
  .preinit_array :
150
  {
151
    PROVIDE_HIDDEN (__preinit_array_start = .);
152
    KEEP (*(.preinit_array*))
153
    PROVIDE_HIDDEN (__preinit_array_end = .);
154
  } > m_text
155

    
156
  .init_array :
157
  {
158
    PROVIDE_HIDDEN (__init_array_start = .);
159
    KEEP (*(SORT(.init_array.*)))
160
    KEEP (*(.init_array*))
161
    PROVIDE_HIDDEN (__init_array_end = .);
162
  } > m_text
163

    
164
  .fini_array :
165
  {
166
    PROVIDE_HIDDEN (__fini_array_start = .);
167
    KEEP (*(SORT(.fini_array.*)))
168
    KEEP (*(.fini_array*))
169
    PROVIDE_HIDDEN (__fini_array_end = .);
170
  } > m_text
171

    
172
  __etext = .;    /* define a global symbol at end of code */
173
  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
174

    
175
  .interrupts_ram :
176
  {
177
    . = ALIGN(4);
178
    __VECTOR_RAM__ = .;
179
    __interrupts_ram_start__ = .; /* Create a global symbol at data start */
180
    *(.m_interrupts_ram)     /* This is a user defined section */
181
    . += M_VECTOR_RAM_SIZE;
182
    . = ALIGN(4);
183
    __interrupts_ram_end__ = .; /* Define a global symbol at data end */
184
  } > m_data
185

    
186
  __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
187
  __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
188

    
189
  .data : AT(__DATA_ROM)
190
  {
191
    . = ALIGN(4);
192
    __DATA_RAM = .;
193
    __data_start__ = .;      /* create a global symbol at data start */
194
    *(.data)                 /* .data sections */
195
    *(.data*)                /* .data* sections */
196
    KEEP(*(.jcr*))
197
    . = ALIGN(4);
198
    __data_end__ = .;        /* define a global symbol at data end */
199
  } > m_data
200

    
201
  __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
202
  text_end = ORIGIN(m_text) + LENGTH(m_text);
203
  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
204

    
205
  USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x800;
206
  /* Uninitialized data section */
207
  .bss :
208
  {
209
    /* This is used by the startup in order to initialize the .bss section */
210
    . = ALIGN(4);
211
    __START_BSS = .;
212
    __bss_start__ = .;
213
    *(.bss)
214
    *(.bss*)
215
    . = ALIGN(512);
216
    USB_RAM_START = .;
217
    . += USB_RAM_GAP;
218
    *(COMMON)
219
    . = ALIGN(4);
220
    __bss_end__ = .;
221
    __END_BSS = .;
222
  } > m_data
223

    
224
  .heap :
225
  {
226
    . = ALIGN(8);
227
    __end__ = .;
228
    PROVIDE(end = .);
229
    __HeapBase = .;
230
    . += HEAP_SIZE;
231
    __HeapLimit = .;
232
    __heap_limit = .; /* Add for _sbrk */
233
  } > m_data_2
234

    
235
  .stack :
236
  {
237
    . = ALIGN(8);
238
    . += STACK_SIZE;
239
  } > m_data_2
240

    
241
  m_usb_bdt USB_RAM_START (NOLOAD) :
242
  {
243
    *(m_usb_bdt)
244
    USB_RAM_BDT_END = .;
245
  }
246

    
247
  m_usb_global USB_RAM_BDT_END (NOLOAD) :
248
  {
249
    *(m_usb_global)
250
  }
251

    
252
  /* Initializes stack on the end of block */
253
  __StackTop   = ORIGIN(m_data_2) + LENGTH(m_data_2);
254
  __StackLimit = __StackTop - STACK_SIZE;
255
  PROVIDE(__stack = __StackTop);
256

    
257
  .ARM.attributes 0 : { *(.ARM.attributes) }
258

    
259
  ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
260
}
261