zuluscsi_gd32f450_btldr.ld 4.5 KB

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