link.ld 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* memory map */
  2. MEMORY
  3. {
  4. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 7680K
  5. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
  6. TCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
  7. }
  8. ENTRY(Reset_Handler)
  9. /* Provide the stack pointer at the end of RAM */
  10. _estack = ORIGIN(RAM) + LENGTH(RAM);
  11. SECTIONS
  12. {
  13. __stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
  14. __heap_size = DEFINED(__heap_size) ? __heap_size : 1K;
  15. /* ISR vectors */
  16. .vectors :
  17. {
  18. . = ALIGN(4);
  19. __Vectors = .;
  20. KEEP(*(.vectors))
  21. KEEP(*(.isr_vector)) /* Also keep .isr_vector for compatibility */
  22. . = ALIGN(4);
  23. __Vectors_End = .;
  24. __Vectors_Size = __Vectors_End - __Vectors;
  25. } >FLASH
  26. /* text section, such as program code */
  27. .text :
  28. {
  29. . = ALIGN(4);
  30. _stext = .;
  31. *(.text)
  32. *(.text*)
  33. *(.glue_7)
  34. *(.glue_7t)
  35. *(.eh_frame)
  36. *(.gnu.linkonce.t*)
  37. KEEP (*(.init))
  38. KEEP (*(.fini))
  39. /* section information for finsh shell */
  40. . = ALIGN(4);
  41. __fsymtab_start = .;
  42. KEEP(*(FSymTab))
  43. __fsymtab_end = .;
  44. . = ALIGN(4);
  45. __vsymtab_start = .;
  46. KEEP(*(VSymTab))
  47. __vsymtab_end = .;
  48. . = ALIGN(4);
  49. /* section information for initial. */
  50. . = ALIGN(4);
  51. __rt_init_start = .;
  52. KEEP(*(SORT(.rti_fn*)))
  53. __rt_init_end = .;
  54. . = ALIGN(4);
  55. /* the symbol '_etext' will be defined at the end of code section */
  56. . = ALIGN(4);
  57. _etext = .;
  58. } >FLASH
  59. /* ro-data section, such as constant data */
  60. .rodata :
  61. {
  62. . = ALIGN(4);
  63. *(.rodata)
  64. *(.rodata*)
  65. . = ALIGN(4);
  66. } >FLASH
  67. /* exception process table */
  68. .ARM.extab :
  69. {
  70. *(.ARM.extab* .gnu.linkonce.armextab.*)
  71. } >FLASH
  72. /* exception process table index */
  73. .ARM :
  74. {
  75. __exidx_start = .;
  76. *(.ARM.exidx*)
  77. __exidx_end = .;
  78. } >FLASH
  79. /* ARM attributes */
  80. .ARM.attributes :
  81. {
  82. *(.ARM.attributes)
  83. } >FLASH
  84. .preinit_array :
  85. {
  86. PROVIDE_HIDDEN (__preinit_array_start = .);
  87. KEEP (*(.preinit_array*))
  88. PROVIDE_HIDDEN (__preinit_array_end = .);
  89. } >FLASH
  90. .init_array :
  91. {
  92. PROVIDE_HIDDEN (__init_array_start = .);
  93. KEEP (*(SORT(.init_array.*)))
  94. KEEP (*(.init_array*))
  95. PROVIDE_HIDDEN (__init_array_end = .);
  96. } >FLASH
  97. .fini_array :
  98. {
  99. PROVIDE_HIDDEN (__fini_array_start = .);
  100. KEEP (*(.fini_array*))
  101. KEEP (*(SORT(.fini_array.*)))
  102. PROVIDE_HIDDEN (__fini_array_end = .);
  103. } >FLASH
  104. /* provide some necessary symbols for initialized data */
  105. _sidata = LOADADDR(.data);
  106. .data :
  107. {
  108. . = ALIGN(4);
  109. /* the symbol '_sdata' will be defined at the data section end start */
  110. _sdata = .;
  111. *(.data)
  112. *(.data*)
  113. . = ALIGN(4);
  114. /* the symbol '_edata' will be defined at the data section end */
  115. _edata = .;
  116. } > RAM AT> FLASH
  117. /* provide some necessary symbols for uninitialized data */
  118. . = ALIGN(4);
  119. .bss :
  120. {
  121. . = ALIGN(4);
  122. /* the symbol '_sbss' will be defined at the bss section start */
  123. _sbss = .;
  124. __bss_start__ = _sbss;
  125. __bss_start = _sbss;
  126. *(.bss)
  127. *(.bss*)
  128. *(COMMON)
  129. . = ALIGN(4);
  130. /* the symbol '_ebss' will be defined at the bss section end */
  131. _ebss = .;
  132. __bss_end__ = _ebss;
  133. __bss_end = _ebss;
  134. } > RAM
  135. /* heap and stack space */
  136. .heap_stack :
  137. {
  138. . = ALIGN(8);
  139. PROVIDE ( end = _ebss );
  140. PROVIDE ( _end = _ebss );
  141. . = . + __heap_size;
  142. PROVIDE( _heap_end = . );
  143. . = . + __stack_size;
  144. PROVIDE( _sp = . );
  145. . = ALIGN(8);
  146. } > RAM
  147. /* Note: To use TCMRAM, initialization in the startup file is required. */
  148. _sitcmram = LOADADDR(.tcmram);
  149. .tcmram :
  150. {
  151. . = ALIGN(4);
  152. .stcmram = .;
  153. *(.tcmram)
  154. *(.tcmram*)
  155. . = ALIGN(4);
  156. _etcmram = .;
  157. } > TCMRAM AT> FLASH
  158. }
  159. /* input sections */
  160. GROUP(libgcc.a libc.a libm.a libnosys.a)