does gcc11 know something? (#4738)
* does gcc11 know something? * fix BACKUP_FLASH_ADDR assertion semantic (#4750) * fix BACKUP_FLASH_ADDR assertion semantic * cast BACKUP_FLASH_ADDR as flashaddr_t Co-authored-by: rusefillc <sdfsdfqsf2334234234> Co-authored-by: Nathan Schulte <8540239+nmschulte@users.noreply.github.com>
This commit is contained in:
parent
e801ffc979
commit
7f7d00fa3e
|
@ -22,6 +22,7 @@ const size_t backupSize = (BACKUP_RAM_NUM + 1) * sizeof(uint32_t);
|
||||||
|
|
||||||
static void backupInit() {
|
static void backupInit() {
|
||||||
static_assert(backupSize <= BACKUP_FLASH_SIZE, "Backup flash overflow");
|
static_assert(backupSize <= BACKUP_FLASH_SIZE, "Backup flash overflow");
|
||||||
|
static_assert(BACKUP_FLASH_ADDR != (flashaddr_t)nullptr, "Backup address undefined");
|
||||||
|
|
||||||
// first, load the whole buffer into the memory
|
// first, load the whole buffer into the memory
|
||||||
intFlashRead((flashaddr_t)BACKUP_FLASH_ADDR, (char *)backupRam, backupSize);
|
intFlashRead((flashaddr_t)BACKUP_FLASH_ADDR, (char *)backupRam, backupSize);
|
||||||
|
@ -34,7 +35,7 @@ static void backupInit() {
|
||||||
// we cannot trust the saved data anymore, until it's saved in backupRamFlush()
|
// we cannot trust the saved data anymore, until it's saved in backupRamFlush()
|
||||||
// so we mark is as 'pending'
|
// so we mark is as 'pending'
|
||||||
backupRam[backupStateOffset] = BACKUP_PENDING;
|
backupRam[backupStateOffset] = BACKUP_PENDING;
|
||||||
intFlashWrite(BACKUP_FLASH_ADDR + backupStateOffset, (char *)backupRam, sizeof(backupRam[backupStateOffset]));
|
intFlashWrite((flashaddr_t)BACKUP_FLASH_ADDR + backupStateOffset, (char *)backupRam, sizeof(backupRam[backupStateOffset]));
|
||||||
|
|
||||||
wasLoaded = true;
|
wasLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue