测试:补启动段可观测性与模拟器差距清单,run_all_suites 加只编译模式(S10+S13+S6)
CI / L0 静态门禁 (pre-commit) (push) Successful in 1m10s
CI / L0.5 主机侧单测 (MSVC) (push) Successful in 25s

This commit is contained in:
2026-10-02 13:57:25 +08:00
parent fe963e7d91
commit d9425ddd23
12 changed files with 288 additions and 22 deletions
+17
View File
@@ -14,6 +14,9 @@
#include "sd2506.h"
#include "i2c.h"
#define DBG_TAG "[RTC]"
#include "dbg_log.h"
extern I2C_HandleTypeDef hi2c1;
/* ======================== 内部辅助函数 ======================== */
@@ -171,6 +174,10 @@ int sd2506_init(void) {
/* 验证 I2C 通信: 尝试读取 8 字节 ID */
ret = sd2506_read_regs(SD2506_REG_ID_START, a_id, SD2506_ID_SIZE);
if (ret != SD2506_OK) {
/* 启动段可观测性(2026-10-02 S10):本函数原先所有失败路径均静默返回,
* 而它是启动死机最可疑的源头(I2C1 硬件不通即卡此步且无任何输出)。
* 日志字符串必须纯 ASCII(文件无 BOM,ARMCC 按 CP936 解码)。 */
DBG_ERROR("sd2506_init: ID read FAIL (I2C err=%d)", ret);
return ret;
}
@@ -182,6 +189,7 @@ int sd2506_init(void) {
ret = sd2506_read_reg(SD2506_REG_CHARGE, &charge_val);
if (ret != SD2506_OK) {
DBG_ERROR("sd2506_init: charge reg read FAIL (err=%d)", ret);
return ret;
}
@@ -190,26 +198,35 @@ int sd2506_init(void) {
ret = sd2506_write_enable();
if (ret != SD2506_OK) {
DBG_ERROR("sd2506_init: write-enable FAIL (err=%d)", ret);
return ret;
}
ret = sd2506_write_reg(SD2506_REG_CHARGE, SD2506_CHARGE_INIT_VALUE);
if (ret != SD2506_OK) {
(void)sd2506_write_disable();
DBG_ERROR("sd2506_init: charge reg write FAIL (err=%d)", ret);
return ret;
}
ret_read = sd2506_read_reg(SD2506_REG_CHARGE, &charge_val);
ret = sd2506_write_disable();
if (ret != SD2506_OK) {
DBG_ERROR("sd2506_init: write-disable FAIL (err=%d)", ret);
return ret;
}
if (ret_read != SD2506_OK || charge_val != SD2506_CHARGE_INIT_VALUE) {
DBG_ERROR("sd2506_init: charge reg verify FAIL (read=%d val=0x%02X)",
ret_read, charge_val);
return SD2506_ERROR;
}
DBG_INFO("sd2506_init: charge reg 18H reset to 0x%02X (was drifted)",
SD2506_CHARGE_INIT_VALUE);
}
DBG_INFO("sd2506_init: OK");
return SD2506_OK;
}