Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

painted stack measure do not work #2

Open
pat1 opened this issue Apr 8, 2021 · 0 comments
Open

painted stack measure do not work #2

pat1 opened this issue Apr 8, 2021 · 0 comments

Comments

@pat1
Copy link

pat1 commented Apr 8, 2021

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant