看代码ee_init中几乎每次都会有erase page。比如以下代码,不去检查page0是否真的erased,而是无脑地再次erase。这是在init里,多耗点运行时间对性能又没影响。
或者我理解有错?已经erase的page再次erase不会影响寿命?
/* Check for invalid header states and repair if necessary */
switch (PageStatus0)
{
case ERASED:
if (PageStatus1 == VALID_PAGE) /* Page0 erased, Page1 valid */
{
/* Erase Page0 */
FlashStatus = FLASH_ErasePage(PAGE0_BASE_ADDRESS);
/* If erase operation was failed, a Flash error code is returned */
if (FlashStatus != FLASH_COMPLETE)
{
return FlashStatus;
}
} |