HOME

TheInfoList



OR:

Micro-Controller Operating Systems (MicroC/OS, stylized as μC/OS) is a
real-time operating system A real-time operating system (RTOS) is an operating system (OS) for real-time applications that processes data and events that have critically defined time constraints. An RTOS is distinct from a time-sharing operating system, such as Unix, which m ...
(RTOS) designed by Jean J. Labrosse in 1991. It is a priority-based preemptive
real-time Real-time or real time describes various operations in computing or other processes that must guarantee response times within a specified time (deadline), usually a relatively short time. A real-time process is generally one that happens in defined ...
kernel for
microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circ ...
s, written mostly in the programming language C. It is intended for use in
embedded system An embedded system is a computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is ''embedded ...
s. MicroC/OS allows defining several functions in C, each of which can execute as an independent thread or task. Each task runs at a different priority, and runs as if it owns the
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
(CPU). Lower priority tasks can be preempted by higher priority tasks at any time. Higher priority tasks use operating system (OS) services (such as a delay or event) to allow lower priority tasks to execute. OS services are provided for managing tasks and memory, communicating between tasks, and timing.


History

The MicroC/OS kernel was published originally in a three-part article in Embedded Systems Programming magazine and the book ''μC/OS The Real-Time Kernel'' by Labrosse. He intended at first to simply describe the internals of a
portable Portable may refer to: General * Portable building, a manufactured structure that is built off site and moved in upon completion of site and utility work * Portable classroom, a temporary building installed on the grounds of a school to provide ...
OS he had developed for his own use, but later developed it as a commercial product in versions II and III.


μC/OS-II

Based on the source code written for μC/OS, and introduced as a commercial product in 1998, μC/OS-II is a
portable Portable may refer to: General * Portable building, a manufactured structure that is built off site and moved in upon completion of site and utility work * Portable classroom, a temporary building installed on the grounds of a school to provide ...
, ROM-able,
scalable Scalability is the property of a system to handle a growing amount of work by adding resources to the system. In an economic context, a scalable business model implies that a company can increase sales given increased resources. For example, a ...
, preemptive, real-time, deterministic, multitasking
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learn ...
for
microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circ ...
s, and
digital signal processor A digital signal processor (DSP) is a specialized microprocessor chip, with its architecture optimized for the operational needs of digital signal processing. DSPs are fabricated on MOS integrated circuit chips. They are widely used in audio s ...
s (DSPs). It manages up to 64 tasks. Its size can be scaled (between 5 and 24 Kbytes) to only contain the features needed for a given use. Most of μC/OS-II is written in highly portable
ANSI C ANSI C, ISO C, and Standard C are successive standards for the C programming language published by the American National Standards Institute (ANSI) and ISO/IEC JTC 1/SC 22/WG 14 of the International Organization for Standardization (ISO) and th ...
, with target microprocessor-specific code written in
assembly language In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence b ...
. Use of the latter is minimized to ease
porting In software engineering, porting is the process of adapting software for the purpose of achieving some form of execution in a computing environment that is different from the one that a given program (meant for such execution) was originally desi ...
to other processors.


Uses in embedded systems

μC/OS-II was designed for embedded uses. If the producer has the proper tool chain (i.e., C compiler, assembler, and linker-locator), μC/OS-II can be embedded as part of a product. μC/OS-II is used in many embedded systems, including: *
Avionics Avionics (a blend of ''aviation'' and ''electronics'') are the electronic systems used on aircraft. Avionic systems include communications, navigation, the display and management of multiple systems, and the hundreds of systems that are fit ...
*
Medical equipment A medical device is any device intended to be used for medical purposes. Significant potential for hazards are inherent when using a device for medical purposes and thus medical devices must be proved safe and effective with reasonable assura ...
and devices *
Data communications equipment A data circuit-terminating equipment (DCE) is a device that sits between the data terminal equipment (DTE) and a data transmission circuit. It is also called data communication(s) equipment and data carrier equipment. Usually, the DTE device is ...
* White goods ( appliances) *
Mobile phone A mobile phone, cellular phone, cell phone, cellphone, handphone, hand phone or pocket phone, sometimes shortened to simply mobile, cell, or just phone, is a portable telephone that can make and receive calls over a radio frequency link whi ...
s,
personal digital assistant A personal digital assistant (PDA), also known as a handheld PC, is a variety mobile device which functions as a personal information manager. PDAs have been mostly displaced by the widespread adoption of highly capable smartphones, in part ...
s (PDAs), MIDs * Industrial controls *
Consumer electronics Consumer electronics or home electronics are electronic ( analog or digital) equipment intended for everyday use, typically in private homes. Consumer electronics include devices used for entertainment, communications and recreation. Usuall ...
* Automotive


Task states

μC/OS-II is a multitasking operating system. Each task is an infinite loop and can be in any one of the following five states (see figure below additionally) *Dormant *Ready *Running *Waiting (for an event) *Interrupted ( interrupt service routine (ISR)) Further, it can manage up to 64 tasks. However, it is recommended that eight of these tasks be reserved for μC/OS-II, leaving an application up to 56 tasks.


