link.lds 4.1 KB

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