link.lds 3.8 KB

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