sam4lc2a_flash.ld 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /**
  2. * \file
  3. *
  4. * \brief Linker script for running in internal FLASH 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. rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000
  50. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
  51. hramc1 (rwx) : ORIGIN = 0x21000000, LENGTH = 0x00000800
  52. }
  53. /* The stack size used by the application. NOTE: you need to adjust according to your application. */
  54. STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
  55. /* Section Definitions */
  56. SECTIONS
  57. {
  58. .text :
  59. {
  60. . = ALIGN(4);
  61. _sfixed = .;
  62. KEEP(*(.vectors .vectors.*))
  63. *(.text .text.* .gnu.linkonce.t.*)
  64. *(.glue_7t) *(.glue_7)
  65. *(.rodata .rodata* .gnu.linkonce.r.*)
  66. *(.ARM.extab* .gnu.linkonce.armextab.*)
  67. /* Support C constructors, and C destructors in both user code
  68. and the C library. This also provides support for C++ code. */
  69. . = ALIGN(4);
  70. KEEP(*(.init))
  71. . = ALIGN(4);
  72. __preinit_array_start = .;
  73. KEEP (*(.preinit_array))
  74. __preinit_array_end = .;
  75. . = ALIGN(4);
  76. __init_array_start = .;
  77. KEEP (*(SORT(.init_array.*)))
  78. KEEP (*(.init_array))
  79. __init_array_end = .;
  80. . = ALIGN(4);
  81. KEEP (*crtbegin.o(.ctors))
  82. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  83. KEEP (*(SORT(.ctors.*)))
  84. KEEP (*crtend.o(.ctors))
  85. . = ALIGN(4);
  86. KEEP(*(.fini))
  87. . = ALIGN(4);
  88. __fini_array_start = .;
  89. KEEP (*(.fini_array))
  90. KEEP (*(SORT(.fini_array.*)))
  91. __fini_array_end = .;
  92. KEEP (*crtbegin.o(.dtors))
  93. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  94. KEEP (*(SORT(.dtors.*)))
  95. KEEP (*crtend.o(.dtors))
  96. . = ALIGN(4);
  97. _efixed = .; /* End of text section */
  98. } > rom
  99. /* .ARM.exidx is sorted, so has to go in its own output section. */
  100. PROVIDE_HIDDEN (__exidx_start = .);
  101. .ARM.exidx :
  102. {
  103. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  104. } > rom
  105. PROVIDE_HIDDEN (__exidx_end = .);
  106. . = ALIGN(4);
  107. _etext = .;
  108. .relocate : AT (_etext)
  109. {
  110. . = ALIGN(4);
  111. _srelocate = .;
  112. *(.ramfunc .ramfunc.*);
  113. *(.data .data.*);
  114. . = ALIGN(4);
  115. _erelocate = .;
  116. } > ram
  117. /* .bss section which is used for uninitialized data */
  118. .bss (NOLOAD) :
  119. {
  120. . = ALIGN(4);
  121. _sbss = . ;
  122. _szero = .;
  123. *(.bss .bss.*)
  124. *(COMMON)
  125. . = ALIGN(4);
  126. _ebss = . ;
  127. _ezero = .;
  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. }