diff --git a/arch/at91sam3x8e/config.ld b/arch/at91sam3x8e/config.ld index 538bdb5..5b5f789 100644 --- a/arch/at91sam3x8e/config.ld +++ b/arch/at91sam3x8e/config.ld @@ -2,10 +2,10 @@ /* See the end of this file for copyright, licensing, and warranty information. */ /* - * stack size is 32K (uses the entire sram1 bank) + * stack size is 8K * TODO: modify flash.ld to actually align this properly */ -STACK_SIZE = 0x8000; +STACK_SIZE = 0x2000; /* * Copyright (c) 2020 Felix Kopp diff --git a/arch/at91sam3x8e/flash.ld b/arch/at91sam3x8e/flash.ld index 8d652b6..0eb9753 100644 --- a/arch/at91sam3x8e/flash.ld +++ b/arch/at91sam3x8e/flash.ld @@ -141,4 +141,7 @@ SECTIONS . = ALIGN(4); _end = . ; + + _sheap = .; + _eheap = ORIGIN(ram) + LENGTH(ram) - 4; } diff --git a/arch/at91sam3x8e/startup.c b/arch/at91sam3x8e/startup.c index d442938..c546b9f 100644 --- a/arch/at91sam3x8e/startup.c +++ b/arch/at91sam3x8e/startup.c @@ -16,9 +16,10 @@ extern uint32_t _srelocate; /* relocate (.data) start */ extern uint32_t _erelocate; /* relocate end */ extern uint32_t _szero; /* zero area (.bss) start */ extern uint32_t _ezero; /* zero area end */ -/* the entire heap sits in between _ezero and _sstack */ extern uint32_t _sstack; /* stack start */ extern uint32_t _estack; /* stack end */ +extern uint32_t _sheap; /* heap start */ +extern uint32_t _eheap; /* heap end */ /* implementation in init/main.c */ void do_bootstrap(void); @@ -38,8 +39,8 @@ void irq_reset(void) /* There is no userspace yet, so the Kernel gets the entire heap for now */ malloc_init( - &_ezero + sizeof(void *), - (size_t)(&_sstack) - (size_t)(&_ezero) - sizeof(void *) + &_sheap, + (size_t)(&_sheap) - (size_t)(&_sheap) ); /* start the Kernel */