Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e30d860
sched/hrtimer: Convert global variables to per-CPU and add initializa…
Fix-Point Dec 1, 2026
14fd1c8
hrtimer: introduce hrtimer_is_active()
Fix-Point Nov 4, 2026
3bb6582
sched: Remove conditional compilation for HRTIMER.
Fix-Point Apr 2, 2026
2f44b9f
sched/tickless: Convert watchdog to hrtimer in tickless scheduler
Fix-Point Dec 1, 2026
d0b0ccf
sched/sched: Fix Coverity CID 3933998 (MISRA C-2012 Rule 9.1)
dengwenqi123 Dec 1, 2026
fe4bf19
sched/wqueue: Add hrtimer support for workqueue
Fix-Point Apr 8, 2026
a66e9f7
sched/tickless: Remove tick-based alarm/timer interfaces
Fix-Point Apr 27, 2026
9b0c3ca
sched/hrtimer: Extract the hrtimer queue into reusable interfaces
Fix-Point Nov 30, 2026
6a828e8
sched/wdog: Fix Coverity CID 3933988 unchecked return value
dengwenqi123 May 18, 2026
bca1026
sched/wdog: Inline wdog interfaces with NULL checks
Fix-Point Aug 21, 2026
b1f6277
sched/wdog: Refactor wdog on top of the hrtimer queue
Fix-Point Nov 30, 2026
6767550
sched/wdog: Drop g_wdtimernested, use the hrtimer running slot
Fix-Point Nov 30, 2026
d98e92d
sched/tickless: Use the hrtimer running slot in the tickless scheduler
Fix-Point Dec 1, 2026
e2486a3
sched/wdog: read the cancel note fields under the critical section
Fix-Point Nov 30, 2026
7bdbbad
boards/stm32l476vg-disco/nsh: Reduce PREALLOC_TIMERS to save 120 byte…
Fix-Point Nov 30, 2026
3d3a1a8
libc/misc: move tempbuffer pool from .data to .bss
zyfeier Dec 1, 2026
065612c
boards/imx93-qsb/rpmsg: disable the libc temp buffer
Fix-Point Dec 1, 2026
e0cd03d
boards/lx_cpu/nsh: disable the libc temp buffer
Fix-Point Dec 1, 2026
73eb6e0
boards/lx_cpu/nsh: Enable LTO
Fix-Point Dec 1, 2026
4026b0c
boards/eoss3/quickfeather: Enable LTO
Fix-Point Dec 1, 2026
f8e66dd
boards/eoss3/quickfeather: Enable compiler optimization
Fix-Point Dec 1, 2026
57d89b3
boards/stm32f3/nucleo-f302r8: Disable stack dump on the cansock config
Fix-Point Dec 2, 2026
8a162ce
boards/stm32g4/nucleo-g431rb: Disable stack dump on the cansock config
Fix-Point Dec 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arch/arm/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,8 @@ ifeq ($(CONFIG_FDPIC),y)
LDMODULEFLAGS = -m armelf_linux_fdpiceabi -shared -z now \
-T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/elf/gnu-elf.ld)
else
CELFFLAGS += $(PICFLAGS) -mpic-register=r9
CXXELFFLAGS += $(PICFLAGS) -mpic-register=r9
CELFFLAGS += $(PICFLAGS)
CXXELFFLAGS += $(PICFLAGS)

