2 *****************************************************************************
4 ** File : KL25Z128M4_flash.ld
6 ** Default linker command file for Flash targets
8 *****************************************************************************
11 ENTRY(__thumb_startup)
13 /* Highest address of the user mode stack */
14 _estack = 0x20003000; /* end of SRAM */
17 /* Generate a link error if heap and stack don't fit into RAM */
18 __heap_size = 0x400; /* required amount of heap */
19 __stack_size = 0x400; /* required amount of stack */
21 /* Specify the memory areas */
24 m_interrupts (rx) : ORIGIN = 0x00000000, LENGTH = 0xC0
25 m_cfmprotrom (rx) : ORIGIN = 0x00000400, LENGTH = 0x10
26 m_text (rx) : ORIGIN = 0x00000800, LENGTH = 128K - 0x800
27 m_data (rwx) : ORIGIN = 0x1FFFF000, LENGTH = 16K /* SRAM */
31 /* Define output sections */
34 /* The startup code goes first into Flash */
39 KEEP(*(.vectortable)) /* Startup code */
46 KEEP(*(.cfmconfig)) /* Flash Configuration Field (FCF) */
50 /* The program code and other data goes into Flash */
54 *(.text) /* .text sections (code) */
55 *(.text*) /* .text* sections (code) */
56 *(.rodata) /* .rodata sections (constants, strings, etc.) */
57 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
58 *(.glue_7) /* glue arm to thumb code */
59 *(.glue_7t) /* glue thumb to arm code */
66 _etext = .; /* define a global symbols at end of code */
69 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > m_text
79 /* gcc uses crtbegin.o to find the start of
80 the constructors, so we make sure it is
81 first. Because this is a wildcard, it
82 doesn't matter if the user does not
83 actually link against crtbegin.o; the
84 linker won't look for a file to match a
85 wildcard. The wildcard also means that it
86 doesn't matter which directory crtbegin.o
88 KEEP (*crtbegin.o(.ctors))
89 /* We don't want to include the .ctor section from
90 from the crtend.o file until after the sorted ctors.
91 The .ctor section from the crtend file contains the
92 end of ctors marker and it must be last */
93 KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
94 KEEP (*(SORT(.ctors.*)))
101 KEEP (*crtbegin.o(.dtors))
102 KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
103 KEEP (*(SORT(.dtors.*)))
110 PROVIDE_HIDDEN (__preinit_array_start = .);
111 KEEP (*(.preinit_array*))
112 PROVIDE_HIDDEN (__preinit_array_end = .);
116 PROVIDE_HIDDEN (__init_array_start = .);
117 KEEP (*(SORT(.init_array.*)))
118 KEEP (*(.init_array*))
119 PROVIDE_HIDDEN (__init_array_end = .);
123 PROVIDE_HIDDEN (__fini_array_start = .);
124 KEEP (*(SORT(.fini_array.*)))
125 KEEP (*(.fini_array*))
126 PROVIDE_HIDDEN (__fini_array_end = .);
131 /* reserve MTB memory at the beginning of m_data */
132 .mtb : /* MTB buffer address as defined by the hardware */
136 KEEP(*(.mtb_buf)) /* need to KEEP Micro Trace Buffer as not referenced by application */
141 /* Initialized data sections goes into RAM, load LMA copy after code */
142 .data : AT(___ROM_AT)
146 _sdata = .; /* create a global symbol at data start */
147 *(.data) /* .data sections */
148 *(.data*) /* .data* sections */
151 _edata = .; /* define a global symbol at data end */
154 ___data_size = _edata - _sdata;
156 /* Uninitialized data section */
160 /* This is used by the startup in order to initialize the .bss section */
162 PROVIDE ( __bss_start__ = __START_BSS );
169 PROVIDE ( __bss_end__ = __END_BSS );
172 _romp_at = ___ROM_AT + SIZEOF(.data);
184 /* User_heap_stack section, used to check that there is enough RAM left */
189 PROVIDE ( _end = . );
192 . = . + __stack_size;
196 .ARM.attributes 0 : { *(.ARM.attributes) }