LPC55S36_flash.ld 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /*
  2. ** ###################################################################
  3. ** Processors: LPC55S36JBD100
  4. ** LPC55S36JHI48
  5. **
  6. ** Compiler: GNU C Compiler
  7. ** Reference manual: LPC55S3x Reference Manual Rev. DraftG, 07/2021
  8. ** Version: rev. 1.1, 2021-08-04
  9. ** Build: b210913
  10. **
  11. ** Abstract:
  12. ** Linker file for the GNU C Compiler
  13. **
  14. ** Copyright 2016 Freescale Semiconductor, Inc.
  15. ** Copyright 2016-2021 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. /* __pkc__ : SRAM A(16K) reserved for; pkc __power_down__ : The first 0x604 bytes reserved to CPU retention for power down mode */
  30. RETENTION_RAMSIZE = DEFINED(__pkc__) ? 0x00004000 : (DEFINED(__power_down__) ? 0x00000604 : 0x00000000);
  31. POWERQUAD_RAMSIZE = DEFINED(__powerquad__) ? 0x00004000 : 0x00000000; /* SRAM E(16K) reserved for powerquad */
  32. /* Specify the memory areas */
  33. MEMORY
  34. {
  35. m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
  36. m_text (RX) : ORIGIN = 0x00000400, LENGTH = 0x0003D400
  37. m_data (RW) : ORIGIN = 0x20000000 + RETENTION_RAMSIZE, LENGTH = 0x0001C000 - RETENTION_RAMSIZE - POWERQUAD_RAMSIZE
  38. m_sramx (RW) : ORIGIN = 0x04000000, 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. /* Initializes stack on the end of block */
  175. __StackTop = ORIGIN(m_data) + LENGTH(m_data);
  176. __StackLimit = __StackTop - STACK_SIZE;
  177. PROVIDE(__stack = __StackTop);
  178. .ARM.attributes 0 : { *(.ARM.attributes) }
  179. ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
  180. }