Skip to content

Commit 4732b96

Browse files
authored
Add daemon task startup hook / timer task creation consistency check (#1009)
Add a compile time check that emits a helpful error message if the user attempts to create a daemon task startup hook without also creating the timer/daemon task. The timer/daemon task startup hook runs in the context of the timer/daemon task. Therefore, it won't run even if configUSE_DAEMON_TASK_STARTUP_HOOK is set to 1 if the timer task isn't created. The timer task is only created if configUSE_TIMERS is not equal to 0.
1 parent d95451d commit 4732b96

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

include/FreeRTOS.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,6 @@
298298
#endif
299299
#endif
300300

301-
#ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
302-
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
303-
#endif
304-
305301
#ifndef configUSE_APPLICATION_TASK_TAG
306302
#define configUSE_APPLICATION_TASK_TAG 0
307303
#endif
@@ -322,6 +318,16 @@
322318
#define configUSE_TIMERS 0
323319
#endif
324320

321+
#ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
322+
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
323+
#endif
324+
325+
#if ( configUSE_DAEMON_TASK_STARTUP_HOOK != 0 )
326+
#if ( configUSE_TIMERS == 0 )
327+
#error configUSE_DAEMON_TASK_STARTUP_HOOK is set, but the daemon task is not created because configUSE_TIMERS is 0.
328+
#endif
329+
#endif
330+
325331
#ifndef configUSE_COUNTING_SEMAPHORES
326332
#define configUSE_COUNTING_SEMAPHORES 0
327333
#endif

0 commit comments

Comments
 (0)