lpc824_flash.ld 5.8 KB

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