mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Fix GCC _sbrk allocation
							parent
							
								
									b36147fbe9
								
							
						
					
					
						commit
						f13a3e32b6
					
				| 
						 | 
				
			
			@ -1245,16 +1245,17 @@ extern "C" int errno;
 | 
			
		|||
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
 | 
			
		||||
extern "C" WEAK caddr_t _sbrk(int incr)
 | 
			
		||||
{
 | 
			
		||||
    static  unsigned char *heap = (unsigned char *) &__end__;
 | 
			
		||||
    unsigned char *prev_heap = heap;
 | 
			
		||||
    unsigned char *new_heap = heap + incr;
 | 
			
		||||
    static uint32_t heap = (uint32_t) &__end__;
 | 
			
		||||
    uint32_t prev_heap = heap;
 | 
			
		||||
    uint32_t new_heap = heap + incr;
 | 
			
		||||
 | 
			
		||||
    /* __HeapLimit is end of heap section */
 | 
			
		||||
    if (new_heap >= (unsigned char *) &__HeapLimit) {
 | 
			
		||||
    if (new_heap >= (uint32_t) &__HeapLimit) {
 | 
			
		||||
        errno = ENOMEM;
 | 
			
		||||
        return (caddr_t) -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    heap = new_heap;
 | 
			
		||||
    return (caddr_t) prev_heap;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,9 +44,9 @@ extern void __libc_init_array(void);
 | 
			
		|||
void software_init_hook(void)
 | 
			
		||||
{
 | 
			
		||||
    mbed_stack_isr_start = (unsigned char *) &__StackLimit;
 | 
			
		||||
    mbed_stack_isr_size = ((uint32_t)((uint32_t) &__StackTop - (uint32_t) &__StackLimit));
 | 
			
		||||
    mbed_stack_isr_size = (uint32_t) &__StackTop - (uint32_t) &__StackLimit;
 | 
			
		||||
    mbed_heap_start = (unsigned char *) &__end__;
 | 
			
		||||
    mbed_heap_size = ((uint32_t)((uint32_t) &__HeapLimit - (uint32_t) &__end__));
 | 
			
		||||
    mbed_heap_size = (uint32_t) &__HeapLimit - (uint32_t) &__end__;
 | 
			
		||||
 | 
			
		||||
    mbed_init();
 | 
			
		||||
    mbed_rtos_start();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue