大家好!请问有没有知道怎么擦除F28M35x部分flash空间,例程给的都是擦除整个flash空间。假如我想擦除0x204000到0x205000,改怎么写擦除语句?谢谢!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
大家好!请问有没有知道怎么擦除F28M35x部分flash空间,例程给的都是擦除整个flash空间。假如我想擦除0x204000到0x205000,改怎么写擦除语句?谢谢!
F28M35的FLASH通常以sector为单位进行擦除,也可以以bank为单位,别无其他。我这里给你一点简单的示例代码,你结合例程进行修改。如果你想只擦除一个sector中的部分空间是不可以实现的。
以M3为例。总体思路就是
for (i = 0; i < SECTOR_NUM; i++) {
if (flash_sector_flag & (1 << i)) {
oReturnCheck = Fapi_issueAsyncCommandWithAddress (Fapi_EraseSector, (Uint32 *)flash_sector_table_m3 [i].sector_start_addr);
while (Fapi_checkFsmForReady () != Fapi_Status_FsmReady) {}
oReturnCheck = Fapi_doBlankCheck ((Uint32 *)flash_sector_table_m3 [i].sector_start_addr,
flash_sector_table_m3 [i].sector_size_8 >> 2 /* len in u32 */, &oFlashStatusWord);
if (oReturnCheck != Fapi_Status_Success) {
ret = -1;
break;
}
}
}
希望对你有帮助。