Differences in Source File Names and Contents
he table below shows the source files used in both kernels. Note that a few of the files have the same or similar name.
µC/OS-II | µC/OS-III | Note |
---|---|---|
os_app_hooks.c | (1) | |
os_cfg_app.c | (2) | |
os_cfg_app.h | (3) | |
os_cfg_r.h | os_cfg.h | (4) |
os_core.c | os_core.c | |
os_cpu.h | os_cpu.h | (5) |
os_cpu_a.asm | os_cpu_a.asm | (5) |
os_cpu_c.c | os_cpu_c.c | (5) |
os_dbg_r.c | os_dbg.c | (6) |
os_flag.c | os_flag.c | |
os_prio.c | (7) | |
os_mbox.c | (8) | |
os_mem.c | os_mem.c | |
os_msg.c | (9) | |
os_mutex.c | os_mutex.c | |
os_q.c | os_q.c | |
os_sem.c | os_sem.c | |
os_stat.c | (10) | |
os_task.c | os_task.c | |
os_time.c | os_time.c | |
os_tmr.c | os_tmr.c | |
os_var.c | (11) | |
os_type.h | (12) | |
ucos_ii.h | os.h | (13) |
(1) µC/OS-II does not have this file, which is now provided for convenience so you can add application hooks. You should copy this file to the application directory and edit the contents of the file to satisfy your application requirements.
(2) os_cfg_app.c
did not exist in µC/OS-II. This file needs to be added to a project build for µC/OS-III.
(3) In µC/OS-II, all configuration constants were placed in os_cfg.h
. In µC/OS-III, some of the configuration constants are placed in this file, while others are in os_cfg_app.h
. os_cfg_app.h
contains application-specific configurations such as the size of the idle task stack, tick rate, and others.
(4) In µC/OS-III, os_cfg.h
is reserved for configuring certain features of the kernel. For example, are any of the semaphore services required, and will the application have fixed-sized memory partition management?
(5) These are the port files and a few variables and functions will need to be changed when using a µC/OS-II port as a starting point for the µC/OS-III port.
µC/OS-II variable changes from … | … to these in µC/OS-III |
---|---|
OSIntNesting | OSIntNestingCtr |
OSTCBCur | OSTCBCurPtr |
OSTCBHighRdy | OSTCBHighRdyPtr |
µC/OS-II function changes from … | … to these in µC/OS-III |
---|---|
OSInitHookBegin() | OSInitHook() |
OSInitHookEnd() | N/A |
OSTaskStatHook() | OSStatTaskHook() |
OSTaskIdleHook() | OSIdleTaskHook() |
OSTCBInitHook() | N/A |
OSTaskStkInit() | OSTaskStkInit() |
The name of OSTaskStkInit()
is the same but it is listed here since the code for it needs to be changed slightly as several arguments passed to this function are different. Specifically, instead of passing the top-of-stack as in µC/OS-II, OSTaskStkInit()
is passed the base address and the size of the task stack.
(6) In µC/OS-III, os_dbg.c
should always be part of the build. In µC/OS-II, the equivalent file (os_dbg_r.c) was optional.
(7) The code to determine the highest priority ready-to-run task is isolated in µC/OS-III and placed in os_prio.c
. This allows the port developer to replace this file by an assembly language equivalent file, especially if the CPU used supports certain bit manipulation instructions and a count leading zeros (CLZ) instruction.
(8) µC/OS-II provides message mailbox services. A message mailbox is identical to a message queue of size one. µC/OS-III does not have these services since they can be easily emulated by message queues.
(9) Management of messages for message queues is encapsulated in os_msg.c
in µC/OS-III.
(10) The statistics task and its support functions have been extracted out of os_core.c
and placed in os_stat.c
for µC/OS-III.
(11) All the µC/OS-III variables are instantiated in a file called os_var.c
.
(12) In µC/OS-III, the size of most data types is better adapted to the CPU architecture used. In µC/OS-II, the size of a number of these data types was assumed.
(13) In µC/OS-II, the main header file is called ucos_ii.h. In µC/OS-III, it is renamed to os.h
.