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]);