# Generate an executable elf, need to ignore undefined symbols
LDELFFLAGS += $(LDXLINKER) --unresolved-symbols=ignore-in-object-files
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/eoss3/quickfeather/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=61440
CONFIG_BUILTIN=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_EOSS3_UART=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=4096
CONFIG_LTO_FULL=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_BASENAME=y
CONFIG_NSH_DISABLE_CMP=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/imx9/imx93-qsb/configs/rpmsg/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# CONFIG_ARCH_LEDS is not set
# CONFIG_ARCH_RAMFUNCS is not set
# CONFIG_DEBUG_FUNCTIONNAME is not set
# CONFIG_LIBC_TEMPBUFFER is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_RPMSG_PROCFS is not set
CONFIG_ARCH="arm"
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/lpc17xx_40xx/lx_cpu/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# modifications.
#
# CONFIG_EXAMPLES_ELF_FSMOUNT is not set
# CONFIG_LIBC_TEMPBUFFER is not set
# CONFIG_NSH_DISABLE_SHUTDOWN is not set
# CONFIG_SPI_EXCHANGE is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
Expand Down Expand Up @@ -89,6 +90,7 @@ CONFIG_LPC17_40_SSP1=y
CONFIG_LPC17_40_UART0=y
CONFIG_LPC17_40_USBDEV=y
CONFIG_LPC17_40_USBHOST=y
CONFIG_LTO_FULL=y
CONFIG_M25P_SUBSECTOR_ERASE=y
CONFIG_MMCSD=y
CONFIG_MMCSD_SDIO=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F302R8=y
CONFIG_ARCH_CHIP_STM32F3=y
CONFIG_ARCH_INTERRUPTSTACK=1024
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_INITTHREAD_STACKSIZE=1024
CONFIG_BOARD_LOOPSPERMSEC=8499
CONFIG_BUILTIN=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32G431R=y
CONFIG_ARCH_CHIP_STM32G4=y
CONFIG_ARCH_INTERRUPTSTACK=1024
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=8499
CONFIG_BOARD_NUCLEO_G431RB_USE_HSE=y
CONFIG_BUILTIN=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_TIMERS=2
CONFIG_RAM_SIZE=98304
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
Expand Down
2 changes: 0 additions & 2 deletions boards/arm64/fvp-v8r/fvp-armv8r/configs/citest/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_HRTIMER=y
CONFIG_HRTIMER_LIST=y
CONFIG_IDLETHREAD_STACKSIZE=8192
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
Expand Down
1 change: 0 additions & 1 deletion boards/risc-v/c906/smartl-c906/configs/sotest/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_SOTEST=y
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_HRTIMER=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
Expand Down
1 change: 0 additions & 1 deletion boards/risc-v/qemu-rv/rv-virt/configs/citest64/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_FS_TMPFS=y
CONFIG_HAVE_CXX=y
CONFIG_HRTIMER=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="init_main"
CONFIG_INIT_STACKSIZE=4096
Expand Down
2 changes: 0 additions & 2 deletions boards/sim/sim/sim/configs/ostest/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_FS_NAMED_SEMAPHORES=y
CONFIG_HRTIMER=y
CONFIG_HRTIMER_LIST=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="ostest_main"
CONFIG_MM_KASAN=y
Expand Down
1 change: 0 additions & 1 deletion boards/tricore/tc3x/a2g-tc375-lite/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
CONFIG_FS_TMPFS=y
CONFIG_HRTIMER=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LIBC_MEMFD_ERROR=y
CONFIG_LIBM=y
Expand Down
1 change: 0 additions & 1 deletion boards/tricore/tc3x/a2g-tc397-5v-tft/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
CONFIG_FS_TMPFS=y
CONFIG_HRTIMER=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LIBC_MEMFD_ERROR=y
CONFIG_LIBM=y
Expand Down
42 changes: 6 additions & 36 deletions drivers/timers/arch_alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,14 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)

void weak_function up_timer_getmask(FAR clock_t *mask)
{
*mask = 0;
clock_t maxticks = 0;

if (g_oneshot_lower != NULL)
{
clock_t maxticks = 0;
DEBUGASSERT(g_oneshot_lower);

ONESHOT_TICK_MAX_DELAY(g_oneshot_lower, &maxticks);
ONESHOT_TICK_MAX_DELAY(g_oneshot_lower, &maxticks);

*mask = maxticks == 0 ? 0 :
UINT64_MAX >> (sizeof(clock_t) * 8u - flsx(maxticks));
}
*mask = maxticks == 0 ? 0 :
UINT64_MAX >> (sizeof(clock_t) * 8u - flsx(maxticks));
}

int weak_function up_timer_gettick(FAR clock_t *ticks)
Expand Down Expand Up @@ -368,21 +365,6 @@ int weak_function up_alarm_cancel(FAR struct timespec *ts)
return ret;
}

int weak_function up_alarm_tick_cancel(FAR clock_t *ticks)
{
int ret = -EAGAIN;

if (g_oneshot_lower != NULL)
{
ret = ONESHOT_TICK_CANCEL(g_oneshot_lower, ticks);

#ifndef CONFIG_ONESHOT_COUNT
ONESHOT_TICK_CURRENT(g_oneshot_lower, ticks);
#endif
}

return ret;
}
#endif

/****************************************************************************
Expand All @@ -409,7 +391,7 @@ int weak_function up_alarm_tick_cancel(FAR clock_t *ticks)
*
****************************************************************************/

#if defined(CONFIG_SCHED_TICKLESS) || defined(CONFIG_HRTIMER)
#ifdef CONFIG_SCHED_TICKLESS
int weak_function up_alarm_start(FAR const struct timespec *ts)
{
int ret = -EAGAIN;
Expand All @@ -421,18 +403,6 @@ int weak_function up_alarm_start(FAR const struct timespec *ts)

return ret;
}

int weak_function up_alarm_tick_start(clock_t ticks)
{
int ret = -EAGAIN;

if (g_oneshot_lower != NULL)
{
ret = ONESHOT_TICK_ABSOLUTE(g_oneshot_lower, ticks);
}

return ret;
}
#endif

/****************************************************************************
Expand Down
26 changes: 0 additions & 26 deletions drivers/timers/arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,19 +354,6 @@ int weak_function up_timer_gettime(struct timespec *ts)
****************************************************************************/

#ifdef CONFIG_SCHED_TICKLESS
int weak_function up_timer_tick_cancel(FAR clock_t *ticks)
{
int ret = -EAGAIN;

if (g_timer.lower != NULL)
{
*ticks = update_timeout(g_oneshot_maxticks);
ret = OK;
}

return ret;
}

