set initial DFU state to ERROR if application is corrupt

as specified in DFU standard

Change-Id: Icd503a2d19f829eb43a83c28b526b73d595640f0
master
Kevin Redon 4 years ago
parent 45554d71f9
commit b842918d16
  1. 1
      usb/class/dfu/device/dfudf.c
  2. 3
      usb_dfu_main.c

@ -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;
}

@ -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
}
}

Loading…
Cancel
Save