zuluscsi_gd32f205.ld 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /**
  2. * ZuluSCSI™ - Copyright (c) 2022 Rabbit Hole Computing™
  3. *
  4. * ZuluSCSI™ firmware is licensed under the GPL version 3 or any later version. 
  5. *
  6. * https://www.gnu.org/licenses/gpl-3.0.html
  7. * ----
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version. 
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. * GNU General Public License for more details. 
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  20. **/
  21. /*
  22. *
  23. * Customized linker script for combining bootloader & main program
  24. * PlatformIO default linker script template for STM32 F1/F2/F3/F4/F7/L0/L1/L4
  25. *
  26. */
  27. /* Entry Point */
  28. ENTRY(Reset_Handler)
  29. /* Highest address of the user mode stack */
  30. _estack = 0x20020000; /* end of RAM */
  31. /* Generate a link error if heap and stack don't fit into RAM */
  32. _Min_Heap_Size = 0x200; /* required amount of heap */
  33. _Min_Stack_Size = 0x400; /* required amount of stack */
  34. /* Specify the memory areas */
  35. MEMORY
  36. {
  37. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
  38. CCRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0K
  39. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
  40. }
  41. /* Define output sections */
  42. SECTIONS
  43. {
  44. /* If bootloader is included, it goes in first 32 kB */
  45. .text.bootloader : ALIGN(16) SUBALIGN(16)
  46. {
  47. KEEP(*(.text.btldr*))
  48. . = ALIGN(32768);
  49. CHECK_BOOTLOADER_SIZE = 1 / (. <= 32768);
  50. } >FLASH
  51. /* The startup code goes first into FLASH */
  52. .isr_vector :
  53. {
  54. . = ALIGN(4);
  55. KEEP(*(.isr_vector)) /* Startup code */
  56. . = ALIGN(4);
  57. } >FLASH
  58. /* The program code and other data goes into FLASH */
  59. .text :
  60. {
  61. . = ALIGN(4);
  62. *(.text) /* .text sections (code) */
  63. *(.text*) /* .text* sections (code) */
  64. *(.glue_7) /* glue arm to thumb code */
  65. *(.glue_7t) /* glue thumb to arm code */
  66. *(.eh_frame)
  67. KEEP (*(.init))
  68. KEEP (*(.fini))
  69. . = ALIGN(4);
  70. _etext = .; /* define a global symbols at end of code */
  71. } >FLASH
  72. /* Constant data goes into FLASH */
  73. .rodata :
  74. {
  75. . = ALIGN(4);
  76. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  77. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  78. . = ALIGN(4);
  79. } >FLASH
  80. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  81. .ARM : {
  82. __exidx_start = .;
  83. *(.ARM.exidx*)
  84. __exidx_end = .;
  85. } >FLASH
  86. .preinit_array :
  87. {
  88. PROVIDE_HIDDEN (__preinit_array_start = .);
  89. KEEP (*(.preinit_array*))
  90. PROVIDE_HIDDEN (__preinit_array_end = .);
  91. } >FLASH
  92. .init_array :
  93. {
  94. PROVIDE_HIDDEN (__init_array_start = .);
  95. KEEP (*(SORT(.init_array.*)))
  96. KEEP (*(.init_array*))
  97. PROVIDE_HIDDEN (__init_array_end = .);
  98. } >FLASH
  99. .fini_array :
  100. {
  101. PROVIDE_HIDDEN (__fini_array_start = .);
  102. KEEP (*(SORT(.fini_array.*)))
  103. KEEP (*(.fini_array*))
  104. PROVIDE_HIDDEN (__fini_array_end = .);
  105. } >FLASH
  106. /* used by the startup to initialize data */
  107. _sidata = LOADADDR(.data);
  108. /* Initialized data sections goes into RAM, load LMA copy after code */
  109. .data :
  110. {
  111. . = ALIGN(4);
  112. _sdata = .; /* create a global symbol at data start */
  113. *(.data) /* .data sections */
  114. *(.data*) /* .data* sections */
  115. . = ALIGN(4);
  116. _edata = .; /* define a global symbol at data end */
  117. } >RAM AT> FLASH
  118. /* Uninitialized data section */
  119. . = ALIGN(4);
  120. .bss :
  121. {
  122. /* This is used by the startup in order to initialize the .bss secion */
  123. _sbss = .; /* define a global symbol at bss start */
  124. __bss_start__ = _sbss;
  125. *(.bss)
  126. *(.bss*)
  127. *(COMMON)
  128. . = ALIGN(4);
  129. _ebss = .; /* define a global symbol at bss end */
  130. __bss_end__ = _ebss;
  131. } >RAM
  132. /* User_heap_stack section, used to check that there is enough RAM left */
  133. ._user_heap_stack :
  134. {
  135. . = ALIGN(4);
  136. PROVIDE ( end = . );
  137. PROVIDE ( _end = . );
  138. . = . + _Min_Heap_Size;
  139. . = . + _Min_Stack_Size;
  140. . = ALIGN(4);
  141. } >RAM
  142. /* uninitialized CCRAM objects (like, buffers) */
  143. .ccram_bss :
  144. {
  145. __ccram_start_bss__ = .; /* define a global symbol at ccram start */
  146. KEEP(*(.ccram_bss))
  147. KEEP(*(.ccram_bss*))
  148. . = ALIGN(4);
  149. __ccram_end_bss__ = .; /* define a global symbol at end of *used* CCRAM (BSS) */
  150. } >CCRAM
  151. /* initialized CCRAM objects (like, initialized variables) */
  152. _si_ccram_data = LOADADDR(.ccram_data);
  153. .ccram_data :
  154. {
  155. . = ALIGN(4);
  156. _ccram_start_data = .; /* create a global symbol at data start */
  157. *(.ccram_bss) /* .data sections */
  158. *(.ccram_bss*) /* .data* sections */
  159. . = ALIGN(4);
  160. _ccram_end_data = .; /* define a global symbol at data end */
  161. } >CCRAM AT> FLASH
  162. /* Remove information from the standard libraries */
  163. /DISCARD/ :
  164. {
  165. libc.a ( * )
  166. libm.a ( * )
  167. libgcc.a ( * )
  168. }
  169. .ARM.attributes 0 : { *(.ARM.attributes) }
  170. }