调试指南
Watchdog 调试包含以下步骤:
- 调试开关在 luban 根目录下执行 make kernel-menuconfig,进入 kernel 的功能配置,可以打开 Watchdog 模块的 DEBUG 选项:
Linux Kernel hacking Artinchip Debug [*] Watchdog driver debug
此 DEBUG 选项打开的影响:
- Watchdog 驱动以-O0 编译
- Watchdog 的 pr_dbg()和 dev_dbg()调试信息会被编译
在系统运行时,如果要打印 pr_dbg()和 dev_dbg()信息,还需要调整 loglevel 为 8,两个方法:
-
在 dts 中修改 bootargs,增加“loglevel=8”
-
在板子启动到 shell 后,执行命令:
echo8 > /proc/sys/kernel/printk
- Sysfs 节点状态信息在 Watchdog 驱动初始化成功后,会在 Sysfs 中注册生成一个
status
节点,其中打印了当前的 Watchdog 配置及状态信息:[aic@] # cat /sys/devices/platform/soc/19000000.watchdog/status In Watchdog V256.00: Module Enable: 0 Dbg continue: 0 clr_thd: 333 Write disable: 0 IRQ Enable: 0 Current chan: 0 0 Current cnt: 352 chan clr_thd irq_thd rst_thd 0 0 160000 320000 1 0 160000 320000 2 0 160000 320000 3 0 160000 320000
- 当前的 Watchdog 通道信息查看当前生效正在使用的 Watchdog 通道信息:
[aic@] # cat /sys/devices/platform/soc/*.watchdog/timeout —— 当前通道的 timeout 配置 10 [aic@] # cat /sys/devices/platform/soc/*.watchdog/pretimeout —— 当前通道的 pretimeout 配置 0 [aic@] # cat /sys/devices/platform/soc/*.watchdog/channel —— 当前生效的通道编号 0