MK82FN256xxx15_ram.ld 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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 = 0x1FFF0000, LENGTH = 0x00000400
  63. m_text (RX) : ORIGIN = 0x1FFF0400, LENGTH = 0x0000FC00
  64. m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
  65. }
  66. /* Define output sections */
  67. SECTIONS
  68. {
  69. /* The startup code goes first into internal RAM */
  70. .interrupts :
  71. {
  72. . = ALIGN(4);
  73. KEEP(*(.isr_vector)) /* Startup code */
  74. . = ALIGN(4);
  75. } > m_interrupts
  76. /* The program code and other data goes into internal RAM */
  77. .text :
  78. {
  79. . = ALIGN(4);
  80. *(.text) /* .text sections (code) */
  81. *(.text*) /* .text* sections (code) */
  82. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  83. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  84. *(.glue_7) /* glue arm to thumb code */
  85. *(.glue_7t) /* glue thumb to arm code */
  86. *(.eh_frame)
  87. KEEP (*(.init))
  88. KEEP (*(.fini))
  89. . = ALIGN(4);
  90. } > m_text
  91. .ARM.extab :
  92. {
  93. *(.ARM.extab* .gnu.linkonce.armextab.*)
  94. } > m_text
  95. .ARM :
  96. {
  97. __exidx_start = .;
  98. *(.ARM.exidx*)
  99. __exidx_end = .;
  100. } > m_text
  101. .ctors :
  102. {
  103. __CTOR_LIST__ = .;
  104. /* gcc uses crtbegin.o to find the start of
  105. the constructors, so we make sure it is
  106. first. Because this is a wildcard, it
  107. doesn't matter if the user does not
  108. actually link against crtbegin.o; the
  109. linker won't look for a file to match a
  110. wildcard. The wildcard also means that it
  111. doesn't matter which directory crtbegin.o
  112. is in. */
  113. KEEP (*crtbegin.o(.ctors))
  114. KEEP (*crtbegin?.o(.ctors))
  115. /* We don't want to include the .ctor section from
  116. from the crtend.o file until after the sorted ctors.
  117. The .ctor section from the crtend file contains the
  118. end of ctors marker and it must be last */
  119. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
  120. KEEP (*(SORT(.ctors.*)))
  121. KEEP (*(.ctors))
  122. __CTOR_END__ = .;
  123. } > m_text
  124. .dtors :
  125. {
  126. __DTOR_LIST__ = .;
  127. KEEP (*crtbegin.o(.dtors))
  128. KEEP (*crtbegin?.o(.dtors))
  129. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
  130. KEEP (*(SORT(.dtors.*)))
  131. KEEP (*(.dtors))
  132. __DTOR_END__ = .;
  133. } > m_text
  134. .preinit_array :
  135. {
  136. PROVIDE_HIDDEN (__preinit_array_start = .);
  137. KEEP (*(.preinit_array*))
  138. PROVIDE_HIDDEN (__preinit_array_end = .);
  139. } > m_text
  140. .init_array :
  141. {
  142. PROVIDE_HIDDEN (__init_array_start = .);
  143. KEEP (*(SORT(.init_array.*)))
  144. KEEP (*(.init_array*))
  145. PROVIDE_HIDDEN (__init_array_end = .);
  146. } > m_text
  147. .fini_array :
  148. {
  149. PROVIDE_HIDDEN (__fini_array_start = .);
  150. KEEP (*(SORT(.fini_array.*)))
  151. KEEP (*(.fini_array*))
  152. PROVIDE_HIDDEN (__fini_array_end = .);
  153. } > m_text
  154. __etext = .; /* define a global symbol at end of code */
  155. __DATA_ROM = .; /* Symbol is used by startup for data initialization */
  156. .data : AT(__DATA_ROM)
  157. {
  158. . = ALIGN(4);
  159. __DATA_RAM = .;
  160. __data_start__ = .; /* create a global symbol at data start */
  161. *(.data) /* .data sections */
  162. *(.data*) /* .data* sections */
  163. KEEP(*(.jcr*))
  164. . = ALIGN(4);
  165. __data_end__ = .; /* define a global symbol at data end */
  166. } > m_data
  167. __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
  168. .ncache.init : AT(__NDATA_ROM)
  169. {
  170. __noncachedata_start__ = .; /* create a global symbol at ncache data start */
  171. *(NonCacheable.init)
  172. . = ALIGN(4);
  173. __noncachedata_init_end__ = .; /* create a global symbol at initialized ncache data end */
  174. } > m_data
  175. . = __noncachedata_init_end__;
  176. .ncache :
  177. {
  178. *(NonCacheable)
  179. . = ALIGN(4);
  180. __noncachedata_end__ = .; /* define a global symbol at ncache data end */
  181. } > m_data
  182. __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
  183. text_end = ORIGIN(m_text) + LENGTH(m_text);
  184. ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
  185. /* Uninitialized data section */
  186. .bss :
  187. {
  188. /* This is used by the startup in order to initialize the .bss section */
  189. . = ALIGN(4);
  190. __START_BSS = .;
  191. __bss_start__ = .;
  192. *(.bss)
  193. *(.bss*)
  194. *(COMMON)
  195. . = ALIGN(4);
  196. __bss_end__ = .;
  197. __END_BSS = .;
  198. } > m_data
  199. .heap :
  200. {
  201. . = ALIGN(8);
  202. __end__ = .;
  203. PROVIDE(end = .);
  204. __HeapBase = .;
  205. . += HEAP_SIZE;
  206. __HeapLimit = .;
  207. __heap_limit = .; /* Add for _sbrk */
  208. } > m_data
  209. .stack :
  210. {
  211. . = ALIGN(8);
  212. . += STACK_SIZE;
  213. } > m_data
  214. /* Initializes stack on the end of block */
  215. __StackTop = ORIGIN(m_data) + LENGTH(m_data);
  216. __StackLimit = __StackTop - STACK_SIZE;
  217. PROVIDE(__stack = __StackTop);
  218. .ARM.attributes 0 : { *(.ARM.attributes) }
  219. ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
  220. }