The demonstration projects are provided as:
Most demos applications also create a 'check' task in one form or another. The 'check' task will execute infrequently (typically every 3 or 5 seconds) but has a high priority so is guaranteed to get processor time. Its primary responsibility is to check that all the other tasks are still operating as expected, and that no errors have been detected. The check task will report the system status either on an LCD (if present) or by toggling an LED.
A typical main() function will have the following structure:
int main( void )
{
/* Setup the microcontroller hardware for the demo. */
prvSetupHardware();
/* Create the common demo application tasks, for example: */
vCreateFlashTasks();
vCreatePollQTasks();
vCreateComTestTasks();
Etc.
/* Create any tasks defined within main.c itself, or otherwise specific to the
demo being built. */
xTaskCreate( vCheckTask, "check", STACK_SIZE, NULL, TASK_PRIORITY, NULL );
Etc.
/* Start the RTOS scheduler, this function should not return as it causes the
execution context to change from main() to one of the created tasks. */
vTaskStartScheduler();
/* Should never get here! */
return 0;
}
Basic information on the common demo task is provided, but note the documentation is normally out of date as new common demo tasks are created often. Demo task files that have been added more recently tend to have been designed more specifically for testing than just for demonstration, so can be complex.
A few of points to note:
The demo application does not free all its resources when it exits, although the RTOS kernel does. This has been done purely to minimize lines of code.