set initial DFU state to ERROR if application is corrupt

as specified in DFU standard

Change-Id: Icd503a2d19f829eb43a83c28b526b73d595640f0
This commit is contained in:
Kevin Redon 2019-02-14 18:59:32 +01:00
parent 45554d71f9
commit b842918d16
2 changed files with 3 additions and 1 deletions

View File

@ -306,7 +306,6 @@ int32_t dfudf_init(void)
usbdc_register_function(&_dfudf);
usbdc_register_handler(USBDC_HDL_REQ, &dfudf_req_h);
// TODO check if firmware is corrupted and set dfuERROR state if it is
return ERR_NONE;
}

View File

@ -101,6 +101,9 @@ int main(void)
if (!check_force_dfu() && check_application()) { // application is valid
start_application(); // start application
} else {
if (!check_application()) { // if the application is corrupted the start DFU start should be dfuERROR
dfu_state = USB_DFU_STATE_DFU_ERROR;
}
usb_dfu(); // start DFU bootloader
}
}