LPC55S16_flash.ld 5.6 KB

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