Make malloc actually use the correct region

This commit is contained in:
Felix Kopp 2020-10-14 11:30:09 +00:00
parent 745623afb2
commit 5b41a9d87a
No known key found for this signature in database
GPG key ID: C478BA0A85F75728
3 changed files with 9 additions and 5 deletions

View file

@ -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 <sandtler@sandtler.club>

View file

@ -141,4 +141,7 @@ SECTIONS
. = ALIGN(4);
_end = . ;
_sheap = .;
_eheap = ORIGIN(ram) + LENGTH(ram) - 4;
}

View file

@ -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 */