Skip to content

Commit

Permalink
[arch] add riscv64 linker
Browse files Browse the repository at this point in the history
  • Loading branch information
YuzukiTsuru committed Feb 3, 2024
1 parent 7959f00 commit eef5a6b
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions link/riscv64/link.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* SPDX-License-Identifier: Apache-2.0 */

OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
OUTPUT_ARCH("riscv")
SEARCH_DIR(.)

/* Memory Spaces Definitions */
MEMORY
{
ram (rwx) : ORIGIN = @ARCH_START_ADDRESS@, LENGTH = @ARCH_SRAM_LENGTH@ /* SRAMC. 132K on boot mode, 100K on FEL mode */
}

/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = 0x1000; /* 4KB */

/* Section Definitions */
SECTIONS
{

.text :
{
. = ALIGN(4);
PROVIDE(__spl_start = .);
*(.text .text.*)
PROVIDE(__ddr_bin_start = .);
KEEP(*(.init_dram_bin))
PROVIDE(__ddr_bin_end = .);
KEEP(*(.note.gnu.build-id))
. = ALIGN(4);
} > ram

. = ALIGN(4);

PROVIDE(__spl_end = .);
PROVIDE(__spl_size = __spl_end - __spl_start);

/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = . ;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
} > ram

.stack (NOLOAD):
{
. = ALIGN(8);
/* SRV stack section */
__stack_srv_start = .;
. += STACK_SIZE;
__stack_srv_end = .;
} > ram

. = ALIGN(4);
_end = . ;
}

0 comments on commit eef5a6b

Please sign in to comment.