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

Koen Zandberg notifications at github.com
Tue Jan 12 10:35:58 CET 2021


@bergzand requested changes on this pull request.



> +#ifndef RIOTBOOT_USB_DFU_H
+#define RIOTBOOT_USB_DFU_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @name USB DFU RAM information for riotboot
+ * @{
+ */
+#ifndef RIOTBOOT_DFU_ADDR
+#define RIOTBOOT_DFU_ADDR      (CPU_RAM_BASE + CPU_RAM_SIZE - 4)   /**< DFU default magic address */
+#endif
+#ifndef RIOTBOOT_MAGIC_NUMBER
+#define RIOTBOOT_MAGIC_NUMBER  (0xDEADBEEFUL)                      /**< DFU default magic value */

Why not reuse the existing value from `sys/include/riotboot/hdr.h` and keep the slots compatible across bootloader versions

> +#include "usb/usbus.h"
+#include "usb/usbus/control.h"

```suggestion

```

> +/**
+ * @brief USBUS DFU internal state
+ */
+typedef enum {
+    USBUS_DFU_STATE_APP_IDLE,               /**< DFU application idle */
+    USBUS_DFU_STATE_APP_DETACH,             /**< DFU application detach (reboot to DFU mode) */
+    USBUS_DFU_STATE_DFU_IDLE,               /**< DFU runtime mode idle */
+    USBUS_DFU_STATE_DFU_DL_SYNC,            /**< DFU download synchronization */
+    USBUS_DFU_STATE_DFU_DL_BUSY,            /**< DFU download busy */
+    USBUS_DFU_STATE_DFU_DL_IDLE,            /**< DFU download idle */
+    USBUS_DFU_STATE_DFU_MANIFEST_SYNC,      /**< DFU manifest synchronization */
+    USBUS_DFU_STATE_DFU_MANIFEST,           /**< DFU manifest mode */
+    USBUS_DFU_STATE_DFU_MANIFEST_WAIT_RST,  /**< DFU manifest wait for CPU reset */
+    USBUS_DFU_STATE_DFU_UP_IDLE,            /**< DFU upload idle */
+    USBUS_DFU_STATE_DFU_ERROR               /**< DFU internal error */
+} usbus_dfu_state_t;

This should be moved to `sys/include/usb/usbus/dfu.h` if this is USBUS-specific.

-- 
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-566084991
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210112/e820be00/attachment.htm>


More information about the notifications mailing list