MemoryUsage
MemoryUsage copied to clipboard
painted stack measure do not work
The routine mu_StackPaint is not executed in section .init1 I use platformio and board = 1284p16m better results with this approach: https://www.avrfreaks.net/comment/1314296#comment-1314296 with little modification to take in account heap:
extern uint8_t _end;
void simpleStackPaint(void)
{
uint8_t *p = &_end;
while(p < (uint8_t*)&p)
{
*p = 0xc5;
p++;
}
}
uint16_t simpleStackCount(void)
{
const uint8_t *p = (int) (__brkval == 0 ? (uint8_t *) &__heap_start : __brkval);
//const uint8_t *p = &_end;
uint16_t c = 0;
while(*p == 0xc5 && p < (uint8_t*)&p)
{
p++;
c++;
}
return c;
}