add HIMEM debugging tools (check free size, and memory test) (#1852)

* Update defines.h

* Update esp_sys.h

* Update esp_sys.cpp

* Add files via upload

* Update perfmon.c

* Update main.cpp

* Update main.cpp

* Delete himem_memory_check.c

* Add files via upload

* Update defines.h

* Update himem_memory_check.cpp

* Update main.cpp

* Update himem_memory_check.cpp

* Update himem_memory_check.h

* Update main.cpp
This commit is contained in:
Nicolas Liaudat
2023-01-15 22:42:11 +01:00
committed by GitHub
parent 284f7b1180
commit 5a8b39f246
7 changed files with 242 additions and 32 deletions

View File

@@ -9,13 +9,6 @@
#include "esp_chip_info.h"
// for esp_spiram_get_size
extern "C" {
#include <esp32/spiram.h>
#include <esp32/himem.h>
}
void Restart() {
esp_restart();
@@ -126,6 +119,8 @@ std::string get_device_info()
else
espInfoResultStr += " External Flash memory\n";
}
#ifdef USE_HIMEM_IF_AVAILABLE
sprintf(aMsgBuf,"spiram size %u\n", esp_spiram_get_size());
espInfoResultStr += std::string(aMsgBuf);
sprintf(aMsgBuf,"himem free %u\n", esp_himem_get_free_size());
@@ -133,6 +128,8 @@ std::string get_device_info()
sprintf(aMsgBuf,"himem phys %u\n", esp_himem_get_phys_size());
espInfoResultStr += std::string(aMsgBuf);
sprintf(aMsgBuf,"himem reserved %u\n", esp_himem_reserved_area_size());
espInfoResultStr += std::string(aMsgBuf);
#endif
return espInfoResultStr;
}
@@ -163,6 +160,19 @@ size_t getMinEverFreeMemInternal(){ //Min. Ever Free Size
size_t getMinEverFreeMemSPIRAM(){ //Min. Ever Free Size
return heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM);
}
//#endif // ESP_IDF_VERSION
#endif //DEBUG_ENABLE_SYSINFO
#ifdef USE_HIMEM_IF_AVAILABLE
size_t getHimemTotSpace(){
return esp_himem_get_phys_size();
}
size_t getHimemFreeSpace(){
return esp_himem_get_free_size();
}
size_t getHimemReservedArea(){
return esp_himem_reserved_area_size();
}
#endif
#endif //DEBUG_ENABLE_SYSINFO