官方的例程
/* Test if user code is programmed starting from address "ApplicationAddress" */ if (((*(vu32*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000) { /* Jump to user application */ JumpAddress = *(vu32*) (ApplicationAddress + 4); Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __MSR_MSP(*(vu32*) ApplicationAddress); Jump_To_Application(); } 这个代码是错误的,容易导致堆栈溢出死掉。跳到应用区,堆栈指针就不对了。 现在用汇编实现。 |