Advertisement
Guest User

stm32f103rb_rom.ld

a guest
Oct 11th, 2010
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.56 KB | None | 0 0
  1. /*
  2. Default linker script for STM32F103RB_128K_20K
  3. Copyright RAISONANCE S.A.S. 2008
  4. */
  5.  
  6. /* include the common STM32F103RB sub-script */
  7.  
  8. /* Common part of the linker scripts for STM32 devices*/
  9.  
  10. /* default stack sizes.
  11.  
  12. These are used by the startup in order to allocate stacks for the different modes.
  13. */
  14.  
  15. __Stack_Size = 1024 ;
  16.  
  17. PROVIDE ( _Stack_Size = __Stack_Size ) ;
  18.  
  19. __Stack_Init = _estack - __Stack_Size ;
  20.  
  21. /*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
  22. PROVIDE ( _Stack_Init = __Stack_Init ) ;
  23.  
  24. /*
  25. There will be a link error if there is not this amount of RAM free at the end.
  26. */
  27. _Minimum_Stack_Size = 0x100 ;
  28.  
  29.  
  30. /* include the memory spaces definitions sub-script */
  31. /*
  32. Linker subscript for STM32F10x definitions with 128K Flash and 20K RAM */
  33.  
  34. /* Memory Spaces Definitions */
  35.  
  36. MEMORY
  37. {
  38. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
  39. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K
  40. FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  41. EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  42. EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  43. EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  44. EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  45. }
  46.  
  47. ENTRY(Reset_Handler)
  48.  
  49. /* higher address of the user mode stack */
  50. /* _estack = 0x20005000; */
  51. _estack = ORIGIN(RAM) + LENGTH(RAM);
  52.  
  53. /* include the sections management sub-script for FLASH mode */
  54.  
  55. /* Sections Definitions */
  56.  
  57. SECTIONS
  58. {
  59. .vtable(NOLOAD):
  60. {
  61. }
  62. /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
  63. .isr_vector :
  64. {
  65. . = ALIGN(4);
  66. KEEP(*(.isr_vector)) /* Startup code */
  67. . = ALIGN(4);
  68. } >FLASH
  69.  
  70. /* the program code is stored in the .text section, which goes to Flash */
  71. .text :
  72. {
  73. . = ALIGN(4);
  74.  
  75. *(.text .text.* .gnu.linkonce.t.*) /* remaining code */
  76. *(.rodata) /* read-only data (constants) */
  77. *(.rodata*)
  78. *(.glue_7)
  79. *(.glue_7t)
  80.  
  81. . = ALIGN(4);
  82. _etext = .;
  83. /* This is used by the startup in order to initialize the .data secion */
  84. _sidata = _etext;
  85. } >FLASH
  86.  
  87.  
  88.  
  89. /* This is the initialized data section
  90. The program executes knowing that the data is in the RAM
  91. but the loader puts the initial values in the FLASH (inidata).
  92. It is one task of the startup to copy the initial values from FLASH to RAM. */
  93. .data : AT ( _sidata )
  94. {
  95. . = ALIGN(4);
  96. /* This is used by the startup in order to initialize the .data secion */
  97. _sdata = . ;
  98.  
  99. *(.data .data* .gnu.linkonce.d.*)
  100.  
  101. . = ALIGN(4);
  102. /* This is used by the startup in order to initialize the .data secion */
  103. _edata = . ;
  104. } >RAM
  105.  
  106.  
  107.  
  108. /* This is the uninitialized data section */
  109. .bss :
  110. {
  111. . = ALIGN(4);
  112. /* This is used by the startup in order to initialize the .bss secion */
  113. _sbss = .;
  114.  
  115. *(.bss .bss.* .gnu.linkonce.b.*)
  116. *(COMMON)
  117.  
  118. . = ALIGN(4);
  119. /* This is used by the startup in order to initialize the .bss secion */
  120. _ebss = . ;
  121. } >RAM
  122.  
  123. PROVIDE ( end = _ebss );
  124. PROVIDE ( _end = _ebss );
  125.  
  126. /* This is the user stack section
  127. This is just to check that there is enough RAM left for the User mode stack
  128. It should generate an error if it's full.
  129. */
  130. ._usrstack :
  131. {
  132. . = ALIGN(4);
  133. _susrstack = . ;
  134.  
  135. . = . + _Minimum_Stack_Size ;
  136.  
  137. . = ALIGN(4);
  138. _eusrstack = . ;
  139. } >RAM
  140.  
  141.  
  142.  
  143. /* this is the FLASH Bank1 */
  144. /* the C or assembly source must explicitly place the code or data there
  145. using the "section" attribute */
  146. .b1text :
  147. {
  148. *(.b1text) /* remaining code */
  149. *(.b1rodata) /* read-only data (constants) */
  150. *(.b1rodata*)
  151. } >FLASHB1
  152.  
  153. /* this is the EXTMEM */
  154. /* the C or assembly source must explicitly place the code or data there
  155. using the "section" attribute */
  156.  
  157. /* EXTMEM Bank0 */
  158. .eb0text :
  159. {
  160. *(.eb0text) /* remaining code */
  161. *(.eb0rodata) /* read-only data (constants) */
  162. *(.eb0rodata*)
  163. } >EXTMEMB0
  164.  
  165. /* EXTMEM Bank1 */
  166. .eb1text :
  167. {
  168. *(.eb1text) /* remaining code */
  169. *(.eb1rodata) /* read-only data (constants) */
  170. *(.eb1rodata*)
  171. } >EXTMEMB1
  172.  
  173. /* EXTMEM Bank2 */
  174. .eb2text :
  175. {
  176. *(.eb2text) /* remaining code */
  177. *(.eb2rodata) /* read-only data (constants) */
  178. *(.eb2rodata*)
  179. } >EXTMEMB2
  180.  
  181. /* EXTMEM Bank0 */
  182. .eb3text :
  183. {
  184. *(.eb3text) /* remaining code */
  185. *(.eb3rodata) /* read-only data (constants) */
  186. *(.eb3rodata*)
  187. } >EXTMEMB3
  188.  
  189.  
  190.  
  191. /* after that it's only debugging information. */
  192.  
  193. /* remove the debugging information from the standard libraries */
  194. DISCARD :
  195. {
  196. libc.a ( * )
  197. libm.a ( * )
  198. libgcc.a ( * )
  199. }
  200.  
  201. /* Stabs debugging sections. */
  202. .stab 0 : { *(.stab) }
  203. .stabstr 0 : { *(.stabstr) }
  204. .stab.excl 0 : { *(.stab.excl) }
  205. .stab.exclstr 0 : { *(.stab.exclstr) }
  206. .stab.index 0 : { *(.stab.index) }
  207. .stab.indexstr 0 : { *(.stab.indexstr) }
  208. .comment 0 : { *(.comment) }
  209. /* DWARF debug sections.
  210. Symbols in the DWARF debugging sections are relative to the beginning
  211. of the section so we begin them at 0. */
  212. /* DWARF 1 */
  213. .debug 0 : { *(.debug) }
  214. .line 0 : { *(.line) }
  215. /* GNU DWARF 1 extensions */
  216. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  217. .debug_sfnames 0 : { *(.debug_sfnames) }
  218. /* DWARF 1.1 and DWARF 2 */
  219. .debug_aranges 0 : { *(.debug_aranges) }
  220. .debug_pubnames 0 : { *(.debug_pubnames) }
  221. /* DWARF 2 */
  222. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  223. .debug_abbrev 0 : { *(.debug_abbrev) }
  224. .debug_line 0 : { *(.debug_line) }
  225. .debug_frame 0 : { *(.debug_frame) }
  226. .debug_str 0 : { *(.debug_str) }
  227. .debug_loc 0 : { *(.debug_loc) }
  228. .debug_macinfo 0 : { *(.debug_macinfo) }
  229. /* SGI/MIPS DWARF 2 extensions */
  230. .debug_weaknames 0 : { *(.debug_weaknames) }
  231. .debug_funcnames 0 : { *(.debug_funcnames) }
  232. .debug_typenames 0 : { *(.debug_typenames) }
  233. .debug_varnames 0 : { *(.debug_varnames) }
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement