1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

Fix compile problem, fix clearing single byte

This commit is contained in:
Jochen Hoenicke 2017-12-12 19:36:34 +01:00
parent f22c849767
commit 88563ebaa5

View File

@ -53,7 +53,8 @@ Storage CONFIDENTIAL storageUpdate;
_Static_assert(((uint32_t)&storageUpdate & 3) == 0, "storage unaligned");
_Static_assert((sizeof(storageUpdate) & 3) == 0, "storage unaligned");
const Storage *storageRom = (const Storage *)(FLASH_STORAGE_START + sizeof(storage_magic) + sizeof(storage_uuid));
#define STORAGE_ROM ((const Storage *)(FLASH_STORAGE_START + sizeof(storage_magic) + sizeof(storage_uuid)))
const Storage *storageRom = STORAGE_ROM;
char storage_uuid_str[25];
@ -187,9 +188,8 @@ bool storage_from_flash(void)
flash_erase_sector(FLASH_META_SECTOR_LAST, FLASH_CR_PROGRAM_X32);
flash_program_word(FLASH_STORAGE_PINAREA, 0xffffffff << pinctr);
// erase storageRom.has_pin_failed_attempts and storageRom.pin_failed_attempts
_Static_assert(((uint32_t)&storageRom->has_pin_failed_attempts & 3) == 0, "storage.has_pin_failed_attempts unaligned");
_Static_assert(((uint32_t)&storageRom->pin_failed_attempts & 3) == 0, "storage.pin_failed_attempts unaligned");
flash_program_word((uint32_t)&storageRom->has_pin_failed_attempts, 0);
_Static_assert(((uint32_t)&STORAGE_ROM->pin_failed_attempts & 3) == 0, "storage.pin_failed_attempts unaligned");
flash_program_byte((uint32_t)&storageRom->has_pin_failed_attempts, 0);
flash_program_word((uint32_t)&storageRom->pin_failed_attempts, 0);
flash_lock();
storage_check_flash_errors();