same51j19a_flash.ld 4.0 KB

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