GD32F103C8T6的芯片,低16K为Boot,剩余为APP
不开启读保护,更新正常,Boot和APP可以相互更新
开启读保护后,通过Boot更新APP正常,用APP更新Boot时擦除0x08000000时失败
相关代码
// 循环擦除
fmc_unlock();
while (pErase->wEarseSize)
{
uint8_t bStatus = fmc_page_erase(pErase->dwAddress);
// 出错,返回错误码与地址
if (bStatus != FMC_READY)
{
pCmdSend->bStatus = bStatus | 0x80;
pEraseRet->dwAddress = pErase->dwAddress;
break;
}
pErase->dwAddress += PageSize;
pErase->wEarseSize -= PageSize;
}
fmc_lock();
fmc_page_erase返回值为3=FMC_WPERR
检查选项字是没有启用页保护的
0x1FFFF800开始的数据为00 FF FF 00 FF 00 FF 00 FF 00 FF 00 FF 00 FF 00
哪位大神帮忙解决一下,多谢 |