Skip to content

Instantly share code, notes, and snippets.

@ahmedwahdan
Created November 6, 2020 13:42
Show Gist options
  • Save ahmedwahdan/ff878e1f019f8d56a2f4310c7f9b102a to your computer and use it in GitHub Desktop.
Save ahmedwahdan/ff878e1f019f8d56a2f4310c7f9b102a to your computer and use it in GitHub Desktop.
noinit RAM GCC example
uint32_t reset_cnt __attribute__ ((section (".noinit")));
uint32_t first_run __attribute__ ((section (".noinit")));
void main(void)
{
if(first_run != 0xDEADBEEFUL)
{
reset_cnt = 0;
first_run = 0xDEADBEEFUL;
}
else
{
reset_cnt ++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment