GD32VF103x8.lds 4.4 KB
Newer Older
1 2 3 4 5
OUTPUT_ARCH( "riscv" )

ENTRY( _start )

MEMORY
mysterywolf's avatar
mysterywolf 已提交
6 7 8 9 10 11 12 13 14
{
    /* Run in FLASH */
    flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 64k
    ram   (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 20k

    /* Run in RAM */
/*  flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 15k
    ram   (wxa!ri) : ORIGIN = 0x20003C00, LENGTH = 5K
*/
15 16 17 18 19 20 21 22 23 24 25
}


SECTIONS
{
  __stack_size = DEFINED(__stack_size) ? __stack_size : 2K;


  .init           :
  {
    KEEP (*(SORT_NONE(.init)))
mysterywolf's avatar
mysterywolf 已提交
26
  } >flash AT>flash
27 28 29 30 31

  .ilalign         :
  {
    . = ALIGN(4);
    PROVIDE( _ilm_lma = . );
mysterywolf's avatar
mysterywolf 已提交
32
  } >flash AT>flash
33 34 35 36

  .ialign         :
  {
    PROVIDE( _ilm = . );
mysterywolf's avatar
mysterywolf 已提交
37
  } >flash AT>flash
38 39 40

  .text           :
  {
mysterywolf's avatar
mysterywolf 已提交
41
    *(.rodata .rodata.*)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    *(.text.unlikely .text.unlikely.*)
    *(.text.startup .text.startup.*)
    *(.text .text.*)
    *(.gnu.linkonce.t.*)

    /* section information for finsh shell */
    . = ALIGN(4);
    __fsymtab_start = .;
    KEEP(*(FSymTab))
    __fsymtab_end = .;
    . = ALIGN(4);
    __vsymtab_start = .;
    KEEP(*(VSymTab))
    __vsymtab_end = .;
    . = ALIGN(4);

    /* section information for initial. */
    . = ALIGN(4);
    __rt_init_start = .;
    KEEP(*(SORT(.rti_fn*)))
    __rt_init_end = .;
    . = ALIGN(4);

    /* section information for modules */
    . = ALIGN(4);
    __rtmsymtab_start = .;
    KEEP(*(RTMSymTab))
    __rtmsymtab_end = .;

mysterywolf's avatar
mysterywolf 已提交
71
  } >flash AT>flash
72 73 74 75

  .fini           :
  {
    KEEP (*(SORT_NONE(.fini)))
mysterywolf's avatar
mysterywolf 已提交
76
  } >flash AT>flash
77 78 79 80 81 82 83 84 85 86 87 88 89

  . = ALIGN(4);

  PROVIDE (__etext = .);
  PROVIDE (_etext = .);/*0x80022c8*/
  PROVIDE (etext = .);/*0x80022c8*/
  PROVIDE( _eilm = . );

  .preinit_array  :
  {
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array))
    PROVIDE_HIDDEN (__preinit_array_end = .);
mysterywolf's avatar
mysterywolf 已提交
90
  } >flash AT>flash
91 92 93 94 95 96 97

  .init_array     :
  {
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
    KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
    PROVIDE_HIDDEN (__init_array_end = .);
mysterywolf's avatar
mysterywolf 已提交
98
  } >flash AT>flash
99 100 101 102 103 104 105

  .fini_array     :
  {
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
    KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
    PROVIDE_HIDDEN (__fini_array_end = .);
mysterywolf's avatar
mysterywolf 已提交
106
  } >flash AT>flash
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

  .ctors          :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */
    KEEP (*crtbegin.o(.ctors))
    KEEP (*crtbegin?.o(.ctors))
    /* We don't want to include the .ctor section from
       the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
mysterywolf's avatar
mysterywolf 已提交
128
  } >flash AT>flash
129 130 131 132 133 134 135 136

  .dtors          :
  {
    KEEP (*crtbegin.o(.dtors))
    KEEP (*crtbegin?.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
mysterywolf's avatar
mysterywolf 已提交
137
  } >flash AT>flash
138 139 140 141 142 143 144 145

    . = ALIGN(4);
    PROVIDE( _eilm = . );

  .lalign         :
  {
    . = ALIGN(4);
    PROVIDE( _data_lma = . );
mysterywolf's avatar
mysterywolf 已提交
146
  } >flash AT>flash
147 148 149 150 151

  .dalign         :
  {
    . = ALIGN(4);
    PROVIDE( _data = . );
mysterywolf's avatar
mysterywolf 已提交
152 153 154
  } >ram AT>flash


155 156
  .data          :
  {
mysterywolf's avatar
mysterywolf 已提交
157 158
    *(.rdata)

159 160 161 162
    *(.gnu.linkonce.r.*)
    *(.data .data.*)
    *(.gnu.linkonce.d.*)
    . = ALIGN(8);
mysterywolf's avatar
mysterywolf 已提交
163
    PROVIDE( __global_pointer$ = . + 0x800);
164 165 166 167 168 169 170 171
    *(.sdata .sdata.*)
    *(.gnu.linkonce.s.*)
    . = ALIGN(8);
    *(.srodata.cst16)
    *(.srodata.cst8)
    *(.srodata.cst4)
    *(.srodata.cst2)
    *(.srodata .srodata.*)
mysterywolf's avatar
mysterywolf 已提交
172
  } >ram AT>flash
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187

  . = ALIGN(4);
  PROVIDE( _edata = . );
  PROVIDE( edata = . );

  PROVIDE( _fbss = . ); /*0X200052A0  0X200002A0*/
  PROVIDE( __bss_start = . );
  .bss            :
  {
    *(.sbss*)
    *(.gnu.linkonce.sb.*)
    *(.bss .bss.*)
    *(.gnu.linkonce.b.*)
    *(COMMON)
    . = ALIGN(4);
mysterywolf's avatar
mysterywolf 已提交
188
  } >ram AT>ram
189 190 191 192 193 194 195

  . = ALIGN(8);
  PROVIDE( _end = . ); /*0X2000,0340*/
  PROVIDE( end = . );

  .stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
  {
mysterywolf's avatar
mysterywolf 已提交
196 197 198 199
    PROVIDE( _heap_end = . );
    . = __stack_size;
    PROVIDE( _sp = . );
  } >ram AT>ram
200
}