The Cleanest Reset for ARM Processor

Posted by waffleman on Stack Overflow See other posts from Stack Overflow or by waffleman
Published on 2010-05-14T10:23:25Z Indexed on 2010/05/14 10:24 UTC
Read the original article Hit count: 292

Filed under:
|
|
|
|

Lately, I've been cleaning up some some C code that runs on an ARM7 controller. In some situations (upgrade, fatal error, etc...) the program will perform a reset. Presently it just jumps to 0 and assumes that the start-up code will reinitialize everything correctly. It got me to thinking about what would be the best procedure a la "Leave No Trace" for an ARM reset. Here is my first crack at it:

void Reset(void) { /* Disable interrupts */ __disable_interrupts();

/* Reset peripherals, externals and processor */
AT91C_BASE_RSTC->RSTC_RCR = AT91C_RSTC_KEY | AT91C_RSTC_PERRST | AT91C_RSTC_EXTRST| AT91C_RSTC_PROCRST;

while(AT91C_BASE_RSTC->RSTC_RSR & AT91C_RSTC_SRCMP);

/* Jump to the reset vector */
(*(void(*)())0)();
}

Anything I haven't considered?

© Stack Overflow or respective owner

Related posts about arm

Related posts about processor