Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app.lds
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
OUTPUT_ARCH( "riscv" )
ENTRY(_start)

/* Define stack size */
STACK_SIZE = 16K;

MEMORY
{
RAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x20000 /* 128 KB */
Expand All @@ -18,9 +21,20 @@ SECTIONS
*(.text.init)
} >RAM

.stack (NOLOAD) :
{
. = ALIGN(16);
_sstack = .;
. += STACK_SIZE;
. = ALIGN(16);
_estack = .;
_sidata = _estack;
} >RAM

.text :
{
. = ALIGN(4);
_stext = .;
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.rodata) /* .rodata sections (constants, strings, etc.) */
Expand Down Expand Up @@ -60,5 +74,4 @@ SECTIONS
_ebss = .;
} >RAM

/* libcrt0/crt0.S inits stack to start just below end of RAM */
}
4 changes: 2 additions & 2 deletions libcrt0/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ _start:
li x30,0
li x31,0

/* init stack below 0x40020000 (TK1_RAM_BASE+TK1_RAM_SIZE) */
li sp, 0x4001fff0
/* init stack */
la sp, _estack

/* zero-init bss section */
la a0, _sbss
Expand Down