4.7.4. 测试指南

4.7.4.1. 测试环境

4.7.4.1.1. 硬件

  • 开发板

4.7.4.1.2. 软件

  • PC端的串口终端软件,用于PC和开发板进行串口通信

  • ZX-RTT 中打开 Watchdog模块和test-wdt功能

4.7.4.1.3. 软件配置

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

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

Drivers options --->
    Drivers examples --->
        [*] Enable WDT driver test command

4.7.4.2. 复位功能测试

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 17 2023 - 13:25:13 +0800)

4.7.4.3. 综合功能测试

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

wdt_test的使用示例

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      #开启喂狗功能(空闲钩子)