修复Flash操作返回失败,及log_end_add返回块首址造成无法写log。

pull/42/head
LAPTOP-ORSGE5M9\lyy 7 years ago
parent 0504880003
commit 7b08609404

@ -143,6 +143,8 @@ EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size) {
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
for (i = 0; i < size; i += 4, buf++, addr += 4) { for (i = 0; i < size; i += 4, buf++, addr += 4) {
/* write data */ /* write data */
read_data = *(uint32_t *)addr;
if (read_data != *buf) {
FLASH_ProgramWord(addr, *buf); FLASH_ProgramWord(addr, *buf);
read_data = *(uint32_t *)addr; read_data = *(uint32_t *)addr;
/* check data */ /* check data */
@ -151,6 +153,7 @@ EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size) {
break; break;
} }
} }
}
FLASH_Lock(); FLASH_Lock();
return result; return result;

@ -239,7 +239,7 @@ static uint32_t find_sec_using_end_addr(uint32_t addr) {
return sector_start + EF_ERASE_MIN_SIZE - continue_ff; return sector_start + EF_ERASE_MIN_SIZE - continue_ff;
} else { } else {
/* all sector not has continuous 0xFF, so the sector is full */ /* all sector not has continuous 0xFF, so the sector is full */
return sector_start + EF_ERASE_MIN_SIZE; return sector_start + EF_ERASE_MIN_SIZE+LOG_SECTOR_HEADER_SIZE;
} }
} }

Loading…
Cancel
Save