不知道是哪位大侠指点的,使用非法指令复位,有些芯片有支持,你可以试一试
#include /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
void MCU_init(void); /* Device initialization function declaration */
volatile const char IllegaInstrct = 0x8D;
void main(void) {
/* Uncomment this function call after using Device Initialization
to use the generated code */
/* MCU_init(); */
EnableInterrupts; /* enable interrupts */
/* include your code here */
for(;;) {
__RESET_WATCHDOG(); /* feeds the dog */
asm
{
LDHX IllegaInstrct
JMP ,X
}
} /* loop forever */
/* please make sure that you never leave this function */
} |