Merge pull request #2607 from 0xc0170/fix_uvisor_memory_tracing

Fix uvisor memory tracing
pull/2617/head
Sam Grove 2016-09-02 19:41:51 +03:00 committed by GitHub
commit fbf535be59
2 changed files with 7 additions and 7 deletions

View File

@ -67,9 +67,6 @@ void mbed_stats_heap_get(mbed_stats_heap_t *stats)
#include "uvisor-lib/uvisor-lib.h"
#endif/* FEATURE_UVISOR */
// TODO: memory tracing doesn't work with uVisor enabled.
#if !defined(FEATURE_UVISOR)
extern "C" {
void * __real__malloc_r(struct _reent * r, size_t size);
void * __real__realloc_r(struct _reent * r, void * ptr, size_t size);
@ -77,6 +74,9 @@ extern "C" {
void* __real__calloc_r(struct _reent * r, size_t nmemb, size_t size);
}
// TODO: memory tracing doesn't work with uVisor enabled.
#if !defined(FEATURE_UVISOR)
extern "C" void * __wrap__malloc_r(struct _reent * r, size_t size) {
void *ptr = NULL;
#ifdef MBED_HEAP_STATS_ENABLED
@ -167,6 +167,8 @@ extern "C" void __wrap__free_r(struct _reent * r, void * ptr) {
#endif // #ifdef MBED_MEM_TRACING_ENABLED
}
#endif // if !defined(FEATURE_UVISOR)
extern "C" void * __wrap__calloc_r(struct _reent * r, size_t nmemb, size_t size) {
void *ptr = NULL;
#ifdef MBED_HEAP_STATS_ENABLED
@ -187,7 +189,6 @@ extern "C" void * __wrap__calloc_r(struct _reent * r, size_t nmemb, size_t size)
return ptr;
}
#endif // if !defined(FEATURE_UVISOR)
/******************************************************************************/
/* ARMCC memory allocation wrappers */

View File

@ -480,10 +480,9 @@ extern "C" WEAK void __cxa_pure_virtual(void) {
#endif
#if defined(TOOLCHAIN_GCC)
/* uVisor wraps malloc_r, realloc_r and free_r, but not calloc_r! */
#ifndef FEATURE_UVISOR
#ifdef FEATURE_UVISOR
#include "uvisor-lib/uvisor-lib.h"
#endif/* FEATURE_UVISOR */