本帖最后由 天涯行客 于 2014-12-4 12:37 编辑
程序所有配置都没有问题,就是不执行APP程序,不知道怎么回事啊
2014-12-04_105927.png (77.37 KB, 下载次数: 4)
下载附件
2014-12-4 11:00 上传
程序跳转代码
if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
{
SerialPutString("Execute user Program
");
JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
Jump_To_Application = (pFunction) JumpAddress;
__set_MSP(*(__IO uint32_t*) ApplicationAddress);
Jump_To_Application();
}
#define ApplicationAddress 0x8010000
我APP程序比较大 生成的BIN文件有60K左右,会是堆栈溢出的问题吗?
正解在5楼
我遇到过,能进用户程序,但所有跟中断有关系的外设全部失灵,后来在本坛无意中发现有人在跳用户程序之前关所有中断,进到用户程序后,在中断向量表地址设定完成后再开中断。OK 了。
- __set_PRIMASK(1);
- if(((*(__IO uint32_t *) ApplicationAddress) & 0x2FFE0000) == 0x20000000)
- {
- __ASM("CPSID I");
- JumpAddress = *(__IO uint32_t *) (ApplicationAddress + 4);
- Jump_To_Application = (pFunction) JumpAddress;
-
- __set_MSP(*(__IO uint32_t *) ApplicationAddress);
- Jump_To_Application();
- }
- else
复制代码__ASM("CPSID I"); //注意这句
- NVIC_InitTypeDef NVIC_InitStructure;
- EXTI_InitTypeDef EXTI_InitStructure;
- #ifdef VECT_TAB_RAM
- /* Set the Vector Table base location at 0x20000000 */
- NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
- #else /* VECT_TAB_FLASH */
- /* Set the Vector Table base location at 0x08000000 */
- NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x9000);
- __ASM("CPSIE I");
- #endif
- // Configure one bit for preemption priority
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
- NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
- NVIC_Init(&NVIC_InitStructure);
复制代码一周热门 更多>