same54p20a_sram.ld 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /**
  2. * \file
  3. *
  4. * \brief Linker script for running in internal SRAM on the SAME54P20A
  5. *
  6. * Copyright (c) 2019 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. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000
  36. bkupram (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000
  37. qspi (rwx) : ORIGIN = 0x04000000, LENGTH = 0x01000000
  38. }
  39. /* The stack size used by the application. NOTE: you need to adjust according to your application. */
  40. STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x10000;
  41. /* Section Definitions */
  42. SECTIONS
  43. {
  44. .text :
  45. {
  46. . = ALIGN(4);
  47. _sfixed = .;
  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. /* Support C constructors, and C destructors in both user code
  54. and the C library. This also provides support for C++ code. */
  55. . = ALIGN(4);
  56. KEEP(*(.init))
  57. . = ALIGN(4);
  58. __preinit_array_start = .;
  59. KEEP (*(.preinit_array))
  60. __preinit_array_end = .;
  61. . = ALIGN(4);
  62. __init_array_start = .;
  63. KEEP (*(SORT(.init_array.*)))
  64. KEEP (*(.init_array))
  65. __init_array_end = .;
  66. . = ALIGN(4);
  67. KEEP (*crtbegin.o(.ctors))
  68. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  69. KEEP (*(SORT(.ctors.*)))
  70. KEEP (*crtend.o(.ctors))
  71. . = ALIGN(4);
  72. KEEP(*(.fini))
  73. . = ALIGN(4);
  74. __fini_array_start = .;
  75. KEEP (*(.fini_array))
  76. KEEP (*(SORT(.fini_array.*)))
  77. __fini_array_end = .;
  78. KEEP (*crtbegin.o(.dtors))
  79. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  80. KEEP (*(SORT(.dtors.*)))
  81. KEEP (*crtend.o(.dtors))
  82. . = ALIGN(4);
  83. _efixed = .; /* End of text section */
  84. } > ram
  85. /* .ARM.exidx is sorted, so has to go in its own output section. */
  86. PROVIDE_HIDDEN (__exidx_start = .);
  87. .ARM.exidx :
  88. {
  89. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  90. } > ram
  91. PROVIDE_HIDDEN (__exidx_end = .);
  92. . = ALIGN(4);
  93. _etext = .;
  94. .relocate : AT (_etext)
  95. {
  96. . = ALIGN(4);
  97. _srelocate = .;
  98. *(.ramfunc .ramfunc.*);
  99. *(.data .data.*);
  100. . = ALIGN(4);
  101. _erelocate = .;
  102. } > ram
  103. .bkupram (NOLOAD):
  104. {
  105. . = ALIGN(8);
  106. _sbkupram = .;
  107. *(.bkupram .bkupram.*);
  108. . = ALIGN(8);
  109. _ebkupram = .;
  110. } > bkupram
  111. .qspi (NOLOAD):
  112. {
  113. . = ALIGN(8);
  114. _sqspi = .;
  115. *(.qspi .qspi.*);
  116. . = ALIGN(8);
  117. _eqspi = .;
  118. } > qspi
  119. /* .bss section which is used for uninitialized data */
  120. .bss (NOLOAD) :
  121. {
  122. . = ALIGN(4);
  123. _sbss = . ;
  124. _szero = .;
  125. *(.bss .bss.*)
  126. *(COMMON)
  127. . = ALIGN(4);
  128. _ebss = . ;
  129. _ezero = .;
  130. } > ram
  131. /* stack section */
  132. .stack (NOLOAD):
  133. {
  134. . = ALIGN(8);
  135. _sstack = .;
  136. . = . + STACK_SIZE;
  137. . = ALIGN(8);
  138. _estack = .;
  139. } > ram
  140. . = ALIGN(4);
  141. _end = . ;
  142. }