int weak_function up_timer_cancel(FAR struct timespec *ts)
{
int ret = -EAGAIN;
Expand Down Expand Up @@ -414,19 +401,6 @@ int weak_function up_timer_cancel(FAR struct timespec *ts)
****************************************************************************/

#ifdef CONFIG_SCHED_TICKLESS
int weak_function up_timer_tick_start(clock_t ticks)
{
int ret = -EAGAIN;

if (g_timer.lower != NULL)
{
update_timeout(ticks);
ret = OK;
}

return ret;
}

int weak_function up_timer_start(FAR const struct timespec *ts)
{
int ret = -EAGAIN;
Expand Down
10 changes: 2 additions & 8 deletions include/nuttx/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,6 @@ void up_timer_getmask(FAR clock_t *mask);

#if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM)
int up_alarm_cancel(FAR struct timespec *ts);
int up_alarm_tick_cancel(FAR clock_t *ticks);
#endif

/****************************************************************************
Expand Down Expand Up @@ -2117,10 +2116,8 @@ int up_alarm_tick_cancel(FAR clock_t *ticks);
*
****************************************************************************/

#if (defined(CONFIG_HRTIMER) && defined(CONFIG_ALARM_ARCH)) || \
(defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM))
#if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM)
int up_alarm_start(FAR const struct timespec *ts);
int up_alarm_tick_start(clock_t ticks);
#endif

/****************************************************************************
Expand Down Expand Up @@ -2161,7 +2158,6 @@ int up_alarm_tick_start(clock_t ticks);

#if defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_SCHED_TICKLESS_ALARM)
int up_timer_cancel(FAR struct timespec *ts);
int up_timer_tick_cancel(FAR clock_t *ticks);
#endif

/****************************************************************************
Expand Down Expand Up @@ -2189,10 +2185,8 @@ int up_timer_tick_cancel(FAR clock_t *ticks);
*
****************************************************************************/

#if (defined(CONFIG_HRTIMER) && defined(CONFIG_TIMER_ARCH)) || \
(defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_SCHED_TICKLESS_ALARM))
#if defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_SCHED_TICKLESS_ALARM)
int up_timer_start(FAR const struct timespec *ts);
int up_timer_tick_start(clock_t ticks);
#endif

/****************************************************************************
Expand Down
56 changes: 56 additions & 0 deletions include/nuttx/hrtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <nuttx/compiler.h>
#include <nuttx/list_type.h>

#include <stdbool.h>
#include <stdint.h>
#include <sys/tree_type.h>

Expand Down Expand Up @@ -96,6 +97,32 @@ typedef struct hrtimer_s
uint64_t expired; /* Absolute expiration time (ns) */
} hrtimer_t;

#ifdef CONFIG_HRTIMER_TREE
RB_HEAD(hrtimer_tree_s, hrtimer_s); /* RB-Tree */
#endif

/* High-resolution timer queue
*
* Contains all active high-resolution timers sorted by absolute expiration
* time, plus the cached earliest timer for O(1) first access. Each CPU
* owns a private queue instance.
*
* The queue does not embed any lock. Callers of the queue helpers
* (hrtimer_queue_insert, hrtimer_queue_remove and hrtimer_queue_first)
* are responsible for providing their own synchronization (e.g.
* enter/leave_critical_section).
*/

typedef struct hrtimer_queue_s
{
#ifdef CONFIG_HRTIMER_TREE
struct hrtimer_tree_s tree; /* RB-tree of active timers */
hrtimer_t *head; /* Cached earliest expired node */
#else
struct list_node list; /* Sorted list of active timers */
#endif
} hrtimer_queue_t;

/****************************************************************************
* Public Function Prototypes
****************************************************************************/
Expand Down Expand Up @@ -242,6 +269,35 @@ int hrtimer_start(FAR hrtimer_t *hrtimer, hrtimer_entry_t func,

uint64_t hrtimer_gettime(FAR const hrtimer_t *timer);

/****************************************************************************
* Name: hrtimer_is_active
*
* Description:
* Check whether the hrtimer is armed. The test is defined by the
* remaining time reported by hrtimer_gettime(): a non-zero remainder
* means the timer is pending and has not expired yet. A timer whose
* expiration time has been reached reports inactive even if it has
* not been processed yet, and a zero-delay timer is inactive at the
* moment it is queued.
*
* Input Parameters:
* timer - Pointer to the high-resolution timer instance.
*
* Returned Value:
* true if the timer is armed and has not expired yet.
*
****************************************************************************/

static inline_function
bool hrtimer_is_active(FAR const hrtimer_t *timer)
{
/* A non-zero remainder means the timer is pending and has not expired
* yet. Evaluate the argument once.
*/

return hrtimer_gettime(timer) != 0;
}

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/nuttx/sched_note.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ void sched_note_wdog_enter(FAR void *handler, FAR const void *arg);
void sched_note_wdog_leave(FAR void *handler, FAR const void *arg);
#else
# define sched_note_wdog_start(h,a)
# define sched_note_wdog_cancel(h,a)
# define sched_note_wdog_cancel(h,a) (void)(h); (void)(a)
# define sched_note_wdog_enter(h,a)
# define sched_note_wdog_leave(h,a)
#endif
Expand Down
Loading