[riot-notifications] [RIOT-OS/RIOT] usbus/dfu: add Device Firmware Upgrade support for USBUS (2nd attempt) (#15460)

Koen Zandberg notifications at github.com
Wed Nov 18 09:47:29 CET 2020


@bergzand commented on this pull request.

Some initial comments because of the flashpage rename.

> +
+/* Descriptors */
+static const usbus_descr_gen_funcs_t _dfu_descriptor = {
+    .fmt_post_descriptor = _gen_dfu_descriptor,
+    .fmt_pre_descriptor = NULL,
+    .len = {
+        .fixed_len =  sizeof(usb_desc_if_dfu_t),
+    },
+    .len_type = USBUS_DESCR_LEN_FIXED,
+};
+
+static void _flashpage(void) {
+    /* reset offset value for next transfer */
+    offset = 0;
+    /* Erase page content */
+    flashpage_write(page_cpt, NULL);

```suggestion
    flashpage_erase(page_cpt);
```

> +static const usbus_descr_gen_funcs_t _dfu_descriptor = {
+    .fmt_post_descriptor = _gen_dfu_descriptor,
+    .fmt_pre_descriptor = NULL,
+    .len = {
+        .fixed_len =  sizeof(usb_desc_if_dfu_t),
+    },
+    .len_type = USBUS_DESCR_LEN_FIXED,
+};
+
+static void _flashpage(void) {
+    /* reset offset value for next transfer */
+    offset = 0;
+    /* Erase page content */
+    flashpage_write(page_cpt, NULL);
+    /* Write buffer into flash */
+    int ret = flashpage_write_and_verify(page_cpt, page_mem);

If you use the newly renamed `flashpage_write()` here you don't have to buffer a full page. But we can leave that for a follow up if you prefer.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15460#pullrequestreview-533216233
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201118/89b197d8/attachment-0001.htm>


More information about the notifications mailing list