Skip to content

Commit

Permalink
boards: riscv: esp32c6: Add partitioning support for OTA
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
agrosystem-davi authored and acassis committed Oct 21, 2024
1 parent 092af63 commit ef56aab
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions boards/risc-v/esp32c6/common/src/esp_board_spiflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -148,10 +149,11 @@ static int init_ota_partitions(void)
return ret;
}
#endif
}
}

return ret;
}

#endif

/****************************************************************************
Expand Down

0 comments on commit ef56aab

Please sign in to comment.