GD32VF103xB_I2S.lds 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. OUTPUT_ARCH( "riscv" )
  2. ENTRY( _start )
  3. MEMORY
  4. {
  5. /* Run in FLASH */
  6. flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 128k
  7. ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 32K
  8. /* Run in RAM */
  9. /* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 24k
  10. ram (wxa!ri) : ORIGIN = 0x20006000, LENGTH = 8K
  11. */
  12. }
  13. SECTIONS
  14. {
  15. __stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
  16. .init :
  17. {
  18. KEEP (*(SORT_NONE(.init)))
  19. } >flash AT>flash
  20. .ilalign :
  21. {
  22. . = ALIGN(4);
  23. PROVIDE( _ilm_lma = . );
  24. } >flash AT>flash
  25. .ialign :
  26. {
  27. PROVIDE( _ilm = . );
  28. } >flash AT>flash
  29. .PrgData ALIGN(0x08004000,4) : AT(ALIGN(0x08004000,4))
  30. {
  31. KEEP(*(.PrgData))
  32. }
  33. .text :
  34. {
  35. *(.rodata .rodata.*)
  36. *(.text.unlikely .text.unlikely.*)
  37. *(.text.startup .text.startup.*)
  38. *(.text .text.*)
  39. *(.gnu.linkonce.t.*)
  40. *(.sdata2 .sdata2. *)
  41. } >flash AT>flash
  42. .fini :
  43. {
  44. KEEP (*(SORT_NONE(.fini)))
  45. } >flash AT>flash
  46. . = ALIGN(4);
  47. PROVIDE (__etext = .);
  48. PROVIDE (_etext = .);/*0x80022c8*/
  49. PROVIDE (etext = .);/*0x80022c8*/
  50. PROVIDE( _eilm = . );
  51. .preinit_array :
  52. {
  53. PROVIDE_HIDDEN (__preinit_array_start = .);
  54. KEEP (*(.preinit_array))
  55. PROVIDE_HIDDEN (__preinit_array_end = .);
  56. } >flash AT>flash
  57. .init_array :
  58. {
  59. PROVIDE_HIDDEN (__init_array_start = .);
  60. KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
  61. KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
  62. PROVIDE_HIDDEN (__init_array_end = .);
  63. } >flash AT>flash
  64. .fini_array :
  65. {
  66. PROVIDE_HIDDEN (__fini_array_start = .);
  67. KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
  68. KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
  69. PROVIDE_HIDDEN (__fini_array_end = .);
  70. } >flash AT>flash
  71. .ctors :
  72. {
  73. /* gcc uses crtbegin.o to find the start of
  74. the constructors, so we make sure it is
  75. first. Because this is a wildcard, it
  76. doesn't matter if the user does not
  77. actually link against crtbegin.o; the
  78. linker won't look for a file to match a
  79. wildcard. The wildcard also means that it
  80. doesn't matter which directory crtbegin.o
  81. is in. */
  82. KEEP (*crtbegin.o(.ctors))
  83. KEEP (*crtbegin?.o(.ctors))
  84. /* We don't want to include the .ctor section from
  85. the crtend.o file until after the sorted ctors.
  86. The .ctor section from the crtend file contains the
  87. end of ctors marker and it must be last */
  88. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  89. KEEP (*(SORT(.ctors.*)))
  90. KEEP (*(.ctors))
  91. } >flash AT>flash
  92. .dtors :
  93. {
  94. KEEP (*crtbegin.o(.dtors))
  95. KEEP (*crtbegin?.o(.dtors))
  96. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  97. KEEP (*(SORT(.dtors.*)))
  98. KEEP (*(.dtors))
  99. } >flash AT>flash
  100. . = ALIGN(4);
  101. PROVIDE( _eilm = . );
  102. .lalign :
  103. {
  104. . = ALIGN(4);
  105. PROVIDE( _data_lma = . );
  106. } >flash AT>flash
  107. .dalign :
  108. {
  109. . = ALIGN(4);
  110. PROVIDE( _data = . );
  111. } >ram AT>flash
  112. .data :
  113. {
  114. *(.rdata)
  115. *(.gnu.linkonce.r.*)
  116. *(.data .data.*)
  117. *(.gnu.linkonce.d.*)
  118. . = ALIGN(8);
  119. PROVIDE( __global_pointer$ = . + 0x800);
  120. *(.sdata .sdata.*)
  121. *(.gnu.linkonce.s.*)
  122. . = ALIGN(8);
  123. *(.srodata.cst16)
  124. *(.srodata.cst8)
  125. *(.srodata.cst4)
  126. *(.srodata.cst2)
  127. *(.srodata .srodata.*)
  128. } >ram AT>flash
  129. . = ALIGN(4);
  130. PROVIDE( _edata = . );
  131. PROVIDE( edata = . );
  132. PROVIDE( _fbss = . ); /*0X200052A0 0X200002A0*/
  133. PROVIDE( __bss_start = . );
  134. .bss :
  135. {
  136. *(.sbss*)
  137. *(.gnu.linkonce.sb.*)
  138. *(.bss .bss.*)
  139. *(.gnu.linkonce.b.*)
  140. *(COMMON)
  141. . = ALIGN(4);
  142. } >ram AT>ram
  143. . = ALIGN(8);
  144. PROVIDE( _end = . ); /*0X2000,0340*/
  145. PROVIDE( end = . );
  146. .stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
  147. {
  148. PROVIDE( _heap_end = . );
  149. . = __stack_size;
  150. PROVIDE( _sp = . );
  151. } >ram AT>ram
  152. }