MK24FN1M0xxx12_flash.ld 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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 = 0x00000000, LENGTH = 0x00000400
  56. m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
  57. m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0
  58. m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
  59. m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
  60. }
  61. /* Define output sections */
  62. SECTIONS
  63. {
  64. /* The startup code goes first into internal flash */
  65. .interrupts :
  66. {
  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. .data : AT(__DATA_ROM)
  158. {
  159. . = ALIGN(4);
  160. __DATA_RAM = .;
  161. __data_start__ = .; /* create a global symbol at data start */
  162. *(.data) /* .data sections */
  163. *(.data*) /* .data* sections */
  164. KEEP(*(.jcr*))
  165. . = ALIGN(4);
  166. __data_end__ = .; /* define a global symbol at data end */
  167. } > m_data
  168. __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
  169. text_end = ORIGIN(m_text) + LENGTH(m_text);
  170. ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
  171. /* Uninitialized data section */
  172. .bss :
  173. {
  174. /* This is used by the startup in order to initialize the .bss section */
  175. . = ALIGN(4);
  176. __START_BSS = .;
  177. __bss_start__ = .;
  178. *(.bss)
  179. *(.bss*)
  180. *(COMMON)
  181. . = ALIGN(4);
  182. __bss_end__ = .;
  183. __END_BSS = .;
  184. } > m_data
  185. .heap :
  186. {
  187. . = ALIGN(8);
  188. __end__ = .;
  189. PROVIDE(end = .);
  190. __HeapBase = .;
  191. . += HEAP_SIZE;
  192. __HeapLimit = .;
  193. __heap_limit = .; /* Add for _sbrk */
  194. } > m_data_2
  195. .stack :
  196. {
  197. . = ALIGN(8);
  198. . += STACK_SIZE;
  199. } > m_data_2
  200. /* Initializes stack on the end of block */
  201. __StackTop = ORIGIN(m_data_2) + LENGTH(m_data_2);
  202. __StackLimit = __StackTop - STACK_SIZE;
  203. PROVIDE(__stack = __StackTop);
  204. .ARM.attributes 0 : { *(.ARM.attributes) }
  205. ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
  206. }