sam4lc2a_sram.ld 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /**
  2. * \file
  3. *
  4. * \brief Linker script for running in internal SRAM on the SAM4LC2A
  5. *
  6. * Copyright (c) 2014 Atmel Corporation. All rights reserved.
  7. *
  8. * \asf_license_start
  9. *
  10. * \page License
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions are met:
  14. *
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. *
  18. * 2. Redistributions in binary form must reproduce the above copyright notice,
  19. * this list of conditions and the following disclaimer in the documentation
  20. * and/or other materials provided with the distribution.
  21. *
  22. * 3. The name of Atmel may not be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * 4. This software may only be redistributed and used in connection with an
  26. * Atmel microcontroller product.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  29. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  30. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  31. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  32. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  37. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. * POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. * \asf_license_stop
  41. *
  42. */
  43. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  44. OUTPUT_ARCH(arm)
  45. SEARCH_DIR(.)
  46. /* Memory Spaces Definitions */
  47. MEMORY
  48. {
  49. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
  50. hramc1 (rwx) : ORIGIN = 0x21000000, LENGTH = 0x00000800
  51. }
  52. /* The stack size used by the application. NOTE: you need to adjust according to your application. */
  53. STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
  54. /* Section Definitions */
  55. SECTIONS
  56. {
  57. .text :
  58. {
  59. . = ALIGN(4);
  60. _sfixed = .;
  61. KEEP(*(.vectors .vectors.*))
  62. *(.text .text.* .gnu.linkonce.t.*)
  63. *(.glue_7t) *(.glue_7)
  64. *(.rodata .rodata* .gnu.linkonce.r.*)
  65. *(.ARM.extab* .gnu.linkonce.armextab.*)
  66. /* Support C constructors, and C destructors in both user code
  67. and the C library. This also provides support for C++ code. */
  68. . = ALIGN(4);
  69. KEEP(*(.init))
  70. . = ALIGN(4);
  71. __preinit_array_start = .;
  72. KEEP (*(.preinit_array))
  73. __preinit_array_end = .;
  74. . = ALIGN(4);
  75. __init_array_start = .;
  76. KEEP (*(SORT(.init_array.*)))
  77. KEEP (*(.init_array))
  78. __init_array_end = .;
  79. . = ALIGN(4);
  80. KEEP (*crtbegin.o(.ctors))
  81. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  82. KEEP (*(SORT(.ctors.*)))
  83. KEEP (*crtend.o(.ctors))
  84. . = ALIGN(4);
  85. KEEP(*(.fini))
  86. . = ALIGN(4);
  87. __fini_array_start = .;
  88. KEEP (*(.fini_array))
  89. KEEP (*(SORT(.fini_array.*)))
  90. __fini_array_end = .;
  91. KEEP (*crtbegin.o(.dtors))
  92. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  93. KEEP (*(SORT(.dtors.*)))
  94. KEEP (*crtend.o(.dtors))
  95. . = ALIGN(4);
  96. _efixed = .; /* End of text section */
  97. } > ram
  98. . = ALIGN(4);
  99. _etext = .;
  100. .relocate : AT (_etext)
  101. {
  102. . = ALIGN(4);
  103. _srelocate = .;
  104. *(.ramfunc .ramfunc.*);
  105. *(.data .data.*);
  106. . = ALIGN(4);
  107. _erelocate = .;
  108. } > ram
  109. /* .bss section which is used for uninitialized data */
  110. .bss (NOLOAD) :
  111. {
  112. . = ALIGN(4);
  113. _sbss = . ;
  114. _szero = .;
  115. *(.bss .bss.*)
  116. *(COMMON)
  117. . = ALIGN(4);
  118. _ebss = . ;
  119. _ezero = .;
  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. }