feat(esp8266): Perfect WIFI OSI heap trace API

This commit is contained in:
Dong Heng
2018-09-18 13:49:37 +08:00
parent cba51957a4
commit 7b34f24aa4
11 changed files with 27 additions and 33 deletions

View File

@ -80,11 +80,11 @@ typedef struct {
bool (*timer_stop)(void *timer, uint32_t ticks);
bool (*timer_delete)(void *timer, uint32_t ticks);
void *(*malloc)(uint32_t size, uint32_t cap);
void *(*zalloc)(uint32_t size, uint32_t cap);
void *(*realloc)(void *ptr, uint32_t size, uint32_t cap);
void *(*calloc)(uint32_t cnt, uint32_t size, uint32_t cap);
void (*free)(void *p);
void *(*malloc)(uint32_t size, uint32_t cap, const char *file, size_t line);
void *(*zalloc)(uint32_t size, uint32_t cap, const char *file, size_t line);
void *(*realloc)(void *ptr, uint32_t size, uint32_t cap, const char *file, size_t line);
void *(*calloc)(uint32_t cnt, uint32_t size, uint32_t cap, const char *file, size_t line);
void (*free)(void *p, const char *file, size_t line);
uint32_t (*get_free_heap_size)(void);
void (*srand)(uint32_t seed);

View File

@ -126,19 +126,19 @@ extern wifi_osi_funcs_t s_wifi_osi_funcs;
s_wifi_osi_funcs.timer_delete(t, tk)
#define wifi_malloc(s, c) \
s_wifi_osi_funcs.malloc(s, c)
s_wifi_osi_funcs.malloc(s, c, __FILE__, __LINE__)
#define wifi_zalloc(s, c) \
s_wifi_osi_funcs.zalloc(s, c)
s_wifi_osi_funcs.zalloc(s, c, __FILE__, __LINE__)
#define wifi_calloc(cnt, s, c) \
s_wifi_osi_funcs.calloc(cnt, s, c)
s_wifi_osi_funcs.calloc(cnt, s, c, __FILE__, __LINE__)
#define wifi_realloc(ptr, s, c) \
s_wifi_osi_funcs.realloc(ptr, s, c)
s_wifi_osi_funcs.realloc(ptr, s, c, __FILE__, __LINE__)
#define wifi_free(p) \
s_wifi_osi_funcs.free(p)
s_wifi_osi_funcs.free(p, __FILE__, __LINE__)
#define wifi_get_free_heap_size() \
s_wifi_osi_funcs.get_free_heap_size()

View File

@ -1,9 +1,9 @@
gwen:
core: b55a74f
net80211: b55a74f
pp: b55a74f
smartconfig:103fbb8
wpa: 103fbb8
espnow: 103fbb8
wps: 103fbb8
core: 01980e2
net80211: 01980e2
pp: 01980e2
smartconfig:01980e2
wpa: 01980e2
espnow: 01980e2
wps: 01980e2
phy: 1055_8

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -272,63 +272,57 @@ static bool timer_delete_wrapper(void *timer, uint32_t ticks)
return xTimerDelete(timer, ticks);
}
static void *malloc_wrapper(uint32_t s, uint32_t cap)
static void *malloc_wrapper(uint32_t s, uint32_t cap, const char *file, size_t line)
{
uint32_t os_caps;
void *return_addr = (void *)__builtin_return_address(0);
if (cap & (OSI_MALLOC_CAP_8BIT | OSI_MALLOC_CAP_DMA))
os_caps = MALLOC_CAP_8BIT | MALLOC_CAP_DMA;
else
os_caps = MALLOC_CAP_32BIT;
return _heap_caps_malloc(s, os_caps, return_addr, 0);
return _heap_caps_malloc(s, os_caps, file, line);
}
static void *zalloc_wrapper(uint32_t s, uint32_t cap)
static void *zalloc_wrapper(uint32_t s, uint32_t cap, const char *file, size_t line)
{
uint32_t os_caps;
void *return_addr = (void *)__builtin_return_address(0);
if (cap & (OSI_MALLOC_CAP_8BIT | OSI_MALLOC_CAP_DMA))
os_caps = MALLOC_CAP_8BIT | MALLOC_CAP_DMA;
else
os_caps = MALLOC_CAP_32BIT;
return _heap_caps_zalloc(s, os_caps, return_addr, 0);
return _heap_caps_zalloc(s, os_caps, file, line);
}
static void *realloc_wrapper(void *ptr, uint32_t s, uint32_t cap)
static void *realloc_wrapper(void *ptr, uint32_t s, uint32_t cap, const char *file, size_t line)
{
uint32_t os_caps;
void *return_addr = (void *)__builtin_return_address(0);
if (cap & (OSI_MALLOC_CAP_8BIT | OSI_MALLOC_CAP_DMA))
os_caps = MALLOC_CAP_8BIT | MALLOC_CAP_DMA;
else
os_caps = MALLOC_CAP_32BIT;
return _heap_caps_realloc(ptr, s, os_caps, return_addr, 0);
return _heap_caps_realloc(ptr, s, os_caps, file, line);
}
static void *calloc_wrapper(uint32_t cnt, uint32_t s, uint32_t cap)
static void *calloc_wrapper(uint32_t cnt, uint32_t s, uint32_t cap, const char *file, size_t line)
{
uint32_t os_caps;
void *return_addr = (void *)__builtin_return_address(0);
if (cap & (OSI_MALLOC_CAP_8BIT | OSI_MALLOC_CAP_DMA))
os_caps = MALLOC_CAP_8BIT | MALLOC_CAP_DMA;
else
os_caps = MALLOC_CAP_32BIT;
return _heap_caps_calloc(cnt , s, os_caps, return_addr, 0);
return _heap_caps_calloc(cnt , s, os_caps, file, line);
}
static void free_wrapper(void *ptr)
static void free_wrapper(void *ptr, const char *file, size_t line)
{
void *return_addr = (void *)__builtin_return_address(0);
_heap_caps_free(ptr, return_addr, 0);
_heap_caps_free(ptr, file, line);
}
static void srand_wrapper(uint32_t seed)