-
bootload中断异常
下面是跳转程序voidIAP_Load_APP(uint32_tappxaddr){RCC->APB1RST=0xFFFFFFFF;RCC->APB2RST=0xFFFFFFFF;RCC->APB1RST=0x00000000;RCC->APB2RST=0x00000000;if(((*(uint32_t*)appxaddr)&0x2FFF8000)==0x20000000)//检查栈顶地址是否合法.{jump2app=(iapfun)*(vu32*)(appxaddr+4);//用户代码区第二个字为程序开始地址(复位地址)__set_MSP(*(vu32*)appxaddr);//初始化APP堆栈指针(用户代码区的第一个字用于存放栈顶地址)//MSR_MSP(*(vu32*)appxaddr);//SCB->VTOR=appxaddr;jump2app();//跳转到APP.}}下面是APP串口中断测试函数voidUSART1_IRQHandler(void){//AT32_LEDn_ON(LED2);intrupt_NUM++;if(USART_GetITStatus(USART1,USART_INT_RDNE)!=RESET){/*Readonebytefromthereceivedataregister*///RxBuffer1[1]=USART_ReceiveData(USART1);//需要读取数据清除空闲标志位,否则会循环中断USART_ClearFlag(USART1,USART_FLAG_RDNE);//AT32_LEDn_Toggle(LED2);RxBuffer1=USART_ReceiveData(USART1);USART_INT_RDNE_NUM++;if(USART_INT_RDNE_NUM>98)USART_INT_RDNE_NUM=98;}if(USART_GetITStatus(USART1,USART_INT_IDLEF)!=RESET){/*Readonebytefromthereceivedataregister*///RxBuffer1[2]=USART1->STS;RxBuffer1=USART_ReceiveData(USART1);//需要读取数据用于清除空闲标志位,否则会死机USART_INT_RDNE_NUM=0;USART_INT_IDLEF_NUM++;USART1_END=0;}//printf("%d%d%d",intrupt_NUM,USART_INT_RDNE_NUM,USART_INT_IDLEF_NUM);if(USART_GetITStatus(USART1,USART_INT_TRAC)!=RESET){USART_INT_TRAC_NUM++;}}intmain(void){AT32_Board_Init();MX_USART1_UART_Init();printf("TsetOTAAPP!!!!\n\r");externuint8_tUSART1_END,intrupt_NUM,USART_INT_RDNE_NUM,USART_INT_IDLEF_NUM,USART_INT_TRAC_NUM;externuint8_tRxBuffer1[100];while(1){if(USART1_END==0){printf("RxBuffer1:%s",RxBuffer1);USA
2021-08-07 0 -
flash 官方例程死机
使用官方falsh的例程死机,遇到的吗?
2021-08-01 0