Hi all, i need a help to move my first pass into this world of programming. I use a Cortex-M0 and my question is: how can I access to register R0-R12.. in language C? it's possible? I would save a variable into one register. Thanks bye.
My intention was to save the specific variable into one register when the reset occurs, because now when reset occurs all variable return to value 0.
That's not how it is done. You should use an ordinary static variable. After reset, you read it before the startup code clears it, or you use compiler facilities to suppress initialization of this particular register. The CPU reset itself does not alter the contents of RAM (unless it is SDRAM and refresh process is suspended for too long).
Shrink IRAM1 from say 0x5000 to 0x4FFC in the Target dialog
*((unsigned long *)0x20004FFC) = 0x12345678; // .. RESET unsigned long bootval = *((unsigned long *)0x20004FFC);