stm32_rom.ld 3.8 KB

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