aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2019-02-14 18:59:32 +0100
committerKévin Redon <kredon@sysmocom.de>2019-02-14 18:59:39 +0100
commitb842918d16977394b5ee822006adbf517ca4d0e7 (patch)
tree72d73c075038ddb7460bfffa210097741e7ce84d
parent45554d71f974c5382dd9f5cec104d28a35c5b1b5 (diff)
set initial DFU state to ERROR if application is corrupt
as specified in DFU standard Change-Id: Icd503a2d19f829eb43a83c28b526b73d595640f0
-rw-r--r--usb/class/dfu/device/dfudf.c1
-rw-r--r--usb_dfu_main.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c
index 8232979..223999a 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.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;
}
diff --git a/usb_dfu_main.c b/usb_dfu_main.c
index 81b02f8..7fd54d3 100644
--- a/usb_dfu_main.c
+++ b/usb_dfu_main.c
@@ -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
}
}