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

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


The following commit(s) were added to refs/heads/master by this push:
     new c4506929e9 arch/esp32_partition.c:  fix the issue of switching from 
Factory to OTA_1 with a fixed seq of 1, which causes ota_get_bootseq() to 
return ota_0.
c4506929e9 is described below

commit c4506929e94b14f36669689872ed1d0e1a2270de
Author: nuttxs <zhaoqing.zh...@sony.com>
AuthorDate: Fri Apr 25 13:30:05 2025 +0800

    arch/esp32_partition.c:  fix the issue of switching from Factory to OTA_1
    with a fixed seq of 1, which causes ota_get_bootseq() to return ota_0.
    
    The current solution is to directly use the target partition's number (num)
    as next_seq to ensure the correct increment logic of seq. Ensure the formula
    (seq-1) % OTA_DATA_NUM + OTA_IMG_BOOT_OTA_0 correctly maps to ota_0 or ota_1
    
    Signed-off-by: nuttxs <zhaoqing.zh...@sony.com>
---
 arch/xtensa/src/esp32/esp32_partition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/src/esp32/esp32_partition.c 
b/arch/xtensa/src/esp32/esp32_partition.c
index dfbf10c571..461c8bfa86 100644
--- a/arch/xtensa/src/esp32/esp32_partition.c
+++ b/arch/xtensa/src/esp32/esp32_partition.c
@@ -333,7 +333,7 @@ static int ota_set_bootseq(struct mtd_dev_priv *dev, int 
num)
           }
         else if (ret == OTA_IMG_BOOT_FACTORY)
           {
-            next_seq = 1;
+            next_seq = (uint32_t)num;
           }
         else
           {

Reply via email to