|
程序在spi flash中 ,地址为0x90000000
现在可以正常的挂载和读u盘的文件。可是跑完usb otg的回调后,全速跑时候 就跑hardfault。
查看了lr寄存器 :0xfffffffd
查看PSP:0x24002020
查看内存内容 为 0.
可以正常跑完下边内容。但是跑出去后就错误了。
单步跑下边内容。会提示
Break at address "0x0" with no debug information available, or outside of program code.
此时 lr 值:0x9001b1cb
然后单边一下进入hardfault。
case HOST_USER_CLASS_ACTIVE:
Appli_state = APPLICATION_READY;
res = f_mount(&fs_usb ,"0:",1);
ret = exf_getfree("0:",&total,&free);
if(ret == 0)
{
MyPrintf("[#system]usb size: %dM .usb column size:%dcol\r\n",total>>10,free>>10);
}
if(res == FR_OK)
{
MyPrintf("[#system]usb is connected.start updating .......\r\n");
MyPrintf("[#system]Update app source time %d !!!\r\n" , HAL_GetTick());
ret = f_open(&usbfile,"0:/test.txt",FA_READ|FA_OPEN_EXISTING);
if(ret ==FR_OK )
{
MyPrintf("[#system]Usb File opened\r\n");
}
uint8_t buf[10] = {0} , buf2[10] ={0};
f_read(&usbfile,buf,10,&rw);
f_lseek(&usbfile,0x01);
f_read(&usbfile,buf2,2,&rw);
printf("[#system]Uf_read buffer = %s\r\n",buf);
f_close(&usbfile);
//update_source_m();
LED_OFF;
MyPrintf("[#system]Update app source end time %d !!!\r\n" , HAL_GetTick());
}
break;
|
|