本帖最后由 fx427103 于 2017-12-11 16:19 编辑
// ±¾³ÌÐòÔÚldromÖÐÖ´ÐÐ
// ³ÌÐòÉÕдʱºòÉèÖÃÁËconfigÖ§³ÖIAp¹¦ÄÜ£¬´ÓldromÆô¶¯
#if 0 // Ìøתµ½apromµÄ0x8000λÖà £¬²âÊÔok
SYS_UnlockReg();
FMC_Open();
SYS->IPRSTC2=0xFFFFFFFF; //¸´Î»ËùÓÐÍâÉè
SYS->IPRSTC2=0x0;
NVIC->ICER[0] = 0xFFFFFFFF; //¹Ø±ÕÖжÏ
CLK->APBCLK |= CLK_AHBCLK_ISP_EN_Msk;
FMC_SetVectorPageAddr(0x8000);//FMC_APROM_BASE
__ISB();
_sp = *(volatile uint32_t *) 0x8000;
spChange(_sp); //ÉèÖöÑÕ»
func = (FUNC_PTR *)(*(uint32_t *)(0x8000 + 4)); //º¯ÊýÖ¸ÕëÖ¸ÏòµÚ¶þÌ×´úÂëµÄ¸´Î»ÏòÁ¿
func(); //Ìøµ½µÚ¶þÌ×´úÂëÖ´ÐÐ
while(1);
#else // ͨ¹ý¸´Î»£¬ÖØдÓapromµÄ0x8000Æô¶¯ £¬ ²âÊÔ error
SYS_UnlockReg();
FMC_Open();
/* Mask all interrupt before changing VECMAP to avoid wrong interrupt handler fetched */
__set_PRIMASK(1);
/* Change VECMAP for booting to APROM */
FMC_SetVectorPageAddr(0x8000);//FMC_APROM_BASE
FMC->ISPCON &=(~BIT1);
/* Lock protected Register */
SYS_LockReg();
/* Software reset to boot to APROM */
NVIC_SystemReset();
while(1);
#endif
程序中的第二种方法,哪里有错误,为啥实现不了复位后开始执行Aprom的0x8000位置 |