link.lds 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * linker script for STM32F4xx 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 = 1024k /* 1024KB flash */
  9. RAM1 (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K sram */
  10. RAM2 (rw) : ORIGIN = 0x10000000, LENGTH = 64k /* 64K sram */
  11. }
  12. ENTRY(Reset_Handler)
  13. _system_stack_size = 0x200;
  14. SECTIONS
  15. {
  16. .text :
  17. {
  18. . = ALIGN(4);
  19. _stext = .;
  20. KEEP(*(.isr_vector)) /* Startup code */
  21. . = ALIGN(4);
  22. *(.text) /* remaining code */
  23. *(.text.*) /* remaining code */
  24. *(.rodata) /* read-only data (constants) */
  25. *(.rodata*)
  26. *(.glue_7)
  27. *(.glue_7t)
  28. *(.gnu.linkonce.t*)
  29. /* section information for finsh shell */
  30. . = ALIGN(4);
  31. __fsymtab_start = .;
  32. KEEP(*(FSymTab))
  33. __fsymtab_end = .;
  34. . = ALIGN(4);
  35. __vsymtab_start = .;
  36. KEEP(*(VSymTab))
  37. __vsymtab_end = .;
  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. _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. } >RAM1
  68. .stack :
  69. {
  70. . = ALIGN(4);
  71. _sstack = .;
  72. . = . + _system_stack_size;
  73. . = ALIGN(4);
  74. _estack = .;
  75. } >RAM1
  76. __bss_start = .;
  77. .bss :
  78. {
  79. . = ALIGN(4);
  80. /* This is used by the startup in order to initialize the .bss secion */
  81. _sbss = .;
  82. *(.bss)
  83. *(.bss.*)
  84. *(COMMON)
  85. . = ALIGN(4);
  86. /* This is used by the startup in order to initialize the .bss secion */
  87. _ebss = . ;
  88. *(.bss.init)
  89. } > RAM1
  90. __bss_end = .;
  91. _end = .;
  92. /* Stabs debugging sections. */
  93. .stab 0 : { *(.stab) }
  94. .stabstr 0 : { *(.stabstr) }
  95. .stab.excl 0 : { *(.stab.excl) }
  96. .stab.exclstr 0 : { *(.stab.exclstr) }
  97. .stab.index 0 : { *(.stab.index) }
  98. .stab.indexstr 0 : { *(.stab.indexstr) }
  99. .comment 0 : { *(.comment) }
  100. /* DWARF debug sections.
  101. * Symbols in the DWARF debugging sections are relative to the beginning
  102. * of the section so we begin them at 0. */
  103. /* DWARF 1 */
  104. .debug 0 : { *(.debug) }
  105. .line 0 : { *(.line) }
  106. /* GNU DWARF 1 extensions */
  107. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  108. .debug_sfnames 0 : { *(.debug_sfnames) }
  109. /* DWARF 1.1 and DWARF 2 */
  110. .debug_aranges 0 : { *(.debug_aranges) }
  111. .debug_pubnames 0 : { *(.debug_pubnames) }
  112. /* DWARF 2 */
  113. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  114. .debug_abbrev 0 : { *(.debug_abbrev) }
  115. .debug_line 0 : { *(.debug_line) }
  116. .debug_frame 0 : { *(.debug_frame) }
  117. .debug_str 0 : { *(.debug_str) }
  118. .debug_loc 0 : { *(.debug_loc) }
  119. .debug_macinfo 0 : { *(.debug_macinfo) }
  120. /* SGI/MIPS DWARF 2 extensions */
  121. .debug_weaknames 0 : { *(.debug_weaknames) }
  122. .debug_funcnames 0 : { *(.debug_funcnames) }
  123. .debug_typenames 0 : { *(.debug_typenames) }
  124. .debug_varnames 0 : { *(.debug_varnames) }
  125. }