sdk_system_print_meminfo: fix and correct heap end.

This commit is contained in:
Our Air Quality 2017-12-14 08:13:36 +11:00
parent 89c6c410ff
commit f0d2c34399

View file

@ -63,10 +63,10 @@ static void _deep_sleep_phase2(void *timer_arg);
static struct netif *_get_netif(uint32_t mode); static struct netif *_get_netif(uint32_t mode);
// Linker-created values used by sdk_system_print_meminfo // Linker-created values used by sdk_system_print_meminfo
extern uint32_t _data_start, _data_end; extern uint8_t _data_start[], _data_end[];
extern uint32_t _rodata_start, _rodata_end; extern uint8_t _rodata_start[], _rodata_end[];
extern uint32_t _bss_start, _bss_end; extern uint8_t _bss_start[], _bss_end[];
extern uint32_t _heap_start; extern uint8_t _heap_start[];
#define _rom_reset_vector ((void (*)(void))0x40000080) #define _rom_reset_vector ((void (*)(void))0x40000080)
@ -484,11 +484,14 @@ void sdk_system_station_got_ip_set(struct ip4_addr *ip, struct ip4_addr *mask, s
} }
} }
extern void *xPortSupervisorStackPointer;
void sdk_system_print_meminfo(void) { void sdk_system_print_meminfo(void) {
printf("%s: 0x%x ~ 0x%x, len: %d\n", "data ", _data_start, _data_end, _data_end - _data_start); uint8_t *heap_end = xPortSupervisorStackPointer;
printf("%s: 0x%x ~ 0x%x, len: %d\n", "rodata", _rodata_start, _rodata_end, _rodata_end - _rodata_start); printf("%s: %p ~ %p, len: %d\n", "data ", _data_start, _data_end, _data_end - _data_start);
printf("%s: 0x%x ~ 0x%x, len: %d\n", "bss ", _bss_start, _bss_end, _bss_end - _bss_start); printf("%s: %p ~ %p, len: %d\n", "rodata", _rodata_start, _rodata_end, _rodata_end - _rodata_start);
printf("%s: 0x%x ~ 0x%x, len: %d\n", "heap ", _heap_start, 0x3fffc000, 0x3fffc000 - _heap_start); printf("%s: %p ~ %p, len: %d\n", "bss ", _bss_start, _bss_end, _bss_end - _bss_start);
printf("%s: %p ~ %p, len: %d\n", "heap ", _heap_start, heap_end, heap_end - _heap_start);
} }
uint32_t sdk_system_get_free_heap_size(void) { uint32_t sdk_system_get_free_heap_size(void) {