wangchdo opened a new pull request, #17295:
URL: https://github.com/apache/nuttx/pull/17295

   ## Summary
   
   The implementation of wd_start() internally increases the delay
   by one tick. When using watchdogs to create periodic events,
   users may choose to restart the watchdog upon expiration. In this
   case, wd_start() is typically called from within the watchdog
   timeout callback. The internal +1 adjustment causes each period
   to drift by one tick over time.
       
   In addition, when reloading a watchdog, users usually do not need
   to specify the callback function or its argument again.
       
   This patch introduces a new API, wd_reload(), which only requires
   the user to specify a new timeout delay. And it can be used inside the
   watchdog timeout callback to achieve precise periodic timeouts
   without cumulative tick deviation.
   
   ## Impact
   
   new API added for wdog, no impact to existing nuttx functions
   
   ## Testing
   
   **ostest passed on board fvp-armv8r-aarch32**
   
   ```
   NuttShell (NSH)
   nsh> 
   nsh> name -a
   NuttX 0.0.0 1a1f175d36-dirty Nov  8 2025 13:40:28 arm fvp-armv8r-aarch32
   nsh> 
   nsh> ostest
   
   (...)
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     7ff9d2c  7ff9d2c
   ordblks         7        5
   mxordblk  7fe1f00  7febf28
   uordblks     d6f4     b60c
   fordblks  7fec638  7fee720
   
   user_main: vfork() test
   [ 4] ostest: arm_fork: fork context [0x2000f6a0]:
   [ 4] ostest: arm_fork:   r4:20003870 r5:00000000 r6:00000000 r7:00000000
   [ 4] ostest: arm_fork:   r8:00000000 r9:00000000 r10:00000000
   [ 4] ostest: arm_fork:   r11:00000000 sp:2000f6c8 lr:00055ce4
   [ 4] ostest: nxtask_setup_fork: Child priority=100 start=0x55ce4
   [ 4] ostest: nxtask_setup_fork: parent=0x2000d340, returning child=0x2000f778
   [ 4] ostest: arm_fork: TCBs: Parent=0x2000d340 Child=0x2000f778
   [ 4] ostest: arm_fork: Parent: stackutil:152
   [ 4] ostest: arm_fork: Old stack top:2000f760 SP:2000f6c8 FP:00000000
   [ 4] ostest: arm_fork: New stack top:20013a60 SP:200139c8 FP:00000000
   [ 4] ostest: nxtask_start_fork: Starting Child TCB=0x2000f778
   [ 4] ostest: nxtask_activate: ostest pid=85,TCB=0x2000f778
   [85] ostest: nxtask_exit: ostest pid=85,TCB=0x2000f778
   vfork_test: Child 85 ran successfully
   
   Final memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     7ff9d2c  7ff9d2c
   ordblks         1        5
   mxordblk  7ff0898  7febf28
   uordblks     9494     b52c
   fordblks  7ff0898  7fee800
   user_main: Exiting
   [ 4] ostest: nxtask_exit: ostest pid=4,TCB=0x2000d340
   ostest_main: Exiting with status 0
   stdio_test: Standard I/O Check: fprintf to stderr
   [ 3] ostest: nxtask_exit: ostest pid=3,TCB=0x2000af20
   nsh> 
   ```


-- 
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