[riot-notifications] [RIOT-OS/RIOT] riotboot: add riotboot_flashwrite module (#11181)

Koen Zandberg notifications at github.com
Thu Mar 14 22:54:33 CET 2019


bergzand requested changes on this pull request.

Initial review, more to follow

> +} riotboot_flashwrite_t;
+
+/**
+ * @brief Amount of bytes to skip at initial write of first page
+ */
+#define RIOTBOOT_FLASHWRITE_SKIPLEN 4
+
+/**
+ * @brief   Initialize firmware update (raw version)
+ *
+ * Allows setting the initial offset to @p offset, which would mean that the
+ * first bytes passed in via @ref riotboot_flashwrite_putbytes() will be
+ * written to (slot_start + offset).
+ *
+ * @note offset *should* be <= FLASHPAGE_SIZE, otherwise the results are
+ *       undefined.

Why not add an assert for this?

> +#include "periph/flashpage.h"
+
+/**
+ * @brief   firmware update state structure
+ */
+typedef struct {
+    int target_slot;                        /**< update targets this slot     */
+    size_t offset;                          /**< update is at this position   */
+    unsigned flashpage;                     /**< update is at this flashpage  */
+    uint8_t flashpage_buf[FLASHPAGE_SIZE];  /**< flash writing buffer         */
+} riotboot_flashwrite_t;
+
+/**
+ * @brief Amount of bytes to skip at initial write of first page
+ */
+#define RIOTBOOT_FLASHWRITE_SKIPLEN 4

Maybe use `sizeof(RIOTBOOT_MAGIC)` here, that would provide a direct reference to why it is this exact value.

-- 
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/11181#pullrequestreview-214569531
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190314/b5f26763/attachment.html>


More information about the notifications mailing list