kopia lustrzana https://github.com/solokeys/solo1
rodzic
e91dff3713
commit
a87e1c6d15
|
@ -304,12 +304,6 @@ 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();
|
||||
|
@ -329,13 +323,18 @@ void device_init()
|
|||
device_init_button();
|
||||
}
|
||||
|
||||
device_migrate();
|
||||
|
||||
#if BOOT_TO_DFU
|
||||
flash_option_bytes_init(1);
|
||||
#else
|
||||
flash_option_bytes_init(0);
|
||||
#endif
|
||||
|
||||
usbhid_init();
|
||||
ctaphid_init();
|
||||
ctap_init();
|
||||
|
||||
device_migrate();
|
||||
|
||||
|
||||
}
|
||||
|
||||
int device_is_nfc(void)
|
||||
|
|
|
@ -47,7 +47,7 @@ void flash_option_bytes_init(int boot_from_dfu)
|
|||
val &= ~(1<<25); // SRAM2_RST = 1 (erase sram on reset)
|
||||
val &= ~(1<<24); // SRAM2_PE = 1 (parity check en)
|
||||
|
||||
if (FLASH->OPTR == val)
|
||||
if ((FLASH->OPTR & 0xb3f77ff) == (val & 0xb3f77ff))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -68,13 +68,17 @@ void flash_option_bytes_init(int boot_from_dfu)
|
|||
while (FLASH->SR & (1<<16))
|
||||
;
|
||||
|
||||
flash_lock();
|
||||
|
||||
if (FLASH->CR & (1<<30))
|
||||
{
|
||||
FLASH->OPTKEYR = 0x08192A3B;
|
||||
FLASH->OPTKEYR = 0x4C5D6E7F;
|
||||
}
|
||||
|
||||
/* Perform option byte loading which triggers a device reset. */
|
||||
FLASH->CR |= FLASH_CR_OBL_LAUNCH;
|
||||
|
||||
while (true);
|
||||
while (true)
|
||||
;
|
||||
}
|
||||
|
||||
void flash_erase_page(uint8_t page)
|
||||
|
|
Ładowanie…
Reference in New Issue