azulscsi_gd32f205.ld 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. } >FLASH
  30. /* The startup code goes first into FLASH */
  31. .isr_vector :
  32. {
  33. . = ALIGN(4);
  34. KEEP(*(.isr_vector)) /* Startup code */
  35. . = ALIGN(4);
  36. } >FLASH
  37. /* The program code and other data goes into FLASH */
  38. .text :
  39. {
  40. . = ALIGN(4);
  41. *(.text) /* .text sections (code) */
  42. *(.text*) /* .text* sections (code) */
  43. *(.glue_7) /* glue arm to thumb code */
  44. *(.glue_7t) /* glue thumb to arm code */
  45. *(.eh_frame)
  46. KEEP (*(.init))
  47. KEEP (*(.fini))
  48. . = ALIGN(4);
  49. _etext = .; /* define a global symbols at end of code */
  50. } >FLASH
  51. /* Constant data goes into FLASH */
  52. .rodata :
  53. {
  54. . = ALIGN(4);
  55. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  56. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  57. . = ALIGN(4);
  58. } >FLASH
  59. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  60. .ARM : {
  61. __exidx_start = .;
  62. *(.ARM.exidx*)
  63. __exidx_end = .;
  64. } >FLASH
  65. .preinit_array :
  66. {
  67. PROVIDE_HIDDEN (__preinit_array_start = .);
  68. KEEP (*(.preinit_array*))
  69. PROVIDE_HIDDEN (__preinit_array_end = .);
  70. } >FLASH
  71. .init_array :
  72. {
  73. PROVIDE_HIDDEN (__init_array_start = .);
  74. KEEP (*(SORT(.init_array.*)))
  75. KEEP (*(.init_array*))
  76. PROVIDE_HIDDEN (__init_array_end = .);
  77. } >FLASH
  78. .fini_array :
  79. {
  80. PROVIDE_HIDDEN (__fini_array_start = .);
  81. KEEP (*(SORT(.fini_array.*)))
  82. KEEP (*(.fini_array*))
  83. PROVIDE_HIDDEN (__fini_array_end = .);
  84. } >FLASH
  85. /* used by the startup to initialize data */
  86. _sidata = LOADADDR(.data);
  87. /* Initialized data sections goes into RAM, load LMA copy after code */
  88. .data :
  89. {
  90. . = ALIGN(4);
  91. _sdata = .; /* create a global symbol at data start */
  92. *(.data) /* .data sections */
  93. *(.data*) /* .data* sections */
  94. . = ALIGN(4);
  95. _edata = .; /* define a global symbol at data end */
  96. } >RAM AT> FLASH
  97. /* Uninitialized data section */
  98. . = ALIGN(4);
  99. .bss :
  100. {
  101. /* This is used by the startup in order to initialize the .bss secion */
  102. _sbss = .; /* define a global symbol at bss start */
  103. __bss_start__ = _sbss;
  104. *(.bss)
  105. *(.bss*)
  106. *(COMMON)
  107. . = ALIGN(4);
  108. _ebss = .; /* define a global symbol at bss end */
  109. __bss_end__ = _ebss;
  110. } >RAM
  111. /* User_heap_stack section, used to check that there is enough RAM left */
  112. ._user_heap_stack :
  113. {
  114. . = ALIGN(4);
  115. PROVIDE ( end = . );
  116. PROVIDE ( _end = . );
  117. . = . + _Min_Heap_Size;
  118. . = . + _Min_Stack_Size;
  119. . = ALIGN(4);
  120. } >RAM
  121. /* uninitialized CCRAM objects (like, buffers) */
  122. .ccram_bss :
  123. {
  124. __ccram_start_bss__ = .; /* define a global symbol at ccram start */
  125. KEEP(*(.ccram_bss))
  126. KEEP(*(.ccram_bss*))
  127. . = ALIGN(4);
  128. __ccram_end_bss__ = .; /* define a global symbol at end of *used* CCRAM (BSS) */
  129. } >CCRAM
  130. /* initialized CCRAM objects (like, initialized variables) */
  131. _si_ccram_data = LOADADDR(.ccram_data);
  132. .ccram_data :
  133. {
  134. . = ALIGN(4);
  135. _ccram_start_data = .; /* create a global symbol at data start */
  136. *(.ccram_bss) /* .data sections */
  137. *(.ccram_bss*) /* .data* sections */
  138. . = ALIGN(4);
  139. _ccram_end_data = .; /* define a global symbol at data end */
  140. } >CCRAM AT> FLASH
  141. /* Remove information from the standard libraries */
  142. /DISCARD/ :
  143. {
  144. libc.a ( * )
  145. libm.a ( * )
  146. libgcc.a ( * )
  147. }
  148. .ARM.attributes 0 : { *(.ARM.attributes) }
  149. }