mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 03:18:09 +00:00
Bugfix: Unlock flash when copying sector header.
This commit is contained in:
parent
840f7461ee
commit
2888c11095
2
norcow.c
2
norcow.c
@ -118,9 +118,11 @@ static void erase_sector(uint8_t sector, secbool set_magic)
|
|||||||
|
|
||||||
#if NORCOW_HEADER_LEN > 0
|
#if NORCOW_HEADER_LEN > 0
|
||||||
// Copy the sector header back.
|
// Copy the sector header back.
|
||||||
|
ensure(flash_unlock_write(), NULL);
|
||||||
for (uint32_t i = 0; i < NORCOW_HEADER_LEN/sizeof(uint32_t); ++i) {
|
for (uint32_t i = 0; i < NORCOW_HEADER_LEN/sizeof(uint32_t); ++i) {
|
||||||
ensure(flash_write_word(norcow_sectors[sector], i*sizeof(uint32_t), header_backup[i]), NULL);
|
ensure(flash_write_word(norcow_sectors[sector], i*sizeof(uint32_t), header_backup[i]), NULL);
|
||||||
}
|
}
|
||||||
|
ensure(flash_lock_write(), NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sectrue == set_magic) {
|
if (sectrue == set_magic) {
|
||||||
|
Loading…
Reference in New Issue
Block a user