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:
2020-08-21 23:25:03 +02:00
parent 95de84fa85
commit ec117e0627
14 changed files with 493 additions and 738 deletions

View File

@@ -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);
}