link.lds 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 2016 Freescale Semiconductor, Inc.
  15. ** Copyright 2016-2017 NXP
  16. ** All rights reserved.
  17. **
  18. ** Redistribution and use in source and binary forms, with or without modification,
  19. ** are permitted (subject to the limitations in the disclaimer below) provided
  20. ** that the following conditions are met:
  21. **
  22. ** 1. Redistributions of source code must retain the above copyright notice, this list
  23. ** of conditions and the following disclaimer.
  24. **
  25. ** 2. Redistributions in binary form must reproduce the above copyright notice, this
  26. ** list of conditions and the following disclaimer in the documentation and/or
  27. ** other materials provided with the distribution.
  28. **
  29. ** 3. Neither the name of the copyright holder nor the names of its
  30. ** contributors may be used to endorse or promote products derived from this
  31. ** software without specific prior written permission.
  32. **
  33. ** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  34. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  35. ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  36. ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  37. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  38. ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  39. ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  40. ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  41. ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  42. ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  43. ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44. **
  45. ** http: www.nxp.com
  46. ** mail: support@nxp.com
  47. **
  48. ** ###################################################################
  49. */
  50. /* Entry Point */
  51. ENTRY(Reset_Handler)
  52. HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
  53. STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800;
  54. RPMSG_SHMEM_SIZE = DEFINED(__use_shmem__) ? 0x1800 : 0;
  55. /* Specify the memory areas */
  56. MEMORY
  57. {
  58. m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000000E4
  59. m_text (RX) : ORIGIN = 0x000000E4, LENGTH = 0x0002FF1C
  60. m_core1_image (RX) : ORIGIN = 0x00030000, LENGTH = 0x00010000
  61. m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
  62. rpmsg_sh_mem (RW) : ORIGIN = 0x20026800, LENGTH = RPMSG_SHMEM_SIZE
  63. }
  64. /* Define output sections */
  65. SECTIONS
  66. {
  67. /* section for storing the secondary core image */
  68. .m0code :
  69. {
  70. . = ALIGN(4) ;
  71. KEEP (*(.m0code))
  72. *(.m0code*)
  73. . = ALIGN(4) ;
  74. } > m_core1_image
  75. /* NOINIT section for rpmsg_sh_mem */
  76. .noinit_rpmsg_sh_mem (NOLOAD) : ALIGN(4)
  77. {
  78. *(.noinit.$rpmsg_sh_mem*)
  79. . = ALIGN(4) ;
  80. } > rpmsg_sh_mem
  81. /* The startup code goes first into internal flash */
  82. .interrupts :
  83. {
  84. . = ALIGN(4);
  85. KEEP(*(.isr_vector)) /* Startup code */
  86. . = ALIGN(4);
  87. } > m_interrupts
  88. /* The program code and other data goes into internal flash */
  89. .text :
  90. {
  91. . = ALIGN(4);
  92. *(.text) /* .text sections (code) */
  93. *(.text*) /* .text* sections (code) */
  94. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  95. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  96. *(.glue_7) /* glue arm to thumb code */
  97. *(.glue_7t) /* glue thumb to arm code */
  98. *(.eh_frame)
  99. KEEP (*(.init))
  100. KEEP (*(.fini))
  101. . = ALIGN(4);
  102. /* section information for finsh shell */
  103. . = ALIGN(4);
  104. __fsymtab_start = .;
  105. KEEP(*(FSymTab))
  106. __fsymtab_end = .;
  107. . = ALIGN(4);
  108. __vsymtab_start = .;
  109. KEEP(*(VSymTab))
  110. __vsymtab_end = .;
  111. . = ALIGN(4);
  112. /* section information for initial. */
  113. . = ALIGN(4);
  114. __rt_init_start = .;
  115. KEEP(*(SORT(.rti_fn*)))
  116. __rt_init_end = .;
  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. .RTT_HEAP :
  213. {
  214. heap_start = .;
  215. . = ALIGN(8);
  216. } > m_data
  217. .stack :
  218. {
  219. . = ALIGN(8);
  220. . += STACK_SIZE;
  221. } > m_data
  222. PROVIDE(heap_end = ORIGIN(m_data) + LENGTH(m_data));
  223. /* Initializes stack on the end of block */
  224. __StackTop = ORIGIN(m_data) + LENGTH(m_data);
  225. __StackLimit = __StackTop - STACK_SIZE;
  226. PROVIDE(__stack = __StackTop);
  227. .ARM.attributes 0 : { *(.ARM.attributes) }
  228. }