User`s manual

84 digi.com Multitasking with Dynamic C
OS_MEM_EN Disable memory manager
Default is 0
OS_MBOX_EN Enable mailboxes
Default is 1
OS_SEM_EN Enable semaphores
Default is 1
OS_TICKS_PER_SEC Number of ticks in one second
Default is 64
STACK_CNT_256 Number of 256 byte stacks (idle task stack)
Default is 1
STACK_CNT_512 Number of 512-byte stacks
(task stacks + initial program stack)
Default is OS_MAX_TASKS+1 (11)
If a particular portion of µC/OS-II is disabled, the code for that portion will not be compiled, making the
overall size of the operating system smaller. Take advantage of this feature by customizing µC/OS-II based
on the needs of each application.
5.10.4.2 Custom Configuration
In order to customize µC/OS-II by enabling and disabling components of the operating system, simply
redefine the configuration constants as necessary for the application.
#define OS_MAX_EVENTS 2
#define OS_MAX_TASKS 20
#define OS_MAX_QS 1
#define OS_MAX_MEM_PART 15
#define OS_TASK_STAT_EN 1
#define OS_Q_EN 0
#define OS_MEM_EN 1
#define OS_MBOX_EN 0
#define OS_TICKS_PER_SEC 64
If a custom stack configuration is needed also, define the necessary macros for the counts of the different
stack sizes needed by the application.
#define STACK_CNT_256 1 // idle task stack
#define STACK_CNT_512 2 // initial program + stat task stack
#define STACK_CNT_1K 10 // task stacks
#define STACK_CNT_2K 10 // number of 2K stacks
In the application code, follow the µC/OS-II and stack configuration constants with a #use
“ucos2.lib” statement. This ensures that the definitions supplied outside of the library are used, rather
than the defaults in the library.
This configuration uses 20 tasks, two semaphores, up to 15 memory partitions that the memory manager
will control, and makes use of the statistics task. Note that the configuration constants for task creation,
task deletion, and semaphores are not defined, as the library defaults will suffice. Also note that ten of the