LPC54114J256_cm4_ram.ld 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /*
  2. ** ###################################################################
  3. ** Processors: LPC54114J256_cm4
  4. **
  5. ** Compiler: GNU C Compiler
  6. ** Reference manual: LPC54114 Series Reference Manual, Rev. 0 , 11/2016
  7. ** Version: rev. 1.0, 2016-11-02
  8. ** Build: b161214
  9. **
  10. ** Abstract:
  11. ** Linker file for the GNU C Compiler
  12. **
  13. ** The Clear BSD License
  14. ** Copyright (c) 2016 Freescale Semiconductor, Inc.
  15. ** Copyright (c) 2016 - 2017 , NXP
  16. ** All rights reserved.
  17. **
  18. **
  19. ** Redistribution and use in source and binary forms, with or without modification,
  20. ** are permitted (subject to the limitations in the disclaimer below) provided
  21. ** that the following conditions are met:
  22. **
  23. ** o Redistributions of source code must retain the above copyright notice, this list
  24. ** of conditions and the following disclaimer.
  25. **
  26. ** o Redistributions in binary form must reproduce the above copyright notice, this
  27. ** list of conditions and the following disclaimer in the documentation and/or
  28. ** other materials provided with the distribution.
  29. **
  30. ** o Neither the name of copyright holder nor the names of its
  31. ** contributors may be used to endorse or promote products derived from this
  32. ** software without specific prior written permission.
  33. **
  34. ** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  35. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  36. ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  37. ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  39. ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  40. ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  41. ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  42. ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  43. ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  44. ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  45. **
  46. ** http: www.freescale.com
  47. ** mail: support@freescale.com
  48. **
  49. ** Copyright 2016 Freescale Semiconductor, Inc.
  50. ** Copyright 2016-2017 NXP
  51. ** Redistribution and use in source and binary forms, with or without modification,
  52. ** are permitted provided that the following conditions are met:
  53. **
  54. ** 1. Redistributions of source code must retain the above copyright notice, this list
  55. ** of conditions and the following disclaimer.
  56. **
  57. ** 2. Redistributions in binary form must reproduce the above copyright notice, this
  58. ** list of conditions and the following disclaimer in the documentation and/or
  59. ** other materials provided with the distribution.
  60. **
  61. ** 3. Neither the name of the copyright holder nor the names of its
  62. ** contributors may be used to endorse or promote products derived from this
  63. ** software without specific prior written permission.
  64. **
  65. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  66. ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  67. ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  68. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  69. ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  70. ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  71. ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  72. ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  73. ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  74. ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  75. **
  76. ** http: www.nxp.com
  77. ** mail: support@nxp.com
  78. **
  79. ** ###################################################################
  80. */
  81. /* Entry Point */
  82. ENTRY(Reset_Handler)
  83. HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
  84. STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800;
  85. RPMSG_SHMEM_SIZE = DEFINED(__use_shmem__) ? 0x1800 : 0;
  86. /* Specify the memory areas */
  87. MEMORY
  88. {
  89. m_interrupts (RX) : ORIGIN = 0x20000000, LENGTH = 0x000000E0
  90. m_text (RX) : ORIGIN = 0x200000E0, LENGTH = 0x0001FF20
  91. m_data (RW) : ORIGIN = 0x20020000, LENGTH = 0x00008000
  92. }
  93. /* Define output sections */
  94. SECTIONS
  95. {
  96. /* The startup code goes first into internal flash */
  97. .interrupts :
  98. {
  99. . = ALIGN(4);
  100. KEEP(*(.isr_vector)) /* Startup code */
  101. . = ALIGN(4);
  102. } > m_interrupts
  103. /* The program code and other data goes into internal flash */
  104. .text :
  105. {
  106. . = ALIGN(4);
  107. *(.text) /* .text sections (code) */
  108. *(.text*) /* .text* sections (code) */
  109. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  110. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  111. *(.glue_7) /* glue arm to thumb code */
  112. *(.glue_7t) /* glue thumb to arm code */
  113. *(.eh_frame)
  114. KEEP (*(.init))
  115. KEEP (*(.fini))
  116. . = ALIGN(4);
  117. } > m_text
  118. .ARM.extab :
  119. {
  120. *(.ARM.extab* .gnu.linkonce.armextab.*)
  121. } > m_text
  122. .ARM :
  123. {
  124. __exidx_start = .;
  125. *(.ARM.exidx*)
  126. __exidx_end = .;
  127. } > m_text
  128. .ctors :
  129. {
  130. __CTOR_LIST__ = .;
  131. /* gcc uses crtbegin.o to find the start of
  132. the constructors, so we make sure it is
  133. first. Because this is a wildcard, it
  134. doesn't matter if the user does not
  135. actually link against crtbegin.o; the
  136. linker won't look for a file to match a
  137. wildcard. The wildcard also means that it
  138. doesn't matter which directory crtbegin.o
  139. is in. */
  140. KEEP (*crtbegin.o(.ctors))
  141. KEEP (*crtbegin?.o(.ctors))
  142. /* We don't want to include the .ctor section from
  143. from the crtend.o file until after the sorted ctors.
  144. The .ctor section from the crtend file contains the
  145. end of ctors marker and it must be last */
  146. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
  147. KEEP (*(SORT(.ctors.*)))
  148. KEEP (*(.ctors))
  149. __CTOR_END__ = .;
  150. } > m_text
  151. .dtors :
  152. {
  153. __DTOR_LIST__ = .;
  154. KEEP (*crtbegin.o(.dtors))
  155. KEEP (*crtbegin?.o(.dtors))
  156. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
  157. KEEP (*(SORT(.dtors.*)))
  158. KEEP (*(.dtors))
  159. __DTOR_END__ = .;
  160. } > m_text
  161. .preinit_array :
  162. {
  163. PROVIDE_HIDDEN (__preinit_array_start = .);
  164. KEEP (*(.preinit_array*))
  165. PROVIDE_HIDDEN (__preinit_array_end = .);
  166. } > m_text
  167. .init_array :
  168. {
  169. PROVIDE_HIDDEN (__init_array_start = .);
  170. KEEP (*(SORT(.init_array.*)))
  171. KEEP (*(.init_array*))
  172. PROVIDE_HIDDEN (__init_array_end = .);
  173. } > m_text
  174. .fini_array :
  175. {
  176. PROVIDE_HIDDEN (__fini_array_start = .);
  177. KEEP (*(SORT(.fini_array.*)))
  178. KEEP (*(.fini_array*))
  179. PROVIDE_HIDDEN (__fini_array_end = .);
  180. } > m_text
  181. __etext = .; /* define a global symbol at end of code */
  182. __DATA_ROM = .; /* Symbol is used by startup for data initialization */
  183. .data : AT(__DATA_ROM)
  184. {
  185. . = ALIGN(4);
  186. __DATA_RAM = .;
  187. __data_start__ = .; /* create a global symbol at data start */
  188. *(.ramfunc*) /* for functions in ram */
  189. *(.data) /* .data sections */
  190. *(.data*) /* .data* sections */
  191. KEEP(*(.jcr*))
  192. . = ALIGN(4);
  193. __data_end__ = .; /* define a global symbol at data end */
  194. } > m_data
  195. __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
  196. text_end = ORIGIN(m_text) + LENGTH(m_text);
  197. ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
  198. /* Uninitialized data section */
  199. .bss :
  200. {
  201. /* This is used by the startup in order to initialize the .bss section */
  202. . = ALIGN(4);
  203. __START_BSS = .;
  204. __bss_start__ = .;
  205. *(.bss)
  206. *(.bss*)
  207. *(COMMON)
  208. . = ALIGN(4);
  209. __bss_end__ = .;
  210. __END_BSS = .;
  211. } > m_data
  212. .heap :
  213. {
  214. . = ALIGN(8);
  215. __end__ = .;
  216. PROVIDE(end = .);
  217. __HeapBase = .;
  218. . += HEAP_SIZE;
  219. __HeapLimit = .;
  220. __heap_limit = .; /* Add for _sbrk */
  221. } > m_data
  222. .stack :
  223. {
  224. . = ALIGN(8);
  225. . += STACK_SIZE;
  226. } > m_data
  227. /* Initializes stack on the end of block */
  228. __StackTop = ORIGIN(m_data) + LENGTH(m_data);
  229. __StackLimit = __StackTop - STACK_SIZE;
  230. PROVIDE(__stack = __StackTop);
  231. .ARM.attributes 0 : { *(.ARM.attributes) }
  232. ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
  233. }