azulscsi_gd32f205.ld 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. *
  3. * Customized linker script for combining bootloader & main program
  4. * PlatformIO default linker script template for STM32 F1/F2/F3/F4/F7/L0/L1/L4
  5. *
  6. */
  7. /* Entry Point */
  8. ENTRY(Reset_Handler)
  9. /* Highest address of the user mode stack */
  10. _estack = 0x20020000; /* end of RAM */
  11. /* Generate a link error if heap and stack don't fit into RAM */
  12. _Min_Heap_Size = 0x200; /* required amount of heap */
  13. _Min_Stack_Size = 0x400; /* required amount of stack */
  14. /* Specify the memory areas */
  15. MEMORY
  16. {
  17. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
  18. CCRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0K
  19. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
  20. }
  21. /* Define output sections */
  22. SECTIONS
  23. {
  24. /* If bootloader is included, it goes in first 32 kB */
  25. .text.bootloader : ALIGN(16) SUBALIGN(16)
  26. {
  27. KEEP(*(.text.btldr*))
  28. . = ALIGN(32768);
  29. CHECK_BOOTLOADER_SIZE = 1 / (. <= 32768);
  30. } >FLASH
  31. /* The startup code goes first into FLASH */
  32. .isr_vector :
  33. {
  34. . = ALIGN(4);
  35. KEEP(*(.isr_vector)) /* Startup code */
  36. . = ALIGN(4);
  37. } >FLASH
  38. /* The program code and other data goes into FLASH */
  39. .text :
  40. {
  41. . = ALIGN(4);
  42. *(.text) /* .text sections (code) */
  43. *(.text*) /* .text* sections (code) */
  44. *(.glue_7) /* glue arm to thumb code */
  45. *(.glue_7t) /* glue thumb to arm code */
  46. *(.eh_frame)
  47. KEEP (*(.init))
  48. KEEP (*(.fini))
  49. . = ALIGN(4);
  50. _etext = .; /* define a global symbols at end of code */
  51. } >FLASH
  52. /* Constant data goes into FLASH */
  53. .rodata :
  54. {
  55. . = ALIGN(4);
  56. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  57. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  58. . = ALIGN(4);
  59. } >FLASH
  60. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  61. .ARM : {
  62. __exidx_start = .;
  63. *(.ARM.exidx*)
  64. __exidx_end = .;
  65. } >FLASH
  66. .preinit_array :
  67. {
  68. PROVIDE_HIDDEN (__preinit_array_start = .);
  69. KEEP (*(.preinit_array*))
  70. PROVIDE_HIDDEN (__preinit_array_end = .);
  71. } >FLASH
  72. .init_array :
  73. {
  74. PROVIDE_HIDDEN (__init_array_start = .);
  75. KEEP (*(SORT(.init_array.*)))
  76. KEEP (*(.init_array*))
  77. PROVIDE_HIDDEN (__init_array_end = .);
  78. } >FLASH
  79. .fini_array :
  80. {
  81. PROVIDE_HIDDEN (__fini_array_start = .);
  82. KEEP (*(SORT(.fini_array.*)))
  83. KEEP (*(.fini_array*))
  84. PROVIDE_HIDDEN (__fini_array_end = .);
  85. } >FLASH
  86. /* used by the startup to initialize data */
  87. _sidata = LOADADDR(.data);
  88. /* Initialized data sections goes into RAM, load LMA copy after code */
  89. .data :
  90. {
  91. . = ALIGN(4);
  92. _sdata = .; /* create a global symbol at data start */
  93. *(.data) /* .data sections */
  94. *(.data*) /* .data* sections */
  95. . = ALIGN(4);
  96. _edata = .; /* define a global symbol at data end */
  97. } >RAM AT> FLASH
  98. /* Uninitialized data section */
  99. . = ALIGN(4);
  100. .bss :
  101. {
  102. /* This is used by the startup in order to initialize the .bss secion */
  103. _sbss = .; /* define a global symbol at bss start */
  104. __bss_start__ = _sbss;
  105. *(.bss)
  106. *(.bss*)
  107. *(COMMON)
  108. . = ALIGN(4);
  109. _ebss = .; /* define a global symbol at bss end */
  110. __bss_end__ = _ebss;
  111. } >RAM
  112. /* User_heap_stack section, used to check that there is enough RAM left */
  113. ._user_heap_stack :
  114. {
  115. . = ALIGN(4);
  116. PROVIDE ( end = . );
  117. PROVIDE ( _end = . );
  118. . = . + _Min_Heap_Size;
  119. . = . + _Min_Stack_Size;
  120. . = ALIGN(4);
  121. } >RAM
  122. /* uninitialized CCRAM objects (like, buffers) */
  123. .ccram_bss :
  124. {
  125. __ccram_start_bss__ = .; /* define a global symbol at ccram start */
  126. KEEP(*(.ccram_bss))
  127. KEEP(*(.ccram_bss*))
  128. . = ALIGN(4);
  129. __ccram_end_bss__ = .; /* define a global symbol at end of *used* CCRAM (BSS) */
  130. } >CCRAM
  131. /* initialized CCRAM objects (like, initialized variables) */
  132. _si_ccram_data = LOADADDR(.ccram_data);
  133. .ccram_data :
  134. {
  135. . = ALIGN(4);
  136. _ccram_start_data = .; /* create a global symbol at data start */
  137. *(.ccram_bss) /* .data sections */
  138. *(.ccram_bss*) /* .data* sections */
  139. . = ALIGN(4);
  140. _ccram_end_data = .; /* define a global symbol at data end */
  141. } >CCRAM AT> FLASH
  142. /* Remove information from the standard libraries */
  143. /DISCARD/ :
  144. {
  145. libc.a ( * )
  146. libm.a ( * )
  147. libgcc.a ( * )
  148. }
  149. .ARM.attributes 0 : { *(.ARM.attributes) }
  150. }