Hi does anyone know any way to profile ESP32 and ESP8266 programs?
In my work I need to know how much memory is missing for the execution of a specific function and a profiler seems to be the best choice.
Hi does anyone know any way to profile ESP32 and ESP8266 programs?
In my work I need to know how much memory is missing for the execution of a specific function and a profiler seems to be the best choice.
To profile static stack memory usage of a function: Activate build_flags = -fstack-usage
(if the compiler version is high enough ) to get .su
files that have the stack memory usage of each function in them. (source, source, source).
To profile dynamic memory usage of a function (malloc()
, free()
): Depends on the exact memory allocation system used. Both ESP8266 and ESP32 core have ways to get heap usage statistics, via e.g. ESP.getFreeHeap()
, which you can call during various points of the function.
To profile the static memory usage of the entire firmware, in FLASH and RAM: PIO Home → Inspect.