LPC55S06_flash.ld 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. ** ###################################################################
  3. ** Processors: LPC55S06JBD64
  4. ** LPC55S06JHI48
  5. **
  6. ** Compiler: GNU C Compiler
  7. ** Reference manual: LPC55S0x/LPC550x User manual Rev.0.3 14 August 2020
  8. ** Version: rev. 1.0, 2020-04-09
  9. ** Build: b220622
  10. **
  11. ** Abstract:
  12. ** Linker file for the GNU C Compiler
  13. **
  14. ** Copyright 2016 Freescale Semiconductor, Inc.
  15. ** Copyright 2016-2022 NXP
  16. ** All rights reserved.
  17. **
  18. ** SPDX-License-Identifier: BSD-3-Clause
  19. **
  20. ** http: www.nxp.com
  21. ** mail: support@nxp.com
  22. **
  23. ** ###################################################################
  24. */
  25. /* Entry Point */
  26. ENTRY(Reset_Handler)
  27. HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
  28. STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800;
  29. /* Specify the memory areas */
  30. MEMORY
  31. {
  32. m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200
  33. m_text (RX) : ORIGIN = 0x00000200, LENGTH = 0x0003CE00
  34. m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
  35. m_sramx (RW) : ORIGIN = 0x04000000, LENGTH = 0x00004000
  36. m_sram3 (RW) : ORIGIN = 0x20010000, 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. /* Initializes stack on the end of block */
  173. __StackTop = ORIGIN(m_data) + LENGTH(m_data);
  174. __StackLimit = __StackTop - STACK_SIZE;
  175. PROVIDE(__stack = __StackTop);
  176. .ARM.attributes 0 : { *(.ARM.attributes) }
  177. ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
  178. }