linker_template_gnu.ld 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #define __ASSEMBLY__
  2. #include <target_mem_config.h>
  3. MEMORY
  4. {
  5. #if (REGION_ICCM_SIZE != 0)
  6. REGION_ICCM : ORIGIN = REGION_ICCM_START, LENGTH = REGION_ICCM_SIZE
  7. #endif
  8. #if (REGION_DCCM_SIZE !=0)
  9. REGION_DCCM : ORIGIN = REGION_DCCM_START, LENGTH = REGION_DCCM_SIZE
  10. #endif
  11. #if (REGION_XCCM_SIZE != 0)
  12. REGION_XCCM : ORIGIN = REGION_XCCM_START, LENGTH = REGION_XCCM_SIZE
  13. #endif
  14. #if (REGION_YCCM_SIZE != 0)
  15. REGION_YCCM : ORIGIN = REGION_YCCM_START, LENGTH = REGION_YCCM_SIZE
  16. #endif
  17. #if (REGION_EXT_ROM_SIZE != 0)
  18. REGION_EXT_ROM : ORIGIN = REGION_EXT_ROM_START, LENGTH = REGION_EXT_ROM_SIZE
  19. #endif
  20. #if (REGION_EXT_RAM_SIZE != 0)
  21. REGION_EXT_RAM : ORIGIN = REGION_EXT_RAM_START, LENGTH = REGION_EXT_RAM_SIZE
  22. #endif
  23. }
  24. ENTRY(_start)
  25. SECTIONS
  26. {
  27. .init :
  28. {
  29. . = . + IMAGE_HEAD_SIZE;
  30. _f_init = .;
  31. KEEP (*(.init_vector .init_vector.*))
  32. KEEP (*(.init_bootstrap .init_bootstrap.*))
  33. _e_init = .;
  34. } > REGION_ROM
  35. .vector : ALIGN(1024)
  36. {
  37. _f_vector = .;
  38. *(.vector .vector.*)
  39. _e_vector = .;
  40. } > REGION_ROM
  41. #if (REGION_XCCM_SIZE != 0)
  42. .x_ccm (NOLOAD) : ALIGN(8)
  43. {
  44. _f_x_ccm = .;
  45. *(.x_ccm .x_cmm.*)
  46. _e_x_ccm = .;
  47. } > REGION_XCCM
  48. #endif
  49. #if (REGION_YCCM_SIZE != 0)
  50. .y_ccm (NOLOAD) : ALIGN(8)
  51. {
  52. _f_y_ccm = .;
  53. *(.y_ccm .y_ccm.*)
  54. _e_y_ccm = .;
  55. } > REGION_YCCM
  56. #endif
  57. .text : ALIGN(4)
  58. {
  59. _f_text = .;
  60. *(.text .text.* .gnu.linkonce.t.*)
  61. _e_text = .;
  62. } > REGION_ROM
  63. .rodata : ALIGN(4)
  64. {
  65. _f_rodata = .;
  66. /* section information for finsh shell */
  67. . = ALIGN(4);
  68. __fsymtab_start = .;
  69. KEEP(*(FSymTab))
  70. __fsymtab_end = .;
  71. . = ALIGN(4);
  72. __vsymtab_start = .;
  73. KEEP(*(VSymTab))
  74. __vsymtab_end = .;
  75. . = ALIGN(4);
  76. __rt_init_start = .;
  77. KEEP(*(SORT(.rti_fn*)))
  78. __rt_init_end = .;
  79. . = ALIGN(4);
  80. . = ALIGN(4);
  81. __CTOR_LIST__ = .;
  82. LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
  83. KEEP(*(SORT_BY_NAME(".ctors*")))
  84. LONG(0)
  85. __CTOR_END__ = .;
  86. . = ALIGN(4);
  87. __init_array_start = .;
  88. KEEP(*(SORT_BY_NAME(".init_array*")))
  89. __init_array_end = .;
  90. . = ALIGN(4);
  91. __DTOR_LIST__ = .;
  92. LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
  93. KEEP(*(SORT_BY_NAME(".dtors*")))
  94. LONG(0)
  95. __DTOR_END__ = .;
  96. *(.rodata .rodata.* .gnu.linkonce.r.*)
  97. _e_rodata = .;
  98. } > REGION_ROM
  99. .data : ALIGN(4)
  100. {
  101. _f_data = .;
  102. *(.data .data.* .gnu.linkonce.d.*)
  103. _f_sdata = .;
  104. __SDATA_BEGIN__ = .;
  105. *(.sdata .sdata.* .gnu.linkonce.s.*)
  106. PROVIDE (__sbss_start = .);
  107. PROVIDE (___sbss_start = .);
  108. _f_sbss = .;
  109. *(.dynsbss)
  110. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  111. *(.scommon)
  112. _e_sbss = .;
  113. PROVIDE (__sbss_end = .);
  114. PROVIDE (___sbss_end = .);
  115. #if defined(EMBARC_UNIT_TEST)
  116. . = ALIGN(8);
  117. _f_embarc_unittest = .;
  118. KEEP(*(.embarc_unittest))
  119. _e_embarc_unittest = .;
  120. #endif
  121. _e_sdata = .;
  122. _e_data = .;
  123. } > REGION_RAM AT > REGION_ROM
  124. .bss (NOLOAD) : ALIGN(8)
  125. {
  126. _f_bss = .;
  127. *(.dynbss)
  128. *(.bss .bss.* .gnu.linkonce.b.*)
  129. *(COMMON)
  130. _e_bss = .;
  131. } > REGION_RAM
  132. .stack (NOLOAD) :
  133. {
  134. . = ALIGN(4);
  135. _f_stack = .;
  136. . = . + _STACKSIZE;
  137. _e_stack = .;
  138. } > REGION_RAM
  139. .heap (NOLOAD) :
  140. {
  141. . = ALIGN(4);
  142. __start_heap = . ;
  143. _f_heap = .;
  144. . = . + _HEAPSIZE;
  145. _e_heap = .;
  146. __end_heap = . ;
  147. } > REGION_RAM
  148. _load_addr_text = LOADADDR(.text);
  149. _load_addr_rodata = LOADADDR(.rodata);
  150. _load_addr_data = LOADADDR(.data);
  151. }