Created
November 6, 2020 13:42
-
-
Save ahmedwahdan/ff878e1f019f8d56a2f4310c7f9b102a to your computer and use it in GitHub Desktop.
noinit RAM GCC example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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