m2354_link.ld 4.3 KB

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