Commit 8eb4c296 authored by Alessandro Rubini's avatar Alessandro Rubini

Kconfig and ram.ld: add stack size

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent c22b8a56
......@@ -10,6 +10,14 @@ config RAMSIZE
more features you may want to adjust the FPGA size and
choose your preferred value here.
config STACKSIZE
int "Size of the stack area needed by this program"
default 2048
help
The linker complains if the code doesn't fit into RAM, but
we must also consider the stack, or the program will crash
badly at run time.
config MPRINTF
boolean "Use the old mprintf implementation for printf"
default y
......
......@@ -31,7 +31,12 @@ ENTRY(_start)
MEMORY
{
ram : ORIGIN = 0x00000000, LENGTH = CONFIG_RAMSIZE
ram :
ORIGIN = 0x00000000,
LENGTH = CONFIG_RAMSIZE - CONFIG_STACKSIZE
stack :
ORIGIN = CONFIG_RAMSIZE - CONFIG_STACKSIZE,
LENGTH = CONFIG_STACKSIZE
}
SECTIONS
......@@ -54,8 +59,8 @@ SECTIONS
_ebss = .;
} > ram
/* First location in stack is highest address in RAM */
PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4);
/* First location in stack is highest address in STACK */
PROVIDE(_fstack = ORIGIN(stack) + LENGTH(stack) - 4);
}
/* We need to provide mprintf to ptp-noposix object files, if missing */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment