samd21j16a_flash.ld 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /**
  2. * \file
  3. *
  4. * \brief Linker script for running in internal FLASH on the SAMD21J16A
  5. *
  6. * Copyright (c) 2018 Microchip Technology Inc.
  7. *
  8. * \asf_license_start
  9. *
  10. * \page License
  11. *
  12. * SPDX-License-Identifier: Apache-2.0
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  15. * not use this file except in compliance with the License.
  16. * You may obtain a copy of the Licence at
  17. *
  18. * http://www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  22. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. * \asf_license_stop
  27. *
  28. */
  29. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  30. OUTPUT_ARCH(arm)
  31. SEARCH_DIR(.)
  32. /* Memory Spaces Definitions */
  33. MEMORY
  34. {
  35. rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000
  36. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00002000
  37. }
  38. /* The stack size used by the application. NOTE: you need to adjust according to your application. */
  39. STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x800;
  40. /* Section Definitions */
  41. SECTIONS
  42. {
  43. .text :
  44. {
  45. . = ALIGN(4);
  46. _sfixed = .;
  47. _stext = .;
  48. KEEP(*(.vectors .vectors.*))
  49. *(.text .text.* .gnu.linkonce.t.*)
  50. *(.glue_7t) *(.glue_7)
  51. *(.rodata .rodata* .gnu.linkonce.r.*)
  52. *(.ARM.extab* .gnu.linkonce.armextab.*)
  53. /* section information for finsh shell */
  54. . = ALIGN(4);
  55. __fsymtab_start = .;
  56. KEEP(*(FSymTab))
  57. __fsymtab_end = .;
  58. . = ALIGN(4);
  59. __vsymtab_start = .;
  60. KEEP(*(VSymTab))
  61. __vsymtab_end = .;
  62. /* section information for utest */
  63. . = ALIGN(4);
  64. __rt_utest_tc_tab_start = .;
  65. KEEP(*(UtestTcTab))
  66. __rt_utest_tc_tab_end = .;
  67. /* section information for at server */
  68. . = ALIGN(4);
  69. __rtatcmdtab_start = .;
  70. KEEP(*(RtAtCmdTab))
  71. __rtatcmdtab_end = .;
  72. . = ALIGN(4);
  73. /* section information for initial. */
  74. . = ALIGN(4);
  75. __rt_init_start = .;
  76. KEEP(*(SORT(.rti_fn*)))
  77. __rt_init_end = .;
  78. /* Support C constructors, and C destructors in both user code
  79. and the C library. This also provides support for C++ code. */
  80. . = ALIGN(4);
  81. KEEP(*(.init))
  82. . = ALIGN(4);
  83. __preinit_array_start = .;
  84. KEEP (*(.preinit_array))
  85. __preinit_array_end = .;
  86. . = ALIGN(4);
  87. __init_array_start = .;
  88. KEEP (*(SORT(.init_array.*)))
  89. KEEP (*(.init_array))
  90. __init_array_end = .;
  91. . = ALIGN(4);
  92. KEEP (*crtbegin.o(.ctors))
  93. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  94. KEEP (*(SORT(.ctors.*)))
  95. KEEP (*crtend.o(.ctors))
  96. . = ALIGN(4);
  97. KEEP(*(.fini))
  98. . = ALIGN(4);
  99. __fini_array_start = .;
  100. KEEP (*(.fini_array))
  101. KEEP (*(SORT(.fini_array.*)))
  102. __fini_array_end = .;
  103. KEEP (*crtbegin.o(.dtors))
  104. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  105. KEEP (*(SORT(.dtors.*)))
  106. KEEP (*crtend.o(.dtors))
  107. . = ALIGN(4);
  108. _efixed = .; /* End of text section */
  109. _etext = .;
  110. } > rom
  111. /* .ARM.exidx is sorted, so has to go in its own output section. */
  112. PROVIDE_HIDDEN (__exidx_start = .);
  113. .ARM.exidx :
  114. {
  115. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  116. } > rom
  117. PROVIDE_HIDDEN (__exidx_end = .);
  118. . = ALIGN(4);
  119. _etext = .;
  120. .relocate : AT (_etext)
  121. {
  122. . = ALIGN(4);
  123. _srelocate = .;
  124. *(.ramfunc .ramfunc.*);
  125. *(.data .data.*);
  126. . = ALIGN(4);
  127. _erelocate = .;
  128. } > ram
  129. /* stack section */
  130. .stack (NOLOAD):
  131. {
  132. . = ALIGN(8);
  133. _sstack = .;
  134. . = . + STACK_SIZE;
  135. . = ALIGN(8);
  136. _estack = .;
  137. } > ram
  138. /* .bss section which is used for uninitialized data */
  139. .bss (NOLOAD) :
  140. {
  141. . = ALIGN(4);
  142. _sbss = . ;
  143. _szero = .;
  144. *(.bss .bss.*)
  145. *(COMMON)
  146. . = ALIGN(4);
  147. _ebss = . ;
  148. _ezero = .;
  149. } > ram
  150. __bss_end = .;
  151. . = ALIGN(4);
  152. _end = . ;
  153. }