saml11e16a_sram.ld 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /**
  2. * \file
  3. *
  4. * \brief GCC linker script (sram) for ATSAML11E16A
  5. *
  6. * Copyright (c) 2018 Microchip Technology Inc.
  7. *
  8. * \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");
  15. * you may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License 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,
  22. * WITHOUT 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. * \license_stop
  27. *
  28. */
  29. /*------------------------------------------------------------------------------
  30. * Linker script for running in internal SRAM on the ATSAML11E16A
  31. *----------------------------------------------------------------------------*/
  32. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  33. OUTPUT_ARCH(arm)
  34. SEARCH_DIR(.)
  35. /* Memory Spaces Definitions */
  36. MEMORY
  37. {
  38. rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 /* rom, 65536K */
  39. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 /* ram, 16384K */
  40. }
  41. /* The stack size used by the application. NOTE: you need to adjust according to your application. */
  42. STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
  43. /* The heapsize used by the application. NOTE: you need to adjust according to your application. */
  44. HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : DEFINED(__heap_size__) ? __heap_size__ : 0x0200;
  45. /* Section Definitions */
  46. SECTIONS
  47. {
  48. .text :
  49. {
  50. . = ALIGN(4);
  51. _sfixed = .;
  52. KEEP(*(.vectors .vectors.*))
  53. *(.text .text.* .gnu.linkonce.t.*)
  54. *(.glue_7t) *(.glue_7)
  55. *(.rodata .rodata* .gnu.linkonce.r.*)
  56. *(.ARM.extab* .gnu.linkonce.armextab.*)
  57. /* Support C constructors, and C destructors in both user code
  58. and the C library. This also provides support for C++ code. */
  59. . = ALIGN(4);
  60. KEEP(*(.init))
  61. . = ALIGN(4);
  62. __preinit_array_start = .;
  63. KEEP (*(.preinit_array))
  64. __preinit_array_end = .;
  65. . = ALIGN(4);
  66. __init_array_start = .;
  67. KEEP (*(SORT(.init_array.*)))
  68. KEEP (*(.init_array))
  69. __init_array_end = .;
  70. . = ALIGN(4);
  71. KEEP (*crtbegin.o(.ctors))
  72. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  73. KEEP (*(SORT(.ctors.*)))
  74. KEEP (*crtend.o(.ctors))
  75. . = ALIGN(4);
  76. KEEP(*(.fini))
  77. . = ALIGN(4);
  78. __fini_array_start = .;
  79. KEEP (*(.fini_array))
  80. KEEP (*(SORT(.fini_array.*)))
  81. __fini_array_end = .;
  82. KEEP (*crtbegin.o(.dtors))
  83. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  84. KEEP (*(SORT(.dtors.*)))
  85. KEEP (*crtend.o(.dtors))
  86. . = ALIGN(4);
  87. _efixed = .; /* End of text section */
  88. } > ram
  89. . = ALIGN(4);
  90. _etext = .;
  91. .relocate : AT (_etext)
  92. {
  93. . = ALIGN(4);
  94. _srelocate = .;
  95. *(.ramfunc .ramfunc.*);
  96. *(.data .data.*);
  97. . = ALIGN(4);
  98. _erelocate = .;
  99. } > ram
  100. /* .bss section which is used for uninitialized data */
  101. .bss (NOLOAD) :
  102. {
  103. . = ALIGN(4);
  104. _sbss = . ;
  105. _szero = .;
  106. *(.bss .bss.*)
  107. *(COMMON)
  108. . = ALIGN(4);
  109. _ebss = . ;
  110. _ezero = .;
  111. } > ram
  112. /* heap section */
  113. .heap (NOLOAD):
  114. {
  115. . = ALIGN(8);
  116. _sheap = .;
  117. . = . + HEAP_SIZE;
  118. . = ALIGN(8);
  119. _eheap = .;
  120. } > ram
  121. /* stack section */
  122. .stack (NOLOAD):
  123. {
  124. . = ALIGN(8);
  125. _sstack = .;
  126. . = . + STACK_SIZE;
  127. . = ALIGN(8);
  128. _estack = .;
  129. } > ram
  130. /* .ARM.exidx is sorted, so has to go in its own output section. */
  131. PROVIDE_HIDDEN (__exidx_start = .);
  132. .ARM.exidx :
  133. {
  134. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  135. } > ram
  136. PROVIDE_HIDDEN (__exidx_end = .);
  137. . = ALIGN(4);
  138. _end = . ;
  139. _ram_end_ = ORIGIN(ram) + LENGTH(ram) - 1 ;
  140. }