MCXA153_flash.ld 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. ** ###################################################################
  3. ** Processors: MCXA153VFM
  4. ** MCXA153VFT
  5. ** MCXA153VLH
  6. **
  7. ** Compiler: GNU C Compiler
  8. ** Reference manual: MCXA1 User manual
  9. ** Version: rev. 1.0, 2022-03-29
  10. ** Build: b230411
  11. **
  12. ** Abstract:
  13. ** Linker file for the GNU C Compiler
  14. **
  15. ** Copyright 2016 Freescale Semiconductor, Inc.
  16. ** Copyright 2016-2023 NXP
  17. ** SPDX-License-Identifier: BSD-3-Clause
  18. **
  19. ** http: www.nxp.com
  20. ** mail: support@nxp.com
  21. **
  22. ** ###################################################################
  23. */
  24. /* Entry Point */
  25. ENTRY(Reset_Handler)
  26. HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
  27. STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800;
  28. /* Specify the memory areas */
  29. MEMORY
  30. {
  31. m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200
  32. m_text (RX) : ORIGIN = 0x00000200, LENGTH = 0x0001FE00
  33. m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00006000
  34. m_sramx0 (RW) : ORIGIN = 0x04000000, LENGTH = 0x00002000
  35. }
  36. /* Define output sections */
  37. SECTIONS
  38. {
  39. /* The startup code goes first into internal flash */
  40. .interrupts :
  41. {
  42. . = ALIGN(4);
  43. KEEP(*(.isr_vector)) /* Startup code */
  44. . = ALIGN(4);
  45. } > m_interrupts
  46. /* The program code and other data goes into internal flash */
  47. .text :
  48. {
  49. . = ALIGN(4);
  50. *(.text) /* .text sections (code) */
  51. *(.text*) /* .text* sections (code) */
  52. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  53. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  54. *(.glue_7) /* glue arm to thumb code */
  55. *(.glue_7t) /* glue thumb to arm code */
  56. *(.eh_frame)
  57. KEEP (*(.init))
  58. KEEP (*(.fini))
  59. . = ALIGN(4);
  60. } > m_text
  61. .rtt_const_tables :
  62. {
  63. /* section information for finsh shell */
  64. . = ALIGN(4);
  65. __fsymtab_start = .;
  66. KEEP(*(FSymTab))
  67. __fsymtab_end = .;
  68. . = ALIGN(4);
  69. __vsymtab_start = .;
  70. KEEP(*(VSymTab))
  71. __vsymtab_end = .;
  72. /* section information for initial. */
  73. . = ALIGN(4);
  74. __rt_init_start = .;
  75. KEEP(*(SORT(.rti_fn*)))
  76. __rt_init_end = .;
  77. } > m_text
  78. .ARM.extab :
  79. {
  80. *(.ARM.extab* .gnu.linkonce.armextab.*)
  81. } > m_text
  82. .ARM :
  83. {
  84. __exidx_start = .;
  85. *(.ARM.exidx*)
  86. __exidx_end = .;
  87. } > m_text
  88. .ctors :
  89. {
  90. __CTOR_LIST__ = .;
  91. /* gcc uses crtbegin.o to find the start of
  92. the constructors, so we make sure it is
  93. first. Because this is a wildcard, it
  94. doesn't matter if the user does not
  95. actually link against crtbegin.o; the
  96. linker won't look for a file to match a
  97. wildcard. The wildcard also means that it
  98. doesn't matter which directory crtbegin.o
  99. is in. */
  100. KEEP (*crtbegin.o(.ctors))
  101. KEEP (*crtbegin?.o(.ctors))
  102. /* We don't want to include the .ctor section from
  103. from the crtend.o file until after the sorted ctors.
  104. The .ctor section from the crtend file contains the
  105. end of ctors marker and it must be last */
  106. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
  107. KEEP (*(SORT(.ctors.*)))
  108. KEEP (*(.ctors))
  109. __CTOR_END__ = .;
  110. } > m_text
  111. .dtors :
  112. {
  113. __DTOR_LIST__ = .;
  114. KEEP (*crtbegin.o(.dtors))
  115. KEEP (*crtbegin?.o(.dtors))
  116. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
  117. KEEP (*(SORT(.dtors.*)))
  118. KEEP (*(.dtors))
  119. __DTOR_END__ = .;
  120. } > m_text
  121. .preinit_array :
  122. {
  123. PROVIDE_HIDDEN (__preinit_array_start = .);
  124. KEEP (*(.preinit_array*))
  125. PROVIDE_HIDDEN (__preinit_array_end = .);
  126. } > m_text
  127. .init_array :
  128. {
  129. PROVIDE_HIDDEN (__init_array_start = .);
  130. KEEP (*(SORT(.init_array.*)))
  131. KEEP (*(.init_array*))
  132. PROVIDE_HIDDEN (__init_array_end = .);
  133. } > m_text
  134. .fini_array :
  135. {
  136. PROVIDE_HIDDEN (__fini_array_start = .);
  137. KEEP (*(SORT(.fini_array.*)))
  138. KEEP (*(.fini_array*))
  139. PROVIDE_HIDDEN (__fini_array_end = .);
  140. } > m_text
  141. __etext = .; /* define a global symbol at end of code */
  142. __DATA_ROM = .; /* Symbol is used by startup for data initialization */
  143. .data : AT(__DATA_ROM)
  144. {
  145. . = ALIGN(4);
  146. __DATA_RAM = .;
  147. __data_start__ = .; /* create a global symbol at data start */
  148. *(.ramfunc*) /* for functions in ram */
  149. *(.data) /* .data sections */
  150. *(.data*) /* .data* sections */
  151. KEEP(*(.jcr*))
  152. . = ALIGN(4);
  153. __data_end__ = .; /* define a global symbol at data end */
  154. } > m_data
  155. __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
  156. text_end = ORIGIN(m_text) + LENGTH(m_text);
  157. ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
  158. /* Uninitialized data section */
  159. .bss :
  160. {
  161. /* This is used by the startup in order to initialize the .bss section */
  162. . = ALIGN(4);
  163. __START_BSS = .;
  164. __bss_start__ = .;
  165. *(.bss)
  166. *(.bss*)
  167. *(COMMON)
  168. . = ALIGN(4);
  169. __bss_end__ = .;
  170. __END_BSS = .;
  171. } > m_data
  172. .heap :
  173. {
  174. . = ALIGN(8);
  175. __end__ = .;
  176. PROVIDE(end = .);
  177. __HeapBase = .;
  178. . += HEAP_SIZE;
  179. __HeapLimit = .;
  180. __heap_limit = .; /* Add for _sbrk */
  181. } > m_data
  182. .stack :
  183. {
  184. . = ALIGN(8);
  185. . += STACK_SIZE;
  186. } > m_data
  187. /* Initializes stack on the end of block */
  188. __StackTop = ORIGIN(m_data) + LENGTH(m_data);
  189. __StackLimit = __StackTop - STACK_SIZE;
  190. PROVIDE(__stack = __StackTop);
  191. .ARM.attributes 0 : { *(.ARM.attributes) }
  192. ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
  193. }