This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit ef56aabe199ed1b53410c376f4894d34bfc1384a
Author: davidiogos <[email protected]>
AuthorDate: Thu Oct 10 10:09:04 2024 -0300

    boards: riscv: esp32c6: Add partitioning support for OTA
    
    Add support for memory partitioning for OTA updates.
    This feature is targeted at the integration of ESP32 boards with RISC-V 
architecture in conjunction with MCUboot
    
    Signed-off-by: davidiogos <[email protected]>
---
 .../risc-v/esp32c6/common/src/esp_board_spiflash.c | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/boards/risc-v/esp32c6/common/src/esp_board_spiflash.c 
b/boards/risc-v/esp32c6/common/src/esp_board_spiflash.c
index b729795e19..281427f1de 100644
--- a/boards/risc-v/esp32c6/common/src/esp_board_spiflash.c
+++ b/boards/risc-v/esp32c6/common/src/esp_board_spiflash.c
@@ -121,22 +121,23 @@ static int init_ota_partitions(void)
 {
   struct mtd_dev_s *mtd;
   int ret = OK;
+  int i;
 
 #ifdef CONFIG_BCH
   char blockdev[18];
 #endif
 
-  for (int i = 0; i < nitems(g_ota_partition_table); ++i)
-  {
-    const struct ota_partition_s *part = &g_ota_partition_table[i];
-    mtd = esp_spiflash_alloc_mtdpart(part->offset, part->size);
-
-    ret = ftl_initialize(i, mtd);
-    if (ret < 0)
+  for (i = 0; i < nitems(g_ota_partition_table); ++i)
     {
-      ferr("ERROR: Failed to initialize the FTL layer: %d\n", ret);
-      return ret;
-    }
+      const struct ota_partition_s *part = &g_ota_partition_table[i];
+      mtd = esp_spiflash_alloc_mtdpart(part->offset, part->size);
+
+      ret = ftl_initialize(i, mtd);
+      if (ret < 0)
+        {
+          ferr("ERROR: Failed to initialize the FTL layer: %d\n", ret);
+          return ret;
+        }
 
 #ifdef CONFIG_BCH
       snprintf(blockdev, sizeof(blockdev), "/dev/mtdblock%d", i);
@@ -148,10 +149,11 @@ static int init_ota_partitions(void)
           return ret;
         }
 #endif
-  }
+    }
 
   return ret;
 }
+
 #endif
 
 /****************************************************************************

Reply via email to