1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-11-28 17:36:39 +03:00

Ensure xPortGetFreeHeapSize reports DRAM (#8680)

Create dedicated function for xPortGetFreeHeapSize() that only reports on DRAM.
NONOS SDK API system_get_free_heap_size() relies on xPortGetFreeHeapSize() for the free Heap size.

Possible breaking change for multiple Heap Sketches calling system_get_free_heap_size(); it will now always report free DRAM Heap size.

Update and export umm_free_heap_size_lw() to report the free Heap size of the current Heap.
Updated ESP.getFreeHeap() to use umm_free_heap_size_lw().

Updated build options to supply exported umm_free_heap_size_lw() via either UMM_STATS or UMM_INFO.

Improved build option support via the SketchName.ino.globals.h method for Heap options: UMM_INFO, UMM_INLINE_METRICS, UMM_STATS, UMM_STATS_FULL, UMM_BEST_FIT, and UMM_FIRST_FIT. While uncommon to change from the defaults, you can review umm_malloc_cfgport.h for more details, which may help reduce your Sketch's size in dire situations. Assuming you are willing to give up some functionality.
For debugging UMM_STATS_FULL can offer additional stats, like Heap low water mark (umm_free_heap_size_min()).
This commit is contained in:
M Hightower
2022-10-11 04:52:39 -07:00
committed by GitHub
parent 7b2c627ed4
commit d3eddeb501
14 changed files with 386 additions and 150 deletions

View File

@@ -33,6 +33,7 @@ extern "C" {
#include <string.h>
#include <math.h>
#include "umm_malloc/umm_malloc_cfgport.h"
#include "stdlib_noniso.h"
#include "binary.h"
#include "esp8266_peri.h"
@@ -311,7 +312,8 @@ void configTime(const char* tz, String server1,
#endif
#ifdef DEBUG_ESP_OOM
// reinclude *alloc redefinition because of <cstdlib> undefining them
// this is mandatory for allowing OOM *alloc definitions in .ino files
#include "umm_malloc/umm_malloc_cfg.h"
// Position *alloc redefinition at the end of Arduino.h because <cstdlib> would
// have undefined them. Mandatory for supporting OOM and other debug alloc
// definitions in .ino files
#include "heap_api_debug.h"
#endif