forked from M-Labs/artiq
1
0
Fork 0

firmware: merge runtime and satman linker scripts

This commit is contained in:
mwojcik 2023-10-09 13:24:32 +08:00 committed by Sébastien Bourdeauducq
parent 333b81f789
commit f3c79e71e1
4 changed files with 16 additions and 107 deletions

View File

@ -6,7 +6,7 @@ ENTRY(_reset_handler)
* ld does not allow this expression here.
*/
MEMORY {
runtime (RWX) : ORIGIN = 0x40000000, LENGTH = 0x4000000 /* 64M */
firmware (RWX) : ORIGIN = 0x40000000, LENGTH = 0x4000000 /* 64M */
}
SECTIONS
@ -14,24 +14,24 @@ SECTIONS
.vectors :
{
*(.vectors)
} > runtime
} > firmware
.text :
{
*(.text .text.*)
} > runtime
} > firmware
.eh_frame :
{
__eh_frame_start = .;
KEEP(*(.eh_frame))
__eh_frame_end = .;
} > runtime
} > firmware
.eh_frame_hdr :
{
KEEP(*(.eh_frame_hdr))
} > runtime
} > firmware
__eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0;
__eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0;
@ -39,35 +39,35 @@ SECTIONS
.gcc_except_table :
{
*(.gcc_except_table)
} > runtime
} > firmware
/* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */
.got :
{
*(.got)
} > runtime
} > firmware
.got.plt :
{
*(.got.plt)
} > runtime
} > firmware
.rodata :
{
*(.rodata .rodata.*)
} > runtime
} > firmware
.data :
{
*(.data .data.*)
} > runtime
} > firmware
.bss (NOLOAD) : ALIGN(4)
{
_fbss = .;
*(.sbss .sbss.* .bss .bss.*);
_ebss = .;
} > runtime
} > firmware
.stack (NOLOAD) : ALIGN(0x1000)
{
@ -76,12 +76,12 @@ SECTIONS
_estack = .;
. += 0x10000;
_fstack = . - 16;
} > runtime
} > firmware
.heap (NOLOAD) : ALIGN(16)
{
_fheap = .;
. = ORIGIN(runtime) + LENGTH(runtime);
. = ORIGIN(firmware) + LENGTH(firmware);
_eheap = .;
} > runtime
} > firmware
}

View File

@ -21,7 +21,7 @@ $(RUSTOUT)/libruntime.a:
--target $(RUNTIME_DIRECTORY)/../$(CARGO_TRIPLE).json
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
$(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \
$(link) -T $(RUNTIME_DIRECTORY)/../firmware.ld \
-lunwind-vexriscv-bare -m elf32lriscv
ksupport_data.o: ../ksupport/ksupport.elf

View File

@ -21,7 +21,7 @@ $(RUSTOUT)/libsatman.a:
--target $(SATMAN_DIRECTORY)/../$(CARGO_TRIPLE).json
satman.elf: $(RUSTOUT)/libsatman.a ksupport_data.o
$(link) -T $(SATMAN_DIRECTORY)/satman.ld \
$(link) -T $(SATMAN_DIRECTORY)/../firmware.ld \
-lunwind-vexriscv-bare -m elf32lriscv
ksupport_data.o: ../ksupport/ksupport.elf

View File

@ -1,91 +0,0 @@
INCLUDE generated/output_format.ld
INCLUDE generated/regions.ld
ENTRY(_reset_handler)
SECTIONS
{
.vectors :
{
*(.vectors)
} > main_ram
.text :
{
*(.text .text.*)
. = ALIGN(0x40000);
} > main_ram
.eh_frame :
{
__eh_frame_start = .;
KEEP(*(.eh_frame))
__eh_frame_end = .;
} > main_ram
.eh_frame_hdr :
{
KEEP(*(.eh_frame_hdr))
} > main_ram
__eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0;
__eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0;
.gcc_except_table :
{
*(.gcc_except_table)
} > main_ram
/* https://sourceware.org/bugzilla/show_bug.cgi?id=20475 */
.got :
{
PROVIDE(_GLOBAL_OFFSET_TABLE_ = .);
*(.got)
} > main_ram
.got.plt :
{
*(.got.plt)
} > main_ram
.rodata :
{
_frodata = .;
*(.rodata .rodata.*)
_erodata = .;
} > main_ram
.data :
{
*(.data .data.*)
} > main_ram
.sdata :
{
*(.sdata .sdata.*)
} > main_ram
.bss (NOLOAD) : ALIGN(4)
{
_fbss = .;
*(.sbss .sbss.* .bss .bss.*);
. = ALIGN(4);
_ebss = .;
} > main_ram
.stack (NOLOAD) : ALIGN(0x1000)
{
_sstack_guard = .;
. += 0x1000;
_estack = .;
. += 0x10000;
_fstack = . - 16;
} > main_ram
/* remainder of 64MB for heap for alloc use */
.heap (NOLOAD) : ALIGN(16)
{
_fheap = .;
. = 0x44000000; // not to overwrite RPC queue
_eheap = .;
} > main_ram
}