typedef struct
{
uint8_t ucUploadOK;
uint8_t ucUploadCmd;
uint8_t ucResetCnt;
uint8_t ucDevcID;
}st_bootinfo_t;
st_bootinfo_t stBootInfo;
//此处(uint32_t*)&stBootInfo进入函数后 赋值即进入HardFault_Handler 未查明原因
STMFLASH_Read(FLASHADDR_APPINFO,(uint32_t*)&stBootInfo,sizeof(st_bootinfo_t)/sizeof(uint32_t));
void STMFLASH_Read(uint32_t ReadAddr,uint32_t *pBuffer,uint32_t NumToRead)
{
uint32_t i;
for(i=0;i<NumToRead;i++)
{
//此处赋值进入HardFault_Handler
pBuffer[i]=STMFLASH_ReadWord(ReadAddr);
ReadAddr+=4;//偏移4个字节.
}
}
STM32F072上读取Flash数据,我将结构体强制转换作为实参带入读取函数,但是在赋值时进入HardFault_Handler。有没有遇到相同情况的?给解释解释呗。 |