MK24FN1M0xxx12_ram.ld 6.8 KB

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