From 0c717e48184eb9a1dbaadd825dcb9afa34ea953e Mon Sep 17 00:00:00 2001 From: wangfq Date: Mon, 17 Aug 2026 10:04:52 +0800 Subject: [PATCH] =?UTF-8?q?test(vd960DBN):=20=E5=AE=9E=E9=AA=8CA=20?= =?UTF-8?q?=E2=80=94=20=E8=B7=B3=E8=BF=87=20offlog=5Fboot=20SPI=20?= =?UTF-8?q?=E5=86=99,=20=E9=AA=8C=E8=AF=81=E8=B7=91=E9=A3=9E=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E7=82=B9=20(2026-08-17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 日志诊断: RSTSCKR 全 0(非硬件复位) + snap ok 后 71B 乱码 + 无 ASCII 打印 → PC 跑飞跳回 0x00000000 重启, 触发点锁定 offlog_boot(SPI 32B 页写)。 与 08-12 实验 99ef634 结论一致。 - offlog_boot() 调用 #if 0, 保留 RMVF 清除 - 新增 .noinit g_boot_count 计数器: 每次 main 重进 +1 并打印 BOOT_CNT (跑飞重启不清零, 区分真复位 vs 跑飞) - 新增 EXPA: offlog_boot skipped 标记打印 预期: 不崩 → offlog_boot 写实锤; 仍崩 → 跑飞点下移 load_cfg/output_cfg --- .../APP/peripheral_main.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c index da9883f..54506d3 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c @@ -89,6 +89,10 @@ uint32_t g_storage_uart_baud = 19200;//9600; uint8_t g_storage_uart_num_2 = 1; uint32_t g_storage_uart_baud_2 = 115200; //115200; +/* 实验A诊断 (2026-08-17): .noinit boot 计数器 — 跑飞重启不清零, 每次 main 重进 +1. + 真复位(POR/IWDG/软复位)后 .bss 清零但 .noinit 保留, 可区分复位与跑飞重启 */ +uint32_t g_boot_count __attribute__((section(".noinit"))); + uint32_t mstick(void){ return TimingDelayInc; } @@ -309,6 +313,8 @@ int main(void) /* 诊断: 复位原因寄存器 (bit31=IWDG bit30=WWDG bit29=LPWR bit26=NRST bit25=POR bit24=软复位) 每次上电必打, 区分看门狗死锁 vs 掉电 vs 外部复位 */ PRINT("RST_REASON: 0x%08lx\n", (unsigned long)OFFLOG_RCC_RSTSCKR); + g_boot_count++; + PRINT("BOOT_CNT: %lu\n", (unsigned long)g_boot_count); fault_diag_init(); /* 打印上次复位现场 (HardFault mcause/mepc + 执行轨迹 marker) */ iot_watchdog_init(); /* 无条件 IWDG (2026-08-13): iot_enable=0 时 iot_mqtt_init 不调, 卡死无兜底 → 永久冻结。IWDG 4s 超时 + 主循环喂狗 */ @@ -331,10 +337,19 @@ int main(void) snap_init(); PRINT("INIT: snap ok\n"); - /* offlog_boot: 记录本次复位原因到事件日志 (2026-08-14 恢复) */ + /* ===== 实验A (2026-08-17): 跳过 offlog_boot SPI 写 — 验证跑飞触发点 ===== + 背景: 日志 RSTSCKR 全 0(非硬件复位) + snap ok 后 71B 乱码 + 无 ASCII + → PC 跑飞跳回 0x00000000 重启, 触发点在 offlog_boot(SPI 32B 页写) + 与 08-12 实验 99ef634 一致: 跳过 offlog_boot 写 → 不崩 + 不崩 → offlog_boot 写实锤; 仍崩 → 跑飞点下移 load_cfg/output_cfg + 验证后恢复: 取消 #if 0, 并视结果考虑延后到主循环喂狗后执行 */ { uint32_t rcc_rst = OFFLOG_RCC_RSTSCKR; +#if 0 offlog_boot(rcc_rst); +#else + PRINT("EXPA: offlog_boot skipped\n"); +#endif OFFLOG_RCC_RSTSCKR |= OFFLOG_RST_RMVF; /* RMVF (bit24): 清复位标志 */ }