@@ -31,7 +31,7 @@ message("-- HARDRT_BUILD_EXAMPLES : ${HARDRT_BUILD_EXAMPLES}")
3131message ("-- HARDRT_BUILD_TESTS : ${HARDRT_BUILD_TESTS} " )
3232message ("-- HARDRT_STALL_ON_ERROR : ${HARDRT_STALL_ON_ERROR} " )
3333message ("-- HARDRT_DEBUG : ${HARDRT_DEBUG} " )
34- message ("-- HARDRT_CFG_MAX_TASKS : ${HARDRT_CFG_MAX_TASKS} " )
34+ message ("-- HARDRT_CFG_MAX_TASKS : ${HARDRT_CFG_MAX_TASKS} + 1 for IDLE task " )
3535message ("-- HARDRT_CFG_MAX_PRIO : ${HARDRT_CFG_MAX_PRIO} " )
3636
3737# Validate sizing knobs at configure time (no kernel source changes needed)
@@ -48,6 +48,8 @@ endif()
4848if (_HRT_CFG_TASKS LESS 1)
4949 message (FATAL_ERROR "HARDRT_CFG_MAX_TASKS must be >= 1. Got ${HARDRT_CFG_MAX_TASKS} ." )
5050endif ()
51+
52+ # this is not actually fatal, but makes no sense to have priority to whom no available task is associated.
5153if (_HRT_CFG_TASKS LESS _HRT_CFG_PRIO)
5254 message (FATAL_ERROR "Invalid configuration: HARDRT_CFG_MAX_TASKS (${HARDRT_CFG_MAX_TASKS} ) must be >= HARDRT_CFG_MAX_PRIO (${HARDRT_CFG_MAX_PRIO} )." )
5355endif ()
@@ -117,9 +119,11 @@ add_library(${LIB_NAME} STATIC ${LIBRARY_SOURCES})
117119
118120# Propagate sizing knobs to all consumers (library PUBLIC interface)
119121# so examples/tests and downstream apps see consistent limits.
122+ # HARDRT_CFG_MAX_TASKS + 1 as the extra task is taken by the idle task.
123+ math (EXPR HARDRT_MAX_TASKS_VALUE "${HARDRT_CFG_MAX_TASKS} + 1" )
120124target_compile_definitions (${LIB_NAME}
121125 PUBLIC
122- HARDRT_MAX_TASKS=${HARDRT_CFG_MAX_TASKS }
126+ HARDRT_MAX_TASKS=${HARDRT_MAX_TASKS_VALUE }
123127 HARDRT_MAX_PRIO=${HARDRT_CFG_MAX_PRIO}
124128 HARDRT_STALL_ON_ERROR=${HARDRT_STALL_ON_ERROR}
125129 HARDRT_DEBUG=${HARDRT_DEBUG}
0 commit comments