Allow DFU if OTP block is not locked yet (#405)
* Allow DFU if OTP block is not locked yet * Fixed misra * Fixed logicmaster
parent
ce13938ab3
commit
1c6093559d
|
@ -11,3 +11,9 @@ void get_provision_chunk(uint8_t *resp) {
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t chunk[PROVISION_CHUNK_LEN];
|
||||
bool is_provisioned(void) {
|
||||
(void)memcpy(chunk, (uint8_t *)0x1fff79e0, PROVISION_CHUNK_LEN);
|
||||
return (memcmp(chunk, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", 0x20) != 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
|
|||
#ifdef ALLOW_DEBUG
|
||||
if (hardwired) {
|
||||
#else
|
||||
// no more bootstub on UNO
|
||||
if (hardwired && hw_type != HW_TYPE_UNO) {
|
||||
// no more bootstub on UNO once OTP block is flashed
|
||||
if (hardwired && ((hw_type != HW_TYPE_UNO) || (!is_provisioned()))) {
|
||||
#endif
|
||||
puts("-> entering bootloader\n");
|
||||
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
|
||||
|
|
Loading…
Reference in New Issue