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.
diff --git a/include/FreeRTOS.h b/include/FreeRTOS.h
index ecf82dc..8dcb407 100644
--- a/include/FreeRTOS.h
+++ b/include/FreeRTOS.h
@@ -298,10 +298,6 @@
#endif
#endif
-#ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
- #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
-#endif
-
#ifndef configUSE_APPLICATION_TASK_TAG
#define configUSE_APPLICATION_TASK_TAG 0
#endif
@@ -322,6 +318,16 @@
#define configUSE_TIMERS 0
#endif
+#ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
+ #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
+#endif
+
+#if ( configUSE_DAEMON_TASK_STARTUP_HOOK != 0 )
+ #if ( configUSE_TIMERS == 0 )
+ #error configUSE_DAEMON_TASK_STARTUP_HOOK is set, but the daemon task is not created because configUSE_TIMERS is 0.
+ #endif
+#endif
+
#ifndef configUSE_COUNTING_SEMAPHORES
#define configUSE_COUNTING_SEMAPHORES 0
#endif