LPC54114J256_cm0plus_flash.ld 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*
  2. ** ###################################################################
  3. ** Processors: LPC54114J256_cm0plus
  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 = 0x20010000, LENGTH = 0x000000C0
  59. m_text (RX) : ORIGIN = 0x200100C0, LENGTH = 0x0000FF3F
  60. m_data (RW) : ORIGIN = 0x20020000, LENGTH = 0x00007FFF - RPMSG_SHMEM_SIZE
  61. rpmsg_sh_mem (RW) : ORIGIN = 0x20026800, LENGTH = RPMSG_SHMEM_SIZE
  62. }
  63. /* Define output sections */
  64. SECTIONS
  65. {
  66. /* NOINIT section for rpmsg_sh_mem */
  67. .noinit_rpmsg_sh_mem (NOLOAD) : ALIGN(4)
  68. {
  69. *(.noinit.$rpmsg_sh_mem*)
  70. . = ALIGN(4) ;
  71. } > rpmsg_sh_mem
  72. /* The startup code goes first into internal flash */
  73. .interrupts :
  74. {
  75. . = ALIGN(4);
  76. KEEP(*(.isr_vector)) /* Startup code */
  77. . = ALIGN(4);
  78. } > m_interrupts
  79. /* The program code and other data goes into internal flash */
  80. .text :
  81. {
  82. . = ALIGN(4);
  83. *(.text) /* .text sections (code) */
  84. *(.text*) /* .text* sections (code) */
  85. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  86. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  87. *(.glue_7) /* glue arm to thumb code */
  88. *(.glue_7t) /* glue thumb to arm code */
  89. *(.eh_frame)
  90. KEEP (*(.init))
  91. KEEP (*(.fini))
  92. . = ALIGN(4);
  93. } > m_text
  94. .ARM.extab :
  95. {
  96. *(.ARM.extab* .gnu.linkonce.armextab.*)
  97. } > m_text
  98. .ARM :
  99. {
  100. __exidx_start = .;
  101. *(.ARM.exidx*)
  102. __exidx_end = .;
  103. } > m_text
  104. .ctors :
  105. {
  106. __CTOR_LIST__ = .;
  107. /* gcc uses crtbegin.o to find the start of
  108. the constructors, so we make sure it is
  109. first. Because this is a wildcard, it
  110. doesn't matter if the user does not
  111. actually link against crtbegin.o; the
  112. linker won't look for a file to match a
  113. wildcard. The wildcard also means that it
  114. doesn't matter which directory crtbegin.o
  115. is in. */
  116. KEEP (*crtbegin.o(.ctors))
  117. KEEP (*crtbegin?.o(.ctors))
  118. /* We don't want to include the .ctor section from
  119. from the crtend.o file until after the sorted ctors.
  120. The .ctor section from the crtend file contains the
  121. end of ctors marker and it must be last */
  122. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
  123. KEEP (*(SORT(.ctors.*)))
  124. KEEP (*(.ctors))
  125. __CTOR_END__ = .;
  126. } > m_text
  127. .dtors :
  128. {
  129. __DTOR_LIST__ = .;
  130. KEEP (*crtbegin.o(.dtors))
  131. KEEP (*crtbegin?.o(.dtors))
  132. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
  133. KEEP (*(SORT(.dtors.*)))
  134. KEEP (*(.dtors))
  135. __DTOR_END__ = .;
  136. } > m_text
  137. .preinit_array :
  138. {
  139. PROVIDE_HIDDEN (__preinit_array_start = .);
  140. KEEP (*(.preinit_array*))
  141. PROVIDE_HIDDEN (__preinit_array_end = .);
  142. } > m_text
  143. .init_array :
  144. {
  145. PROVIDE_HIDDEN (__init_array_start = .);
  146. KEEP (*(SORT(.init_array.*)))
  147. KEEP (*(.init_array*))
  148. PROVIDE_HIDDEN (__init_array_end = .);
  149. } > m_text
  150. .fini_array :
  151. {
  152. PROVIDE_HIDDEN (__fini_array_start = .);
  153. KEEP (*(SORT(.fini_array.*)))
  154. KEEP (*(.fini_array*))
  155. PROVIDE_HIDDEN (__fini_array_end = .);
  156. } > m_text
  157. __etext = .; /* define a global symbol at end of code */
  158. __DATA_ROM = .; /* Symbol is used by startup for data initialization */
  159. .data : AT(__DATA_ROM)
  160. {
  161. . = ALIGN(4);
  162. __DATA_RAM = .;
  163. __data_start__ = .; /* create a global symbol at data start */
  164. *(.ramfunc*) /* for functions in ram */
  165. *(.data) /* .data sections */
  166. *(.data*) /* .data* sections */
  167. KEEP(*(.jcr*))
  168. . = ALIGN(4);
  169. __data_end__ = .; /* define a global symbol at data end */
  170. } > m_data
  171. __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
  172. text_end = ORIGIN(m_text) + LENGTH(m_text);
  173. ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
  174. /* Uninitialized data section */
  175. .bss :
  176. {
  177. /* This is used by the startup in order to initialize the .bss section */
  178. . = ALIGN(4);
  179. __START_BSS = .;
  180. __bss_start__ = .;
  181. *(.bss)
  182. *(.bss*)
  183. *(COMMON)
  184. . = ALIGN(4);
  185. __bss_end__ = .;
  186. __END_BSS = .;
  187. } > m_data
  188. .heap :
  189. {
  190. . = ALIGN(8);
  191. __end__ = .;
  192. PROVIDE(end = .);
  193. __HeapBase = .;
  194. . += HEAP_SIZE;
  195. __HeapLimit = .;
  196. __heap_limit = .; /* Add for _sbrk */
  197. } > m_data
  198. .stack :
  199. {
  200. . = ALIGN(8);
  201. . += STACK_SIZE;
  202. } > m_data
  203. /* Initializes stack on the end of block */
  204. __StackTop = ORIGIN(m_data) + LENGTH(m_data);
  205. __StackLimit = __StackTop - STACK_SIZE;
  206. PROVIDE(__stack = __StackTop);
  207. .ARM.attributes 0 : { *(.ARM.attributes) }
  208. ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
  209. }