On Sun, Mar 14, 2021 at 8:27 AM Fotis Panagiotopoulos <f.j.pa...@gmail.com> wrote:
> > Why not to use the hardware watchdog timer which is more reliable and > > simple than the pure software solution? > > I do use it, but a hardware watchdog can monitor only one thing (in my case > the kernel itself). > > If you want to catch some task/thread in an infinite loop, the hardware watchdog monitor in nuttx can do it for you. > I would like to monitor multiple things independently, the system's tasks. > > > Στις Κυρ, 14 Μαρ 2021 στις 5:22 μ.μ., ο/η Xiang Xiao < > xiaoxiang781...@gmail.com> έγραψε: > > > Why not to use the hardware watchdog timer which is more reliable and > > simple than the pure software solution? > > > > On Sun, Mar 14, 2021 at 5:49 AM Fotis Panagiotopoulos < > f.j.pa...@gmail.com > > > > > wrote: > > > > > Hi everybody! > > > > > > I am in need of per-task software watchdog timers. > > > I would like to somehow monitor my tasks, and ensure that they are > > running > > > as they should. > > > (For example, not stuck in an infinite loop). > > > > > > For this purpose, I usually use software implementations of watchdog > > > timers. > > > Note that by this, I do not mean the watchdogs that Nuttx already has, > > > rather something similar to the hardware watchdog timer that most MCUs > > > have. > > > > > > Each task should have a timer, which needs to be reset (feed) > > periodically > > > so it does not expire. > > > If it does, the offending task is terminated, or the system is > restarted. > > > > > > As far as I can tell, NuttX does not have such a facility to monitor > the > > > execution of its tasks. (Or does it?) > > > > > > Is there any interest in adding this feature? > > > > > > I was thinking it like this: > > > - Adding a timer in struct tcb_s. > > > - Extend the sched() function to start, stop, configure and feed the > > > watchdog. > > > > > > What do you think? > > > > You don't need a special timer here, the posix timer can work very well: 1. Create a watchdog timer by timer_create 2. Feed the timer periodically through timer_settime 3. Register a timeout signal handler 4. Call exit/abort in signal handler >