gcc_csky.ld 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /******************************************************************************
  17. * @file gcc_csky.h
  18. * @brief csky linker file for PHOBOS
  19. * @version V1.0
  20. * @date 02. June 2017
  21. ******************************************************************************/
  22. MEMORY
  23. {
  24. I-SRAM : ORIGIN = 0x0 , LENGTH = 0x40000 /* I-SRAM 256KB */
  25. D-SRAM : ORIGIN = 0x20000000 , LENGTH = 0xc0000 /* D-SRAM 768KB */
  26. O-SRAM : ORIGIN = 0x50000000 , LENGTH = 0x800000 /* off-chip SRAM 8MB */
  27. SRAM : ORIGIN = 0x60000000 , LENGTH = 0x20000 /* on-chip SRAM 128KB */
  28. }
  29. PROVIDE (__StackTop = 0x200c0000 - 0x8);
  30. PROVIDE (Stack_Size = 0x1000);
  31. REGION_ALIAS("REGION_TEXT", I-SRAM);
  32. REGION_ALIAS("REGION_RODATA", I-SRAM);
  33. REGION_ALIAS("REGION_CUSTOM1", D-SRAM);
  34. REGION_ALIAS("REGION_CUSTOM2", D-SRAM);
  35. REGION_ALIAS("REGION_DATA", D-SRAM);
  36. REGION_ALIAS("REGION_BSS", D-SRAM);
  37. ENTRY(Reset_Handler)
  38. SECTIONS
  39. {
  40. .text : AT(ADDR(.text)){
  41. . = ALIGN(0x4) ;
  42. __stext = . ;
  43. KEEP(*startup_gcc.o(*.text*))
  44. *(.text)
  45. *(.text*)
  46. *(.text.*)
  47. *(.gnu.warning)
  48. *(.stub)
  49. *(.gnu.linkonce.t*)
  50. *(.glue_7t)
  51. *(.glue_7)
  52. *(.jcr)
  53. *(.init)
  54. *(.fini)
  55. . = ALIGN (4) ;
  56. PROVIDE(__ctbp = .);
  57. *(.call_table_data)
  58. *(.call_table_text)
  59. /* section information for finsh shell */
  60. . = ALIGN(4);
  61. __fsymtab_start = .;
  62. KEEP(*(FSymTab))
  63. __fsymtab_end = .;
  64. . = ALIGN(4);
  65. __vsymtab_start = .;
  66. KEEP(*(VSymTab))
  67. __vsymtab_end = .;
  68. . = ALIGN(4);
  69. /* section information for initial. */
  70. . = ALIGN(4);
  71. __rt_init_start = .;
  72. KEEP(*(SORT(.rti_fn*)))
  73. __rt_init_end = .;
  74. . = ALIGN(4);
  75. . = ALIGN(0x10) ;
  76. __etext = . ;
  77. } > REGION_TEXT
  78. .eh_frame_hdr : {
  79. *(.eh_frame_hdr)
  80. } > REGION_TEXT
  81. .eh_frame : ONLY_IF_RO {
  82. KEEP (*(.eh_frame))
  83. } > REGION_TEXT
  84. .gcc_except_table : ONLY_IF_RO {
  85. *(.gcc_except_table .gcc_except_table.*)
  86. } > REGION_TEXT
  87. .rodata :{
  88. . = ALIGN(0x4) ;
  89. __srodata = .;
  90. *(.rdata)
  91. *(.rdata*)
  92. *(.rdata1)
  93. *(.rdata.*)
  94. *(.rodata)
  95. *(.rodata1)
  96. *(.rodata*)
  97. *(.rodata.*)
  98. *(.srodata*)
  99. *(.rodata.str1.4)
  100. . = ALIGN(0x4) ;
  101. __ctor_start__ = .;
  102. KEEP (*(SORT(.ctors.*)))
  103. KEEP (*(.ctors))
  104. __ctor_end__ = .;
  105. KEEP (*(SORT(.dtors.*)))
  106. KEEP (*(.dtors))
  107. __dtor_end__ = .;
  108. . = ALIGN(0x4) ;
  109. __erodata = .;
  110. __rodata_end__ = .;
  111. } > REGION_RODATA
  112. .data : {
  113. . = ALIGN(0x4) ;
  114. __data_start__ = . ;
  115. __sdata = . ;
  116. data_start = . ;
  117. KEEP(*startup_gcc.o(*.vectors*))
  118. *(.got.plt)
  119. *(.got)
  120. *(.gnu.linkonce.r*)
  121. *(.data)
  122. *(.data*)
  123. *(.data1)
  124. *(.data.*)
  125. *(.gnu.linkonce.d*)
  126. *(.data1)
  127. *(.gcc_except_table)
  128. *(.gcc_except_table*)
  129. __start_init_call = .;
  130. *(.initcall.init)
  131. __stop_init_call = .;
  132. __start_cmd = .;
  133. *(.bootloaddata.cmd)
  134. . = ALIGN(4) ;
  135. __stop_cmd = .;
  136. __global_pointer$ = .;
  137. *(.sdata)
  138. *(.sdata.*)
  139. *(.gnu.linkonce.s.*)
  140. *(__libc_atexit)
  141. *(__libc_subinit)
  142. *(__libc_subfreeres)
  143. *(.note.ABI-tag)
  144. __edata = .;
  145. __data_end__ = .;
  146. . = ALIGN(0x4) ;
  147. } > REGION_DATA AT > REGION_RODATA
  148. .eh_frame : ONLY_IF_RW {
  149. KEEP (*(.eh_frame))
  150. } > REGION_DATA AT > REGION_RODATA
  151. .gcc_except_table : ONLY_IF_RW {
  152. *(.gcc_except_table .gcc_except_table.*)
  153. __edata = .;
  154. __data_end__ = .;
  155. } > REGION_DATA AT > REGION_RODATA
  156. .bss : {
  157. . = ALIGN(0x4) ;
  158. __sbss = ALIGN(0x4) ;
  159. __bss_start__ = . ;
  160. *(.dynsbss)
  161. *(.sbss)
  162. *(.sbss.*)
  163. *(.scommon)
  164. *(.dynbss)
  165. *(.bss)
  166. *(.bss.*)
  167. *(COMMON)
  168. . = ALIGN(0x4) ;
  169. __ebss = . ;
  170. __end = . ;
  171. end = . ;
  172. __bss_end__ = .;
  173. } > REGION_BSS
  174. /* End of uninitalized data segement */
  175. PROVIDE(end = .);
  176. }