kinetisk66.ld 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /*
  2. ** ###################################################################
  3. ** Processors: MK65FN2M0CAC18
  4. ** MK65FN2M0VMI18
  5. **
  6. ** Compiler: GNU C Compiler
  7. ** Reference manual: K65P169M180SF5RMV2_NDA, Rev. 0 Draft A, October 2014
  8. ** Version: rev. 2.3, 2014-11-20
  9. ** Build: b150122
  10. **
  11. ** Abstract:
  12. ** Linker file for the GNU C Compiler
  13. **
  14. ** Copyright (c) 2014 Freescale Semiconductor, Inc.
  15. ** All rights reserved.
  16. **
  17. ** Redistribution and use in source and binary forms, with or without modification,
  18. ** are permitted provided that the following conditions are met:
  19. **
  20. ** o Redistributions of source code must retain the above copyright notice, this list
  21. ** of conditions and the following disclaimer.
  22. **
  23. ** o Redistributions in binary form must reproduce the above copyright notice, this
  24. ** list of conditions and the following disclaimer in the documentation and/or
  25. ** other materials provided with the distribution.
  26. **
  27. ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
  28. ** contributors may be used to endorse or promote products derived from this
  29. ** software without specific prior written permission.
  30. **
  31. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  32. ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  33. ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  34. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  35. ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  36. ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  37. ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  38. ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  39. ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  40. ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  41. **
  42. ** http: www.freescale.com
  43. ** mail: support@freescale.com
  44. **
  45. ** ###################################################################
  46. */
  47. /* Entry Point */
  48. ENTRY(Reset_Handler)
  49. HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0;
  50. STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
  51. M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
  52. /* Specify the memory areas */
  53. MEMORY
  54. {
  55. m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
  56. m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
  57. m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x001FFBF0
  58. m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00040000
  59. }
  60. /* Define output sections */
  61. SECTIONS
  62. {
  63. /* The startup code goes first into internal flash */
  64. .interrupts :
  65. {
  66. __VECTOR_TABLE = .;
  67. . = ALIGN(4);
  68. KEEP(*(.isr_vector)) /* Startup code */
  69. . = ALIGN(4);
  70. } > m_interrupts
  71. .flash_config :
  72. {
  73. . = ALIGN(4);
  74. KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
  75. . = ALIGN(4);
  76. } > m_flash_config
  77. /* The program code and other data goes into internal flash */
  78. .text :
  79. {
  80. . = ALIGN(4);
  81. *(.text) /* .text sections (code) */
  82. *(.text*) /* .text* sections (code) */
  83. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  84. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  85. *(.glue_7) /* glue arm to thumb code */
  86. *(.glue_7t) /* glue thumb to arm code */
  87. *(.eh_frame)
  88. KEEP (*(.init))
  89. KEEP (*(.fini))
  90. . = ALIGN(4);
  91. } > m_text
  92. .ARM.extab :
  93. {
  94. *(.ARM.extab* .gnu.linkonce.armextab.*)
  95. } > m_text
  96. .ARM :
  97. {
  98. __exidx_start = .;
  99. *(.ARM.exidx*)
  100. __exidx_end = .;
  101. } > m_text
  102. .ctors :
  103. {
  104. __CTOR_LIST__ = .;
  105. /* gcc uses crtbegin.o to find the start of
  106. the constructors, so we make sure it is
  107. first. Because this is a wildcard, it
  108. doesn't matter if the user does not
  109. actually link against crtbegin.o; the
  110. linker won't look for a file to match a
  111. wildcard. The wildcard also means that it
  112. doesn't matter which directory crtbegin.o
  113. is in. */
  114. KEEP (*crtbegin.o(.ctors))
  115. KEEP (*crtbegin?.o(.ctors))
  116. /* We don't want to include the .ctor section from
  117. from the crtend.o file until after the sorted ctors.
  118. The .ctor section from the crtend file contains the
  119. end of ctors marker and it must be last */
  120. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
  121. KEEP (*(SORT(.ctors.*)))
  122. KEEP (*(.ctors))
  123. __CTOR_END__ = .;
  124. } > m_text
  125. .dtors :
  126. {
  127. __DTOR_LIST__ = .;
  128. KEEP (*crtbegin.o(.dtors))
  129. KEEP (*crtbegin?.o(.dtors))
  130. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
  131. KEEP (*(SORT(.dtors.*)))
  132. KEEP (*(.dtors))
  133. __DTOR_END__ = .;
  134. } > m_text
  135. .preinit_array :
  136. {
  137. PROVIDE_HIDDEN (__preinit_array_start = .);
  138. KEEP (*(.preinit_array*))
  139. PROVIDE_HIDDEN (__preinit_array_end = .);
  140. } > m_text
  141. .init_array :
  142. {
  143. PROVIDE_HIDDEN (__init_array_start = .);
  144. KEEP (*(SORT(.init_array.*)))
  145. KEEP (*(.init_array*))
  146. PROVIDE_HIDDEN (__init_array_end = .);
  147. } > m_text
  148. .fini_array :
  149. {
  150. PROVIDE_HIDDEN (__fini_array_start = .);
  151. KEEP (*(SORT(.fini_array.*)))
  152. KEEP (*(.fini_array*))
  153. PROVIDE_HIDDEN (__fini_array_end = .);
  154. } > m_text
  155. __etext = .; /* define a global symbol at end of code */
  156. __DATA_ROM = .; /* Symbol is used by startup for data initialization */
  157. .interrupts_ram :
  158. {
  159. . = ALIGN(4);
  160. __VECTOR_RAM__ = .;
  161. __interrupts_ram_start__ = .; /* Create a global symbol at data start */
  162. *(.m_interrupts_ram) /* This is a user defined section */
  163. . += M_VECTOR_RAM_SIZE;
  164. . = ALIGN(4);
  165. __interrupts_ram_end__ = .; /* Define a global symbol at data end */
  166. } > m_data
  167. __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
  168. __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
  169. .data : AT(__DATA_ROM)
  170. {
  171. . = ALIGN(4);
  172. __DATA_RAM = .;
  173. __data_start__ = .; /* create a global symbol at data start */
  174. *(.data) /* .data sections */
  175. *(.data*) /* .data* sections */
  176. KEEP(*(.jcr*))
  177. . = ALIGN(4);
  178. __data_end__ = .; /* define a global symbol at data end */
  179. } > m_data
  180. __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
  181. /* Uninitialized data section */
  182. .bss :
  183. {
  184. /* This is used by the startup in order to initialize the .bss section */
  185. . = ALIGN(4);
  186. __START_BSS = .;
  187. __bss_start__ = .;
  188. *(.bss)
  189. *(.bss*)
  190. *(COMMON)
  191. . = ALIGN(4);
  192. __bss_end__ = .;
  193. __END_BSS = .;
  194. } > m_data
  195. m_usb_bdt :
  196. {
  197. . = ALIGN(512);
  198. __START_USBGLOBAL = .;
  199. *(m_usb_bdt)
  200. KEEP(*(m_usb_bdt))
  201. } > m_data
  202. m_usb_global :
  203. {
  204. . = ALIGN(512);
  205. *(m_usb_global)
  206. KEEP(*(m_usb_global))
  207. __END_USBGLOBAL = .;
  208. } > m_data
  209. .heap :
  210. {
  211. . = ALIGN(8);
  212. __end__ = .;
  213. PROVIDE(end = .);
  214. __HeapBase = .;
  215. . += HEAP_SIZE;
  216. __HeapLimit = .;
  217. } > m_data
  218. .stack :
  219. {
  220. . = ALIGN(8);
  221. __StackLimit = .;
  222. . += STACK_SIZE;
  223. __StackTop = .;
  224. __STACK_TOP = .;
  225. PROVIDE(__stack = __StackTop);
  226. } > m_data
  227. .ARM.attributes 0 : { *(.ARM.attributes) }
  228. ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
  229. }