Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patches to improve resistance to fault injection #504

Merged
merged 1 commit into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions targets/stm32l432/src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ void device_init()

hw_init(LOW_FREQUENCY);

#if BOOT_TO_DFU
flash_option_bytes_init(1);
#else
flash_option_bytes_init(0);
#endif

if (! tsc_sensor_exists())
{
_NFC_status = nfc_init();
Expand All @@ -329,12 +335,6 @@ void device_init()

device_migrate();

#if BOOT_TO_DFU
flash_option_bytes_init(1);
#else
flash_option_bytes_init(0);
#endif


}

Expand Down
6 changes: 5 additions & 1 deletion targets/stm32l432/src/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ void flash_option_bytes_init(int boot_from_dfu)

flash_lock();

__enable_irq();

/* Perform option byte loading which triggers a device reset. */
FLASH->CR |= FLASH_CR_OBL_LAUNCH;

while (true);
}

void flash_erase_page(uint8_t page)
Expand Down