Tasks
By convention, all tasks created by a sample application or associated helper modules have a priority higher or equal to 50.
Per the design of uC/OS-II, each tasks needs to have a unique priority. Creating a task while another task of the same priority is already running fails.
When using the Helper Modules, the following tasks are created:
task name | priority | description |
|---|---|---|
|
| Listens for notifications from the local interface (see Helper Modules). |
|
| Listens for events from the local interface (see Helper Modules). |
|
| Dispatches commands entered by the user on the CLI interface (see Helper Modules). |
As a results, the tasks created by the sample applications have a priority higher or equal to 53.
By convention, the name, priority and stack size associated with each task of a sample application are defined in a header file called app_task_cfg.h.
For example, the following contents indicates that the sample application defines 3 tasks. called "disco", "mgrconn" and "uart":
#ifndef APP_TASK_CFG_H
#define APP_TASK_CFG_H
#define TASK_APP_DISCO_NAME "disco"
#define TASK_APP_DISCO_PRIORITY 55
#define TASK_APP_DISCO_STK_SIZE 256
#define TASK_APP_MGRCONN_NAME "mgrconn"
#define TASK_APP_MGRCONN_PRIORITY 54
#define TASK_APP_MGRCONN_STK_SIZE 256
#define TASK_APP_UART_NAME "uart"
#define TASK_APP_UART_PRIORITY 53
#define TASK_APP_UART_STK_SIZE 256
#endifHere stack sizes are given in 4-byte words, so a stack size of 256 words = 1024 bytes of memory. A total of 8 kB of memory is set aside for all user tasks.
Per http://supp.iar.com/Support/?Note=85413, make sure to initialize the stack(s) to 8-byte aligned addresses.