Hi,
I am working on a project using the STM32L082. And during the code execution I would like to monitor the available RAM memory.
Does anybody know if there is a standard function available to monitor the available memory (RAM)?
Thans a lot
STM32L0 - how to check available RAM memory
Re: STM32L0 - how to check available RAM memory
Unique ID, if the chip supports it.
Re: STM32L0 - how to check available RAM memory
I once found same thing in SdFat library, called "FreeStack.h"
From that, simple sketch should work (at least at STM32F1/4):
Maybe not 100% accurate, but it was enough for my case.
From that, simple sketch should work (at least at STM32F1/4):
Code: Select all
// from SDfat library
extern "C" char* sbrk(int incr);
// free RAM (actually, free stack
inline uint32_t FreeBytes() {
char top = 't';
return &top - reinterpret_cast<char*>(sbrk(0));
}
void setup() {
Serial.begin(115200);
delay(2000);
}
void loop() {
Serial.println(FreeBytes());
delay(1000);
}