MK82FN256xxx15_flash.ld 8.0 KB

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