From 5803255d89908363548fb8698892b6e03ab397f5 Mon Sep 17 00:00:00 2001 From: wangfq Date: Mon, 17 Aug 2026 10:15:21 +0800 Subject: [PATCH] =?UTF-8?q?test(vd960DBN):=20=E5=AE=9E=E9=AA=8CB=20?= =?UTF-8?q?=E2=80=94=20=E8=B7=B3=E8=BF=87=20load=5Fcfg/output=5Fcfg,=20?= =?UTF-8?q?=E8=B7=91=E9=A3=9E=E8=A7=A6=E5=8F=91=E7=82=B9=E4=B8=8B=E7=A7=BB?= =?UTF-8?q?=20(2026-08-17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实验A(跳过 offlog_boot)仍循环复位 → offlog_boot 非触发点, 跑飞点下移。 新证据: BOOT_CNT 恒=1 (.noinit 计数器每次被清) → RAM 全丢级重启, RSTSCKR 却无复位标志 → 疑似掉电-恢复(未触发POR) 而非软件跑飞。 - load_cfg_from_flash + output_cfg_from_flash #if 0, 加 EXPB 标记 - BOOT_CNT 打印加 &g_boot_count 地址, 确认 .noinit 段是否生效 (地址 >= _ebss≈0x2000612c 且在 .noinit → 复位不清零; 恒1 → RAM被清) 预期: 不崩 → 触发点在参数区SPI读或%s打印; 仍崩 → 触发点更晚/更早 --- .../APP/peripheral_main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c index 54506d3..f929461 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c @@ -314,7 +314,9 @@ int main(void) 每次上电必打, 区分看门狗死锁 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); + PRINT("BOOT_CNT: %lu @0x%08lx\n", (unsigned long)g_boot_count, (unsigned long)&g_boot_count); + /* 地址判读: >= _ebss(约0x2000612c) 且在 .noinit 段 → 复位不清零, 递增应>1; + BOOT_CNT 恒=1 → RAM 被清 (掉电级) 或 g_boot_count 落 .bss */ fault_diag_init(); /* 打印上次复位现场 (HardFault mcause/mepc + 执行轨迹 marker) */ iot_watchdog_init(); /* 无条件 IWDG (2026-08-13): iot_enable=0 时 iot_mqtt_init 不调, 卡死无兜底 → 永久冻结。IWDG 4s 超时 + 主循环喂狗 */ @@ -353,8 +355,19 @@ int main(void) OFFLOG_RCC_RSTSCKR |= OFFLOG_RST_RMVF; /* RMVF (bit24): 清复位标志 */ } + /* ===== 实验B (2026-08-17): 跳过 load_cfg/output_cfg — 跑飞触发点下移 ===== + 实验A(跳过 offlog_boot)仍崩 → 触发点不在 offlog_boot。 + 本版: #if 0 load_cfg_from_flash + output_cfg_from_flash + (load_cfg = malloc + SPI_Flash_Read 参数区512B + memcpy + free; + output_cfg = 大量 %s 打印 iot_net_info 等配置) + 不崩 → 触发点在此二函数(SPI 读参数区 or %s 越界打印); + 仍崩 → 触发点更晚(MAC/BLE init/主循环)或更早(snap_init 内) */ +#if 0 load_cfg_from_flash(); output_cfg_from_flash(); +#else + PRINT("EXPB: load_cfg/output_cfg skipped\n"); +#endif #endif PRINT("MAC: %02X %02X %02X %02X %02X %02X\r\n", gMacAddr[0],gMacAddr[1], gMacAddr[2], gMacAddr[3],gMacAddr[4],gMacAddr[5]);