Edit online

测试指南

Watchdog 测试所需的测试环境如下:
  • 硬件:开发板
  • 软件
    • PC 端的串口终端软件,用于 PC 和开发板进行串口通信
    • Luban-Lite 中打开 Watchdog 模块和 wdt 功能

软件配置

打开 wdt 的综合功能测试(test-wdt)开关如下:

在 Lite 根目录下 scons -- menuconfig,进入 menuconfig 的功能配置界面,按如下配置:

Driversoptions--->Driversexamples--->[*]EnableWDTdrivertestcommand

复位功能测试

wdt 驱动注册了一个 reboot 命令,可实现系统的复位,此命令可用来验证 wdt 的复位功能。 使用方法:

aic /> reboot
01-01 08:05:22 I/WDT: Restarting system ...

Pre-Boot Program ... (2023-03-02 14:20:30)
Going to init DDR2. freq: 504MHz, size: 64MB.
DDR2 initialized
PBP done

U-Boot SPL 2021.10-00008-g13511a4f-dirty (Apr 172023 - 13:25:13 +0800)

综合功能测试

wdt 同样也注册了一个 test_wdt 命令,主要用于测试 wdt 的其他功能(如喂狗,预处理等)。

wdt 帮助信息:

aic /> test_wdt -u

Usage: test_wdt [-s timeout][-p pretimeout][-c clear threshold][-g][-k][-u]
        -s, --set-timeout      Set a timeout, in second
        -p, --set-pretimeout   Set a pretimeout, in second
        -c, --set-clear threshold      Set clear threshold,in second(0~3)
        -g, --get-timeout      Get the current timeout, in second
        -k, --keepalive        Keepalive the watchdog
        -u, --usage

test_wdt 的使用示例

aic /> test_wdt -s 3#设置 timeout 为 3,并开启看门狗,即 3 秒后重启
aic /> test_wdt -p 3#设置 pretimeout 为 3,并开启超时中断
aic /> test_wdt -c 3#设置清除窗口为 3,即计数到 3 秒之后才能“喂狗”
aic /> test_wdt -g      #获取 timeout
aic /> test_wdt -k      #开启喂狗功能(空闲钩子)