LPC55S28_flash.ld 5.6 KB

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