From bd4edea20d5ddf3c22c083866001cc3030767361 Mon Sep 17 00:00:00 2001 From: helei Date: Sun, 9 Aug 2026 10:10:59 +0800 Subject: [PATCH] =?UTF-8?q?V1.4-Chinese=20BL=EF=BC=9A=E5=9B=9E=E9=80=80?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=B7=B3=E8=BD=AC=E5=89=8D=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?APP=E6=9C=89=E6=95=88=E6=80=A7=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8F=AA=E5=88=B7BL=E6=97=B6=E7=9B=B2=E8=B7=B3=E7=A9=BA?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- V1.4-Chinese/STM32F103_BootLoader/m_app/ota_boot.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/V1.4-Chinese/STM32F103_BootLoader/m_app/ota_boot.c b/V1.4-Chinese/STM32F103_BootLoader/m_app/ota_boot.c index a18f06f..f0c8596 100644 --- a/V1.4-Chinese/STM32F103_BootLoader/m_app/ota_boot.c +++ b/V1.4-Chinese/STM32F103_BootLoader/m_app/ota_boot.c @@ -538,11 +538,16 @@ void Start_BootLoader(void) } } - /* 3. 回退状态:直接跳转当前 APP1 */ + /* 3. 回退状态:跳转当前 APP1(先校验,防止 APP 被擦除后跳入空片) */ if (info_ok && info.update_state == W25Q64_STATE_ROLLBACK) { - IAP_ExecuteApp(Application_1_Addr); - return; + if (Verify_Firmware(Application_1_Addr, Application_Size)) + { + IAP_ExecuteApp(Application_1_Addr); + return; + } + log_warn("[BL] 回退状态但 APP1 无效,清除 OTA 标志"); + W25Q64_OTA_ClearNew(); } /* 4. 没有 OTA 任务:直接启动 APP1 */