ref: 1f5edc9325fc4427ebf3de5a4b1a21e38e6cc211
parent: 5fb0c2c21bd67181d2c55405b2c81734f071d2a6
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue May 13 16:30:02 EDT 2014
Syscalls update
--- a/demos/stm32f429_disco/syscalls.c
+++ b/demos/stm32f429_disco/syscalls.c
@@ -67,24 +67,22 @@
caddr_t _sbrk(int incr)
{
- extern char __heap_end asm("__heap_end");
- static char *heap_end;
- char *prev_heap_end;
+ extern char __heap_start;
+ extern char __heap_end;
+ static char *current_heap_end = &__heap_start;
+ char *previous_heap_end;
- if (heap_end == 0)
- heap_end = &__heap_end;
+ previous_heap_end = current_heap_end;
- prev_heap_end = heap_end;
- if ((unsigned int)(heap_end + incr) > (0x20000000 + 0x20000))
- {
- abort();
- errno = ENOMEM;
- return (caddr_t) -1;
- }
+ if (current_heap_end + incr > &__heap_end)
+ {
+ errno = ENOMEM;
+ return (caddr_t) -1;
+ }
- heap_end += incr;
+ current_heap_end += incr;
- return (caddr_t) prev_heap_end;
+ return (caddr_t)previous_heap_end;
}
int _close(int file)