stm32_rom.ld 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * linker script for STM32F10x with GNU ld
  3. * bernard.xiong 2009-10-14
  4. */
  5. /* Program Entry, set to mark it as "used" and avoid gc */
  6. MEMORY
  7. {
  8. CODE (rx) : ORIGIN = 0x08000000, LENGTH = 128k /* 512KB flash */
  9. DATA (rw) : ORIGIN = 0x20000000, LENGTH = 20k /* 64K sram */
  10. }
  11. ENTRY(Reset_Handler)
  12. _system_stack_size = 0x100;
  13. SECTIONS
  14. {
  15. .text :
  16. {
  17. . = ALIGN(4);
  18. _stext = .;
  19. KEEP(*(.isr_vector)) /* Startup code */
  20. . = ALIGN(4);
  21. *(.text) /* remaining code */
  22. *(.text.*) /* remaining code */
  23. *(.rodata) /* read-only data (constants) */
  24. *(.rodata*)
  25. *(.glue_7)
  26. *(.glue_7t)
  27. *(.gnu.linkonce.t*)
  28. /* section information for finsh shell */
  29. . = ALIGN(4);
  30. __fsymtab_start = .;
  31. KEEP(*(FSymTab))
  32. __fsymtab_end = .;
  33. . = ALIGN(4);
  34. __vsymtab_start = .;
  35. KEEP(*(VSymTab))
  36. __vsymtab_end = .;
  37. . = ALIGN(4);
  38. /* section information for initial. */
  39. . = ALIGN(4);
  40. __rt_init_start = .;
  41. KEEP(*(SORT(.rti_fn*)))
  42. __rt_init_end = .;
  43. . = ALIGN(4);
  44. . = ALIGN(4);
  45. _etext = .;
  46. } > CODE = 0
  47. /* .ARM.exidx is sorted, so has to go in its own output section. */
  48. __exidx_start = .;
  49. .ARM.exidx :
  50. {
  51. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  52. /* This is used by the startup in order to initialize the .data secion */
  53. _sidata = .;
  54. } > CODE
  55. __exidx_end = .;
  56. /* .data section which is used for initialized data */
  57. .data : AT (_sidata)
  58. {
  59. . = ALIGN(4);
  60. /* This is used by the startup in order to initialize the .data secion */
  61. _sdata = . ;
  62. *(.data)
  63. *(.data.*)
  64. *(.gnu.linkonce.d*)
  65. . = ALIGN(4);
  66. /* This is used by the startup in order to initialize the .data secion */
  67. _edata = . ;
  68. } >DATA
  69. .stack :
  70. {
  71. . = . + _system_stack_size;
  72. . = ALIGN(4);
  73. _estack = .;
  74. } >DATA
  75. __bss_start = .;
  76. .bss :
  77. {
  78. . = ALIGN(4);
  79. /* This is used by the startup in order to initialize the .bss secion */
  80. _sbss = .;
  81. *(.bss)
  82. *(.bss.*)
  83. *(COMMON)
  84. . = ALIGN(4);
  85. /* This is used by the startup in order to initialize the .bss secion */
  86. _ebss = . ;
  87. *(.bss.init)
  88. } > DATA
  89. __bss_end = .;
  90. _end = .;
  91. /* Stabs debugging sections. */
  92. .stab 0 : { *(.stab) }
  93. .stabstr 0 : { *(.stabstr) }
  94. .stab.excl 0 : { *(.stab.excl) }
  95. .stab.exclstr 0 : { *(.stab.exclstr) }
  96. .stab.index 0 : { *(.stab.index) }
  97. .stab.indexstr 0 : { *(.stab.indexstr) }
  98. .comment 0 : { *(.comment) }
  99. /* DWARF debug sections.
  100. * Symbols in the DWARF debugging sections are relative to the beginning
  101. * of the section so we begin them at 0. */
  102. /* DWARF 1 */
  103. .debug 0 : { *(.debug) }
  104. .line 0 : { *(.line) }
  105. /* GNU DWARF 1 extensions */
  106. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  107. .debug_sfnames 0 : { *(.debug_sfnames) }
  108. /* DWARF 1.1 and DWARF 2 */
  109. .debug_aranges 0 : { *(.debug_aranges) }
  110. .debug_pubnames 0 : { *(.debug_pubnames) }
  111. /* DWARF 2 */
  112. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  113. .debug_abbrev 0 : { *(.debug_abbrev) }
  114. .debug_line 0 : { *(.debug_line) }
  115. .debug_frame 0 : { *(.debug_frame) }
  116. .debug_str 0 : { *(.debug_str) }
  117. .debug_loc 0 : { *(.debug_loc) }
  118. .debug_macinfo 0 : { *(.debug_macinfo) }
  119. /* SGI/MIPS DWARF 2 extensions */
  120. .debug_weaknames 0 : { *(.debug_weaknames) }
  121. .debug_funcnames 0 : { *(.debug_funcnames) }
  122. .debug_typenames 0 : { *(.debug_typenames) }
  123. .debug_varnames 0 : { *(.debug_varnames) }
  124. }