linker_template_mw.ld 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #define __ASSEMBLY__
  2. #include <target_mem_config.h>
  3. MEMORY {
  4. #if (REGION_ICCM_SIZE != 0)
  5. REGION_ICCM : ORIGIN = REGION_ICCM_START, LENGTH = REGION_ICCM_SIZE
  6. #endif
  7. #if (REGION_DCCM_SIZE !=0)
  8. REGION_DCCM : ORIGIN = REGION_DCCM_START, LENGTH = REGION_DCCM_SIZE
  9. #endif
  10. #if (REGION_XCCM_SIZE != 0)
  11. REGION_XCCM : ORIGIN = REGION_XCCM_START, LENGTH = REGION_XCCM_SIZE
  12. #endif
  13. #if (REGION_YCCM_SIZE != 0)
  14. REGION_YCCM : ORIGIN = REGION_YCCM_START, LENGTH = REGION_YCCM_SIZE
  15. #endif
  16. #if (REGION_EXT_ROM_SIZE != 0)
  17. REGION_EXT_ROM : ORIGIN = REGION_EXT_ROM_START, LENGTH = REGION_EXT_ROM_SIZE
  18. #endif
  19. #if (REGION_EXT_RAM_SIZE != 0)
  20. REGION_EXT_RAM : ORIGIN = REGION_EXT_RAM_START, LENGTH = REGION_EXT_RAM_SIZE
  21. #endif
  22. }
  23. ENTRY(_start)
  24. SECTIONS {
  25. GROUP : {
  26. .image_head: {
  27. . = . + IMAGE_HEAD_SIZE;
  28. }
  29. .init_bootstrap:{
  30. _f_init = .;
  31. *(.init_vector .init_vector.*)
  32. *(.init_bootstrap .init_bootstrap.*)
  33. _e_init = .;
  34. }
  35. .vector ALIGN(1024): {
  36. _f_vector = .;
  37. *(.vector .vector.*)
  38. _e_vector = .;
  39. }
  40. } > REGION_ROM
  41. #if (REGION_XCCM_SIZE != 0)
  42. GROUP (NOLOAD): {
  43. .x_ccm ALIGN(8): {
  44. _f_x_ccm = .;
  45. *(.x_ccm)
  46. *(.x_ccm.*)
  47. _e_x_ccm = .;
  48. }
  49. } > REGION_XCCM
  50. #endif
  51. #if (REGION_YCCM_SIZE != 0)
  52. GROUP (NOLOAD): {
  53. .y_ccm ALIGN(8): {
  54. _f_y_ccm = .;
  55. *(.y_ccm)
  56. *(.y_ccm.*)
  57. _e_y_ccm = .;
  58. }
  59. } > REGION_YCCM
  60. #endif
  61. GROUP : {
  62. .text ALIGN(4): {
  63. _f_text = .;
  64. *(TYPE text)
  65. *(.text*)
  66. _e_text = .;
  67. }
  68. .rodata ALIGN(4): {
  69. _f_rodata = .;
  70. _fctors = .;
  71. *(.ctors*)
  72. _ectors = .;
  73. _fdtors = .;
  74. *(.dtors*)
  75. _edtors = .;
  76. _feh_frame = .;
  77. *(.eh_frame*)
  78. _eeh_frame = .;
  79. *(TYPE lit)
  80. /* section information for finsh shell */
  81. . = ALIGN(4);
  82. __fsymtab_start = .;
  83. *(FSymTab*)
  84. __fsymtab_end = .;
  85. . = ALIGN(4);
  86. __vsymtab_start = .;
  87. *(VSymTab*)
  88. __vsymtab_end = .;
  89. . = ALIGN(4);
  90. __rt_init_start = .;
  91. *(.rti_fn*)
  92. __rt_init_end = .;
  93. . = ALIGN(4);
  94. _e_rodata = .;
  95. }
  96. } > REGION_ROM
  97. GROUP : {
  98. .data ALIGN(8): {
  99. _f_data = .;
  100. _f_sdata = .;
  101. *(.sdata)
  102. *(.sbss)
  103. _e_sdata = .;
  104. *(TYPE data)
  105. }
  106. #if defined(EMBARC_UNIT_TEST)
  107. .unit_test ALIGN(8): {
  108. _f_embarc_unittest = .;
  109. KEEP(*(".embarc_unittest"))
  110. _e_embarc_unittest = .;
  111. }
  112. #endif
  113. .tls ALIGN(8): {
  114. *(.tls*)
  115. _e_data = .;
  116. }
  117. } > REGION_RAM AT > REGION_ROM
  118. GROUP (NOLOAD) : {
  119. .bss ALIGN(8): {
  120. _f_bss = .;
  121. *(TYPE bss)
  122. _e_bss = .;
  123. }
  124. .stack ALIGN(4) SIZE(_STACKSIZE): {}
  125. .heap? ALIGN(4) SIZE(_HEAPSIZE): {}
  126. } > REGION_RAM
  127. _f_stack = ADDR(.stack);
  128. _e_stack = ADDR(.stack) + SIZEOF(.stack);
  129. _f_heap = ADDR(.heap);
  130. _e_heap = ADDR(.heap) + SIZEOF(.heap);
  131. _load_addr_text = LOADADDR(.text);
  132. _load_addr_rodata = LOADADDR(.rodata);
  133. _load_addr_data = LOADADDR(.data);
  134. }