missing pico/malloc.h fixes #136

This commit is contained in:
graham sanderson 2021-02-17 14:32:34 -06:00
parent 6f94f6a3d7
commit 8b6d27d0e5
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,8 @@ if (NOT TARGET pico_malloc)
${CMAKE_CURRENT_LIST_DIR}/pico_malloc.c
)
target_include_directories(pico_malloc INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
pico_wrap_function(pico_malloc malloc)
pico_wrap_function(pico_malloc calloc)
pico_wrap_function(pico_malloc free)

View File

@ -7,6 +7,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "pico.h"
#include "pico/malloc.h"
#if PICO_USE_MALLOC_MUTEX
#include "pico/mutex.h"
@ -35,7 +36,7 @@ void *__wrap_malloc(size_t size) {
#if PICO_USE_MALLOC_MUTEX
mutex_exit(&malloc_mutex);
#endif
#ifdef PICO_DEBUG_MALLOC
#if PICO_DEBUG_MALLOC
if (!rc || ((uint8_t *)rc) + size > (uint8_t*)PICO_DEBUG_MALLOC_LOW_WATER) {
printf("malloc %d %p->%p\n", (uint) size, rc, ((uint8_t *) rc) + size);
}
@ -52,7 +53,7 @@ void *__wrap_calloc(size_t count, size_t size) {
#if PICO_USE_MALLOC_MUTEX
mutex_exit(&malloc_mutex);
#endif
#ifdef PICO_DEBUG_MALLOC
#if PICO_DEBUG_MALLOC
if (!rc || ((uint8_t *)rc) + size > (uint8_t*)PICO_DEBUG_MALLOC_LOW_WATER) {
printf("calloc %d %p->%p\n", (uint) (count * size), rc, ((uint8_t *) rc) + size);
}