Table C-2 The 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_int.c
...
(7)
...
os_pend_multi.c
...
(8)
...
os_prio.c
...
(9)
...
os_mbox.c
...
(10)
...
os_mem.c
...
os_mem.c
...
os_msg.c
...
(11)
...
os_mutex.c
...
os_mutex.c
...
os_q.c
...
os_q.c
...
os_sem.c
...
os_sem.c
...
os_stat.c
...
(12)
...
os_task.c
...
os_task.c
...
os_time.c
...
os_time.c
...
os_tmr.c
...
os_tmr.c
...
os_var.c
...
(13)
...
os_type.h
...
(14)
...
ucos_ii.h
...
os.h
...
(15)
Table C-2 µC/OS-II and µC/OS-III files
TC-2(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.
TC-2(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.
TC-2(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.
TC-2(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?
TC-2(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 |
|
|
|
|
|
|
µC/OS-II function changes from … | … to these in µC/OS-III |
|
|
| N/A |
|
|
|
|
| N/A |
|
|
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.
TC-2(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.
TC-2(7) os_int.c
contains the code for the Interrupt Queue handler, which is a new feature in µC/OS-III, allowing post calls from ISRs to be deferred to a task-level handler. This is done to reduce interrupt latency (see Chapter 9, “Interrupt Management”).
TC-2(8) Both kernels allow tasks to pend on multiple kernel objects. In µC/OS-II, this code is found in os_core.c
, while in µC/OS-III, the code is placed in a separate file, os_pend_multi.c
.
TC-2(9) 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.
TC-2(10) µ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.
TC-2(11) Management of messages for message queues is encapsulated in os_msg.c
in µC/OS-III.
TC-2(12) 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.
TC-2(13) All the µC/OS-III variables are instantiated in a file called os_var.c
.
TC-2(14) 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.
TC-2(15) In µC/OS-II, the main header file is called ucos_ii.h. In µC/OS-III, it is renamed to os.h
.