link.lds 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* Linker script to configure memory regions. */
  2. MEMORY
  3. {
  4. ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x80000 /* 512K FLASH */
  5. RAM (rw) : ORIGIN = 0x20000000, LENGTH = 0x10000 /* 64K RAM */
  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. /* section information for initial. */
  34. . = ALIGN(4);
  35. __rt_init_start = .;
  36. KEEP(*(SORT(.rti_fn*)))
  37. __rt_init_end = .;
  38. /* section information for modules */
  39. . = ALIGN(4);
  40. __rtmsymtab_start = .;
  41. KEEP(*(RTMSymTab))
  42. __rtmsymtab_end = .;
  43. . = ALIGN(4);
  44. PROVIDE(__ctors_start__ = .);
  45. KEEP (*(SORT(.init_array.*)))
  46. KEEP (*(.init_array))
  47. PROVIDE(__ctors_end__ = .);
  48. . = ALIGN(4);
  49. _etext = .;
  50. } > ROM = 0
  51. /* .ARM.exidx is sorted, so has to go in its own output section. */
  52. __exidx_start = .;
  53. .ARM.exidx :
  54. {
  55. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  56. /* This is used by the startup in order to initialize the .data secion */
  57. _sidata = .;
  58. } > ROM
  59. __exidx_end = .;
  60. /* .data section which is used for initialized data */
  61. .data : AT (_sidata)
  62. {
  63. . = ALIGN(4);
  64. /* This is used by the startup in order to initialize the .data secion */
  65. _sdata = . ;
  66. *(.data)
  67. *(.data.*)
  68. *(.gnu.linkonce.d*)
  69. PROVIDE(__dtors_start__ = .);
  70. KEEP(*(SORT(.dtors.*)))
  71. KEEP(*(.dtors))
  72. PROVIDE(__dtors_end__ = .);
  73. . = ALIGN(4);
  74. /* This is used by the startup in order to initialize the .data secion */
  75. _edata = . ;
  76. } >RAM
  77. .stack :
  78. {
  79. . = ALIGN(4);
  80. _sstack = .;
  81. . = . + _system_stack_size;
  82. . = ALIGN(4);
  83. _estack = .;
  84. } >RAM
  85. __bss_start = .;
  86. .bss :
  87. {
  88. . = ALIGN(4);
  89. /* This is used by the startup in order to initialize the .bss secion */
  90. _sbss = .;
  91. *(.bss)
  92. *(.bss.*)
  93. *(COMMON)
  94. . = ALIGN(4);
  95. /* This is used by the startup in order to initialize the .bss secion */
  96. _ebss = . ;
  97. *(.bss.init)
  98. } > RAM
  99. __bss_end = .;
  100. _end = .;
  101. PROVIDE(__etext = __exidx_end);
  102. PROVIDE(__data_start__ = _sdata);
  103. PROVIDE(__bss_start__ = __bss_start);
  104. PROVIDE(__bss_end__ = __bss_end);
  105. PROVIDE(__StackTop = _estack);
  106. }