u16 TMP_UP;
int main(void)
{
TMP_UP=0;
TMP_UP=OPT_ReadUserData();
// DFU_Button_Config();
/* Check if the Key push-button on STM3210x-EVAL Board is pressed */
//if (DFU_Button_Read() != 0x00)
//{
if (TMP_UP & 0x0004) //如果标志位为1
{
/* Test if user code is programmed starting from address 0x8003000 */
if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
{ /* Jump to user application */
JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) ApplicationAddress);
Jump_To_Application();
}
} /* Otherwise enters DFU mode to allow user to program his application */
//}
/* Enter DFU mode */
DeviceState = STATE_dfuERROR;
DeviceStatus[0] = STATUS_ERRFIRMWARE;
DeviceStatus[4] = DeviceState;
Set_System();
Set_USBClock();
USB_Init();
/* Main loop */
while (1)
{
}
}
以上代码在最前面读到用户字节总是出错是什么原因了。请大神指点呀 |