azulscsi_gd32f205_btldr.ld 4.5 KB

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