saml11e16a_flash.ld 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /**
  2. * \file
  3. *
  4. * \brief GCC linker script (flash) 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 FLASH 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. } > rom
  89. /* .ARM.exidx is sorted, so has to go in its own output section. */
  90. PROVIDE_HIDDEN (__exidx_start = .);
  91. .ARM.exidx :
  92. {
  93. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  94. } > rom
  95. PROVIDE_HIDDEN (__exidx_end = .);
  96. . = ALIGN(4);
  97. _etext = .;
  98. .relocate : AT (_etext)
  99. {
  100. . = ALIGN(4);
  101. _srelocate = .;
  102. *(.ramfunc .ramfunc.*);
  103. *(.data .data.*);
  104. . = ALIGN(4);
  105. _erelocate = .;
  106. } > ram
  107. /* .bss section which is used for uninitialized data */
  108. .bss (NOLOAD) :
  109. {
  110. . = ALIGN(4);
  111. _sbss = . ;
  112. _szero = .;
  113. *(.bss .bss.*)
  114. *(COMMON)
  115. . = ALIGN(4);
  116. _ebss = . ;
  117. _ezero = .;
  118. } > ram
  119. /* heap section */
  120. .heap (NOLOAD):
  121. {
  122. . = ALIGN(8);
  123. _sheap = .;
  124. end = _sheap;
  125. . = . + HEAP_SIZE;
  126. . = ALIGN(8);
  127. _eheap = .;
  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. . = ALIGN(4);
  139. _end = . ;
  140. _ram_end_ = ORIGIN(ram) + LENGTH(ram) - 1 ;
  141. }