/* Overwrite the GCC _sbrk function which check the heap limit related to the stack pointer. In case of freertos this checking will fail.  */
void* _sbrk(uint32_t delta)
/* Overwrite the GCC _sbrk function which check the heap limit related to the stack pointer. In case of freertos this checking will fail.  */
void* _sbrk(uint32_t delta)
{
    extern char _end;
    extern char __HeapLimit;
    static char *heap_end;
    static char *heap_limit;
    char *prev_heap_end;
    if (heap_end == 0)
    {
        heap_end = &_end;
        heap_limit = &__HeapLimit;
    }
    prev_heap_end = heap_end;
    if (prev_heap_end + delta > heap_limit)
    {
        return ((void *)-1L);
    }
    heap_end += delta;
    return ((void *)prev_heap_end);
}