Kernels

The
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learn ...
is the name given to the program that does most of the housekeeping tasks for the operating system. The boot loader hands control over to the kernel, which initializes the various devices to a known state and makes the computer ready for general operations. The kernel is responsible for managing tasks (i.e., for managing the CPU's time) and communicating between tasks. The fundamental service provided by the kernel is
context switch In computing, a context switch is the process of storing the state of a process or thread, so that it can be restored and resume execution at a later point, and then restoring a different, previously saved, state. This allows multiple processe ...
ing. The scheduler is the part of the kernel responsible for determining which task runs next. Most real-time kernels are priority based. In a priority-based kernel, control of the CPU is always given to the highest priority task ready to run. Two types of priority-based kernels exist: non-preemptive and preemptive. Nonpreemptive kernels require that each task do something to explicitly give up control of the CPU. A preemptive kernel is used when system responsiveness is more important. Thus, μC/OS-II and most commercial real-time kernels are preemptive. The highest priority task ready to run is always given control of the CPU.


Assigning tasks

Tasks with the highest rate of execution are given the highest priority using
rate-monotonic scheduling In computer science, rate-monotonic scheduling (RMS) is a priority assignment algorithm used in real-time operating systems (RTOS) with a static-priority scheduling class. The static priorities are assigned according to the cycle duration of the job ...
. This scheduling algorithm is used in real-time operating systems (RTOS) with a static-priority scheduling class.


Managing tasks

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, a task is a unit of
execution Capital punishment, also known as the death penalty, is the state-sanctioned practice of deliberately killing a person as a punishment for an actual or supposed crime, usually following an authorized, rule-governed process to conclude that ...
. In some
operating systems An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
, a task is synonymous with a process, in others with a thread. In
batch processing Computerized batch processing is a method of running software programs called jobs in batches automatically. While users are required to submit the jobs, no other interaction by the user is required to process the batch. Batches may automatically ...
computer systems, a task is a unit of execution within a job. The system user of μC/OS-II is able to control the tasks by using the following features: *Task feature *Task creation *Task stack & stack checking *Task deletion *Change a task's priority *Suspend and resume a task *Get information about a task


Managing memory

To avoid fragmentation, μC/OS-II allows applications to obtain fixed-sized memory blocks from a partition made of a contiguous memory area. All memory blocks are the same size, and the partition contains an
integral In mathematics, an integral assigns numbers to functions in a way that describes displacement, area, volume, and other concepts that arise by combining infinitesimal data. The process of finding integrals is called integration. Along with ...
number of blocks. Allocation and deallocation of these memory blocks is done in constant time and is a
deterministic system In mathematics, computer science and physics, a deterministic system is a system in which no randomness is involved in the development of future states of the system. A deterministic model will thus always produce the same output from a given ...
.


Managing time

μC/OS-II requires that a periodic time source be provided to keep track of time delays and timeouts. A tick should occur between 10 and 1000 times per second, or
Hertz The hertz (symbol: Hz) is the unit of frequency in the International System of Units (SI), equivalent to one event (or cycle) per second. The hertz is an SI derived unit whose expression in terms of SI base units is s−1, meaning that o ...
. The faster the tick rate, the more overhead μC/OS-II imposes on the system. The frequency of the clock tick depends on the desired tick resolution of an application. Tick sources can be obtained by dedicating a hardware timer, or by generating an
interrupt In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted, ...
from an
alternating current Alternating current (AC) is an electric current which periodically reverses direction and changes its magnitude continuously with time in contrast to direct current (DC) which flows only in one direction. Alternating current is the form in whic ...
(AC) power line (50 or 60 Hz) signal. This periodic time source is termed a clock tick. After a ''clock tick'' is determined, tasks can be: *Delaying a task *Resume a delayed task


Communicating between tasks

Intertask or interprocess communication in μC/OS-II occurs via: semaphores, message mailbox, message queues, tasks, and interrupt service routines (ISRs). They can interact with each other when a task or an ISR signals a task through a kernel object called an event control block (ECB). The signal is considered to be an event.


μC/OS-III

μC/OS-III is the acronym for Micro-Controller Operating Systems Version 3, introduced in 2009 and adding functionality to the μC/OS-II RTOS. μC/OS-III offers all of the features and functions of μC/OS-II. The biggest difference is the number of supported tasks. μC/OS-II allows only 1 task at each of 255 priority levels, for a maximum of 255 tasks. μC/OS-III allows any number of application tasks, priority levels, and tasks per level, limited only by processor access to memory. μC/OS-II and μC/OS-III are currently maintained by Micrium, Inc., a subsidiary of Silicon Labs, and can be licensed per product or per product line.


Uses in embedded systems

The uses are the same as for μC/OS-II


Task states

μC/OS-III is a multitasking operating system. Each task is an infinite loop and can be in any one of five states (dormant, ready, running, interrupted, or pending). Task priorities can range from 0 (highest priority) to a maximum of 255 (lowest possible priority).


Round robin scheduling

When two or more tasks have the same priority, the kernel allows one task to run for a predetermined amount of time, named a ''quantum'', and then selects another task. This process is termed round robin scheduling or time slicing. The kernel gives control to the next task in line if: *The current task has no work to do during its time slice, or *The current task completes before the end of its time slice, or *The time slice ends.


Kernels

The kernel functionality for μC/OS-III is the same as for μC/OS-II.


Managing tasks

Task management also functions the same as for μC/OS-II. However, μC/OS-III supports multitasking and allows an application to have any number of tasks. The maximum number of tasks is limited by only the amount of computer memory (both code and data space) available to the processor. A task can be implemented viarunning to scheduled completion, in which the task deletes itself when it is finished, or more typically as an infinite loop, waiting for events to occur and processing those events.


Managing memory

Memory management is performed in the same way as in μC/OS-II.


Managing time

μC/OS-III offers the same time managing features as μC/OS-II. It also provides services to applications so that tasks can suspend their execution for user-defined time delays. Delays are specified by a number of either clock ticks, or hours, minutes, seconds, and
millisecond A millisecond (from '' milli-'' and second; symbol: ms) is a unit of time in the International System of Units (SI) equal to one thousandth (0.001 or 10−3 or 1/1000) of a second and to 1000 microseconds. A unit of 10 milliseconds may be calle ...
s.


Communicating between tasks

Sometimes, a task or ISR must communicate information to another task, because it is ''unsafe'' for two tasks to access the same specific data or hardware resource at once. This can be resolved via an information transfer, termed inter-task communication. Information can be communicated between tasks in two ways: through global data, or by sending messages. When using global variables, each task or ISR must ensure that it has exclusive access to variables. If an ISR is involved, the only way to ensure exclusive access to common variables is to disable
interrupt In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted, ...
s. If two tasks share data, each can gain exclusive access to variables by either disabling interrupts, locking the scheduler, using a
semaphore Semaphore (; ) is the use of an apparatus to create a visual signal transmitted over distance. A semaphore can be performed with devices including: fire, lights, flags, sunlight, and moving arms. Semaphores can be used for telegraphy when arr ...
, or preferably, using a
mutual exclusion In computer science, mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions. It is the requirement that one thread of execution never enters a critical section while a concurren ...
semaphore. Messages can be sent to either an intermediate object called a
message queue In computer science, message queues and mailboxes are software-engineering components typically used for inter-process communication (IPC), or for inter- thread communication within the same process. They use a queue for messaging – the ...
, or directly to a task, since in μC/OS-III, each task has its own built-in message queue. Use an external message queue if multiple tasks are to wait for messages. Send a message directly to a task if only one task will process the data received. While a task waits for a message to arrive, it uses no CPU time.


Ports

A port involves three aspects: CPU, OS, and board specific (BSP) code. μC/OS-II and μC/OS-III have ports for most popular processors and boards in the market and are suitable for use in
safety critical A safety-critical system (SCS) or life-critical system is a system whose failure or malfunction may result in one (or more) of the following outcomes: * death or serious injury to people * loss or severe damage to equipment/property * environme ...
embedded systems such as aviation, medical systems, and nuclear installations. A μC/OS-III port involves writing or changing the contents of three kernel specific files: OS_CPU.H, OS_CPU_A.ASM, and OS_CPU_C.C. Finally create or change a board support package (BSP) for the evaluation board or target board being used. A μC/OS-III port is similar to a μC/OS-II port. There are significantly more ports than listed here, and ports are subject to continuous development. Both μC/OS-II and μC/OS-III are supported by popular SSL/TLS libraries such as
wolfSSL wolfSSL is a small, portable, embedded SSL/TLS library targeted for use by embedded systems developers. It is an open source implementation of TLS (SSL 3.0, TLS 1.0, 1.1, 1.2, 1.3, and DTLS 1.0, 1.2, and 1.3) written in the C programming langua ...
, which ensure security across all connections.


Licensing change

After acquisition by Silicon Labs, Micrium in 2020 changed to
open-source model Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
licensing in February 2020. This includes uC/OS III, all prior versions, all components: USB,
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
, GUI, TCP/IP, etc.


Documentation and support

Support is available via a typical support forum, and several comprehensive books, several tailored to a given microcontroller architecture and development platform, as free PDFs, or as low-cost purchase in hard-cover. Paid support is available from Micrium and other parties.


References


Sources


Protocol Support for μC/OS-II from Fusion Embedded
*Micrium-uCOS-III-UsersManual 1st Edition
uC/OS-III: The Real-Time Kernel for the Renesas RX62N


External links

* *

* ttp://people.ece.cornell.edu/land/courses/ece5760/NiosII_muCOS/ NiosII GCC with MicroC/OSbr>μC/OS-II Reference ManualHow to Get a μC/OS-II Application Running
{{DEFAULTSORT:Microc Os-II Real-time operating systems Embedded operating systems ARM operating systems Microkernel-based operating systems Microkernels