yangsong8-a1 opened a new pull request, #21850:
URL: https://github.com/apache/nuttx/pull/21850

   ## Summary
   
   Add a watchdog lower half for the ARM CMSDK APB watchdog
   (`CONFIG_WATCHDOG_CMSDK`), registered with `cmsdk_wdt_initialize()` as
   `/dev/watchdogN`. The first expiry raises the watchdog interrupt; the
   second one resets the system. With `WDIOC_CAPTURE`, the reset stage is
   disabled and the handler is called on each first-stage expiry.
   
   ## Impact
   
   New driver, off by default. No board enables it yet. The watchdog
   interrupt must be a maskable IRQ: the driver keeps INTEN set and relies on
   the interrupt staying masked until a capture handler is attached. On a
   system where it is routed to NMI (as on the MPS2/MPS3 boards) the
   interrupt handler reloads the counter, so the reset stage is never reached.
   
   ## Testing
   
   Ubuntu 22.04, arm-none-eabi-gcc 10.3, QEMU 6.2.
   
   | Config | Result |
   |---|---|
   | mps2-an500:nsh + WATCHDOG + WATCHDOG_CMSDK (Make and CMake) | builds, 0 
warnings |
   | mps3-an547:nsh + WATCHDOG + WATCHDOG_CMSDK | builds, 0 warnings |
   | QEMU mps2-an500, watchdog at 0x40008000, test program, `WDIOC_CAPTURE` 
mode | see the log below |
   | reset stage | not run on QEMU: mps2 wires the watchdog interrupt to NMI, 
which cannot be masked, so the reset stage is never reached there. Tested on my 
own product and EVB board |
   
   QEMU mps2-an500, timeout 500 ms with a capture handler:
   
   ```
   nsh> hello w
   hello w: register ret=0
   nsh> hello c
   open fd=3
   settimeout(500) ret=0
   capture ret=0
   start ret=0
   status flags=0x5 timeout=500 timeleft=242
   early-warning interrupts in 3.2 s: 8
   stop ret=0
   interrupts 1 s after stop: 0
   ```
   
   8 instead of 6 expiries: on QEMU mps2-an500 the guest SysTick time runs
   slower than the host clock that drives the watchdog model.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to