2023-10-25 20:35:44 +02:00
|
|
|
OUTPUT_ARCH( "riscv" )
|
|
|
|
|
|
|
|
ENTRY( _start )
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
|
|
|
flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 512M
|
|
|
|
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 128K
|
|
|
|
}
|
|
|
|
|
|
|
|
PHDRS
|
|
|
|
{
|
|
|
|
flash PT_LOAD;
|
|
|
|
ram_init PT_LOAD;
|
|
|
|
ram PT_NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
|
|
|
|
|
|
|
|
.init ORIGIN(flash) :
|
|
|
|
{
|
|
|
|
KEEP (*(SORT_NONE(.init)))
|
2024-03-24 19:16:13 +01:00
|
|
|
*crt0.o(.text .text.*)
|
2023-10-25 20:35:44 +02:00
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.text :
|
|
|
|
{
|
2024-03-24 19:16:13 +01:00
|
|
|
*(.text.init)
|
|
|
|
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
|
|
|
|
*(.text.exit .text.exit.*)
|
2023-10-25 20:35:44 +02:00
|
|
|
*(.text.startup .text.startup.*)
|
2024-03-24 19:16:13 +01:00
|
|
|
*(.text.hot .text.hot.*)
|
2023-10-25 20:35:44 +02:00
|
|
|
*(.text .text.*)
|
2024-03-24 19:16:13 +01:00
|
|
|
*(.stub)
|
2023-10-25 20:35:44 +02:00
|
|
|
*(.gnu.linkonce.t.*)
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.fini :
|
|
|
|
{
|
|
|
|
KEEP (*(SORT_NONE(.fini)))
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
PROVIDE (__etext = .);
|
|
|
|
PROVIDE (_etext = .);
|
|
|
|
PROVIDE (etext = .);
|
|
|
|
|
|
|
|
.rodata :
|
|
|
|
{
|
|
|
|
*(.rdata)
|
|
|
|
*(.rodata .rodata.*)
|
|
|
|
*(.gnu.linkonce.r.*)
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
2024-03-24 19:16:13 +01:00
|
|
|
/* Thread Local Storage sections */
|
|
|
|
.tdata :
|
|
|
|
{
|
|
|
|
PROVIDE_HIDDEN (__tdata_start = .);
|
|
|
|
*(.tdata .tdata.* .gnu.linkonce.td.*)
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } >flash AT>flash :flash
|
2023-10-25 20:35:44 +02:00
|
|
|
.preinit_array :
|
|
|
|
{
|
|
|
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
|
|
KEEP (*(.preinit_array))
|
|
|
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.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 = .);
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.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 = .);
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.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))
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.dtors :
|
|
|
|
{
|
|
|
|
KEEP (*crtbegin.o(.dtors))
|
|
|
|
KEEP (*crtbegin?.o(.dtors))
|
|
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
|
|
|
KEEP (*(SORT(.dtors.*)))
|
|
|
|
KEEP (*(.dtors))
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.lalign :
|
|
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
|
|
PROVIDE( _data_lma = . );
|
|
|
|
} >flash AT>flash :flash
|
|
|
|
|
|
|
|
.dalign :
|
|
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
|
|
PROVIDE( _data = . );
|
|
|
|
} >ram AT>flash :ram_init
|
|
|
|
|
|
|
|
.srodata :
|
|
|
|
{
|
|
|
|
PROVIDE( _gp = . + 0x800 );
|
|
|
|
*(.srodata.cst16)
|
|
|
|
*(.srodata.cst8)
|
|
|
|
*(.srodata.cst4)
|
|
|
|
*(.srodata.cst2)
|
|
|
|
*(.srodata .srodata.*)
|
|
|
|
} >ram AT>flash :ram_init
|
|
|
|
|
2024-03-24 19:16:13 +01:00
|
|
|
.data :
|
2023-10-25 20:35:44 +02:00
|
|
|
{
|
2024-03-24 19:16:13 +01:00
|
|
|
*(.data .data.*)
|
|
|
|
*(.gnu.linkonce.d.*)
|
|
|
|
PROVIDE( __global_pointer$ = . + 0x800 );
|
2023-10-25 20:35:44 +02:00
|
|
|
*(.sdata .sdata.*)
|
|
|
|
*(.gnu.linkonce.s.*)
|
|
|
|
} >ram AT>flash :ram_init
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
PROVIDE( _edata = . );
|
|
|
|
PROVIDE( edata = . );
|
|
|
|
|
|
|
|
PROVIDE( _fbss = . );
|
|
|
|
PROVIDE( __bss_start = . );
|
|
|
|
.bss :
|
|
|
|
{
|
|
|
|
*(.sbss*)
|
|
|
|
*(.gnu.linkonce.sb.*)
|
|
|
|
*(.bss .bss.*)
|
|
|
|
*(.gnu.linkonce.b.*)
|
|
|
|
*(COMMON)
|
|
|
|
. = ALIGN(4);
|
|
|
|
} >ram AT>ram :ram
|
|
|
|
|
|
|
|
. = ALIGN(8);
|
|
|
|
__BSS_END__ = .;
|
|
|
|
PROVIDE( _end = . );
|
|
|
|
PROVIDE( end = . );
|
|
|
|
|
|
|
|
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
|
|
|
|
{
|
|
|
|
PROVIDE( _heap_end = . );
|
|
|
|
. = __stack_size;
|
|
|
|
PROVIDE( _sp = . );
|
|
|
|
} >ram AT>ram :ram
|
|
|
|
|
|
|
|
PROVIDE( tohost = 0xfffffff0 );
|
|
|
|
PROVIDE( fromhost = 0xfffffff8 );
|
2024-03-24 19:16:13 +01:00
|
|
|
|
|
|
|
/* Stabs debugging sections. */
|
|
|
|
.stab 0 : { *(.stab) }
|
|
|
|
.stabstr 0 : { *(.stabstr) }
|
|
|
|
.stab.excl 0 : { *(.stab.excl) }
|
|
|
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
|
|
|
.stab.index 0 : { *(.stab.index) }
|
|
|
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
|
|
|
.comment 0 : { *(.comment) }
|
|
|
|
.gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
|
|
|
|
/* DWARF debug sections.
|
|
|
|
Symbols in the DWARF debugging sections are relative to the beginning
|
|
|
|
of the section so we begin them at 0. */
|
|
|
|
/* DWARF 1 */
|
|
|
|
.debug 0 : { *(.debug) }
|
|
|
|
.line 0 : { *(.line) }
|
|
|
|
/* GNU DWARF 1 extensions */
|
|
|
|
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
|
|
|
.debug_sfnames 0 : { *(.debug_sfnames) }
|
|
|
|
/* DWARF 1.1 and DWARF 2 */
|
|
|
|
.debug_aranges 0 : { *(.debug_aranges) }
|
|
|
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
|
|
|
/* DWARF 2 */
|
|
|
|
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
|
|
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
|
|
|
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
|
|
|
|
.debug_frame 0 : { *(.debug_frame) }
|
|
|
|
.debug_str 0 : { *(.debug_str) }
|
|
|
|
.debug_loc 0 : { *(.debug_loc) }
|
|
|
|
.debug_macinfo 0 : { *(.debug_macinfo) }
|
|
|
|
/* SGI/MIPS DWARF 2 extensions */
|
|
|
|
.debug_weaknames 0 : { *(.debug_weaknames) }
|
|
|
|
.debug_funcnames 0 : { *(.debug_funcnames) }
|
|
|
|
.debug_typenames 0 : { *(.debug_typenames) }
|
|
|
|
.debug_varnames 0 : { *(.debug_varnames) }
|
|
|
|
/* DWARF 3 */
|
|
|
|
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
|
|
|
.debug_ranges 0 : { *(.debug_ranges) }
|
|
|
|
/* DWARF Extension. */
|
|
|
|
.debug_macro 0 : { *(.debug_macro) }
|
|
|
|
.debug_addr 0 : { *(.debug_addr) }
|
|
|
|
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
|
|
|
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
|
2023-10-25 20:35:44 +02:00
|
|
|
}
|