Change linker script and startup code.
This is my own code from my template. It is much cleaner than the old code.
This commit is contained in:
@@ -27,19 +27,19 @@ extern struct stm_uart shell_uart;
|
||||
|
||||
char* _sbrk(int incr)
|
||||
{
|
||||
extern char heap_low; // Defined by the linker
|
||||
extern char heap_top;
|
||||
extern char __ld_sheap; // Defined by the linker
|
||||
extern char __ld_eheap;
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
|
||||
if (heap_end == 0) {
|
||||
heap_end = &heap_low;
|
||||
heap_end = &__ld_sheap;
|
||||
}
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
|
||||
|
||||
if (heap_end + incr > &heap_top) {
|
||||
if (heap_end + incr > &__ld_eheap) {
|
||||
errno = ENOMEM;
|
||||
return (char *)-1;
|
||||
}
|
||||
@@ -110,3 +110,10 @@ int _kill(int pid)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void _exit(int pid)
|
||||
{
|
||||
(void)pid;
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user