Convention Changes

There are a number of convention changes from µC/OS-II to µC/OS-III. The most notable is the use of CPU-specific data types. The table below shows the differences between the data types used in both kernels.

µC/OS-II vs. µC/OS-III basic Data Types
µC/OS-II (os_cpu.h)µC/CPU (cpu.h)Note
BOOLEANCPU_BOOLEAN
INT8SCPU_INT08S
INT8UCPU_INT08U
INT16SCPU_INT16S
INT16UCPU_INT16U
INT32SCPU_INT32S
INT32UCPU_INT32U
OS_STKCPU_STK(1)
OS_CPU_SR
µC/OS-II (os_cfg.h)
CPU_SR
µC/CPU (cpu.h)
(2)
OS_STK_GROWTHCPU_CFG_STK_GROWTH(3)

(1)  A task stack in µC/OS-II is declared as an  OS_STK , which is now replaced by a CPU specific data type  CPU_STK . These two data types are equivalent, except that defining the width of the CPU stack in µC/CPU makes more sense.

(2) It also makes sense to declare the CPU’s status register in µC/CPU.

(3) Stack growth (high-to-low or low-to-high memory) is declared in µC/CPU since stack growth is a CPU feature and not an OS one.

Another convention change is the use of the acronym “ CFG ” which stands for configuration. Now, all #define configuration constants and variables have the “ CFG ” or “ Cfg ” acronym in them as shown in the table below. This table shows the configuration constants that have been moved from os_cfg.h to os_cfg_app.h . This is done because µC/OS-III is configurable at the application level instead of just at compile time as with µC/OS-II.

µC/OS-III uses "CFG" in configuration
µC/OS-II (os_cfg.h)µC/OS-III (os_cfg_app.h)Note

OS_CFG_MSG_POOL_SIZE

OS_CFG_ISR_STK_SIZE

OS_CFG_TASK_STK_LIMIT_PCT_EMPTY
OS_TASK_IDLE_STK_SIZEOS_CFG_IDLE_TASK_STK_SIZE




OS_CFG_STAT_TASK_PRIO

OS_CFG_STAT_TASK_RATE_HZ
OS_TASK_STAT_STK_SIZEOS_CFG_STAT_TASK_STK_SIZE
OS_TICKS_PER_SECOS_CFG_TICK_RATE_HZ(1)

OS_CFG_TICK_TASK_PRIO

OS_CFG_TICK_TASK_STK_SIZE

OS_CFG_TMR_TASK_PRIO
OS_TMR_CFG_TICKS_PER_SECOS_CFG_TMR_TASK_RATE_HZ
OS_TASK_TMR_STK_SIZEOS_CFG_TMR_TASK_STK_SIZE
 

(1)  The very useful  OS_TICKS_PER_SEC  in µC/OS-II was renamed to  OS_CFG_TICK_RATE_HZ  in µC/OS-III. The “ HZ ” indicates that this  #define  represents Hertz (i.e., ticks per second).

The table belowshows additional configuration constants added to os_cfg.h , while several µC/OS-II constants were either removed or renamed.

µC/OS-III uses "CFG" in configuration
µC/OS-II (os_cfg.h)µC/OS-III (os_cfg.h)Note
OS_APP_HOOKS_ENOS_CFG_APP_HOOKS_EN
OS_ARG_CHK_ENOS_CFG_ARG_CHK_EN

OS_CFG_CALLED_FROM_ISR_CHK_EN
OS_DEBUG_ENOS_CFG_DBG_EN(1)
OS_EVENT_MULTI_EN

OS_EVENT_NAME_EN
(2)



OS_MAX_EVENTS
(3)
OS_MAX_FLAGS
(3)
OS_MAX_MEM_PART
(3)
OS_MAX_QS
(3)
OS_MAX_TASKS
(3)

OS_CFG_OBJ_TYPE_CHK_EN
OS_LOWEST_PRIOOS_CFG_PRIO_MAX

OS_CFG_SCHED_LOCK_TIME_MEAS_EN

OS_CFG_SCHED_ROUND_ROBIN_EN

OS_CFG_STK_SIZE_MIN
OS_FLAG_ENOS_CFG_FLAG_EN
OS_FLAG_ACCEPT_EN
(6)
OS_FLAG_DEL_ENOS_CFG_FLAG_DEL_EN
OS_FLAG_WAIT_CLR_ENOS_CFG_FLAG_MODE_CLR_EN
OS_FLAG_NAME_EN
(2)
OS_FLAG_NBITS
(4)
OS_FLAG_QUERY_EN
(5)

OS_CFG_PEND_ABORT_EN
OS_MBOX_EN

OS_MBOX_ACCEPT_EN
(6)
OS_MBOX_DEL_EN

OS_MBOX_PEND_ABORT_EN

OS_MBOX_POST_EN

OS_MBOX_POST_OPT_EN

OS_MBOX_QUERY_EN
(5)
OS_MEM_ENOS_CFG_MEM_EN
OS_MEM_NAME_EN
(2)
OS_MEM_QUERY_EN
(5)
OS_MUTEX_ENOS_CFG_MUTEX_EN
OS_MUTEX_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FG_TMR_EN
OS_TMR_CFG_NAME_EN
(2)
OS_TMR_DEL_ENOS_CFG_TMR_DEL_EN

(1)  DEBUG is replaced with DBG.

(2) In µC/OS-II, all kernel objects can be assigned ASCII names after creation. In µC/OS-III, ASCII names are assigned when the object is created.

(3) In µC/OS-II, it is necessary to declare the maximum number of kernel objects (number of tasks, number of event flag groups, message queues, etc.) at compile time. In µC/OS-III, all kernel objects are allocated at run time so it is no longer necessary to specify the maximum number of these objects. This feature saves valuable RAM as it is no longer necessary to over allocate objects.

(4) In µC/OS-II, event-flag width must be declared at compile time through OS_FLAG_NBITS. In µC/OS-III, this is accomplished by defining the width (i.e., number of bits) in os_type.h through the data type OS_FLAG. The default is typically 32 bits.

(5) µC/OS-III does not provide query services to the application.

(6) µC/OS-III does not directly provide “accept” function calls as with µC/OS-II. Instead, OS???Pend() functions provide an option that emulates the “accept” functionality by specifying OS_OPT_PEND_NON_BLOCKING.

(7) In µC/OS-II, there are a number of “post” functions. The features offered are now combined in the OS???Post() functions in µC/OS-III.

(8) The µC/OS-View feature OS_TICK_STEP_EN is not present in µC/OS-III since µC/OS-View is an obsolete product and in fact, was replaced by µC/Probe.