diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c b/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c index b193ec3b8d..2a1dcf9860 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/malloc.c @@ -536,3 +536,25 @@ void* get_addr_mem_region_end_addr(void *addr) } return 0; } + +/* + alloction functions for newlib + */ +void *__wrap__calloc_r(void *rptr, size_t nmemb, size_t size) +{ + (void)rptr; + return calloc(nmemb, size); +} + +void *__wrap__malloc_r(void *rptr, size_t size) +{ + (void)rptr; + // we want consistent zero memory + return calloc(1, size); +} + +void __wrap__free_r(void *rptr, void *ptr) +{ + (void)rptr; + return free(ptr); +}