engdavidiogo commented on code in PR #13951:
URL: https://github.com/apache/nuttx/pull/13951#discussion_r1795405578
##########
boards/risc-v/esp32c6/common/src/esp_board_spiflash.c:
##########
@@ -58,18 +58,102 @@
* Private Types
****************************************************************************/
+struct ota_partition_s
+{
+ uint32_t offset; /* Partition offset from the beginning of MTD */
+ uint32_t size; /* Partition size in bytes */
+ const char *devpath; /* Partition device path */
+};
+
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
+#ifdef CONFIG_ESPRESSIF_HAVE_OTA_PARTITION
+static int init_ota_partitions(void);
+#endif
+
/****************************************************************************
* Private Data
****************************************************************************/
+#ifdef CONFIG_ESPRESSIF_HAVE_OTA_PARTITION
+static const struct ota_partition_s g_ota_partition_table[] =
+{
+ {
+ .offset = CONFIG_ESPRESSIF_OTA_PRIMARY_SLOT_OFFSET,
+ .size = CONFIG_ESPRESSIF_OTA_SLOT_SIZE,
+ .devpath = CONFIG_ESPRESSIF_OTA_PRIMARY_SLOT_DEVPATH
+ },
+ {
+ .offset = CONFIG_ESPRESSIF_OTA_SECONDARY_SLOT_OFFSET,
+ .size = CONFIG_ESPRESSIF_OTA_SLOT_SIZE,
+ .devpath = CONFIG_ESPRESSIF_OTA_SECONDARY_SLOT_DEVPATH
+ },
+ {
+ .offset = CONFIG_ESPRESSIF_OTA_SCRATCH_OFFSET,
+ .size = CONFIG_ESPRESSIF_OTA_SCRATCH_SIZE,
+ .devpath = CONFIG_ESPRESSIF_OTA_SCRATCH_DEVPATH
+ }
+};
+#endif
+
/****************************************************************************
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: init_ota_partitions
+ *
+ * Description:
+ * Initialize partitions that are dedicated to firmware OTA update.
+ *
+ * Input Parameters:
+ * None.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ESPRESSIF_HAVE_OTA_PARTITION
+static int init_ota_partitions(void)
+{
+ struct mtd_dev_s *mtd;
+ int ret = OK;
+
+#ifdef CONFIG_BCH
+ char blockdev[18];
+#endif
+
+ for (int i = 0; i < nitems(g_ota_partition_table); ++i)
Review Comment:
adjusted
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]