Micro-Controller Operating Systems: Difference between revisions

Content deleted Content added
m "kernal" -> "kernel"
Bender the Bot (talk | contribs)
m HTTP to HTTPS for Cornell University
 
(45 intermediate revisions by 35 users not shown)
Line 1:
{{Short description|Real-time operating system}}
{{Cleanup|reason=this article does not read like a good encyclopedia article.|date=February 2016}}
{{Infobox OS
 
| name = MicroC/OS (μC/OS)
| logo =
| caption =
| developer = Micrium, Inc.,<br/>Silicon Labs
| family =
| working state = Current
| source model = [[Open-source software|Open-source]] as of 2020
| released = {{Start date and age|1991}}
| latest release version = OS-III
| latest release date = {{Start date and age|2016}}
| repo = {{URL|https://github.com/weston-embedded/uC-OS3}}
| marketing target = [[Embedded device]]s
| programmed in = [[ANSI C]]
| language = English
| supported platforms = [[ARM Cortex-M#Cortex-M3|ARM Cortex-M3]], [[ARM Cortex-M#Cortex-M4|-M4F]], [[ARM7#ARM7TDMI|ARM7TDMI]]; [[Atmel AVR]]; [[eSi-RISC]], and many others
| kernel type = [[Real-time operating system|Real-time]] [[microkernel]]
| ui = μC/[[Graphical user interface|GUI]]
| license = [[Apache License|Apache]] as of 2020; former [[Commercial software|Commercial]], [[freeware]] education use
| website = {{URL|https://weston-embedded.com/micrium/overview}}
}}
{{Infobox OS
| name = Micrium OS
| logo =
| caption =
| developer = Silicon Labs
| family =
| working state = Current
| source model = [[Open-source software|Open-source]]
| released = {{Start date and age|2020}}
| latest release version = Part of Gecko Platform 4.2.0.0,<ref>{{cite web|url=https://www.silabs.com/documents/public/release-notes/gecko-platform-release-notes-4.2.0.0.pdf|title=Gecko Platform 4.2.0.0 GA|access-date=2023-01-04|date=2022-12-14}}</ref> part of Gecko SDK 4.2.0.0<ref>{{cite web|url=https://github.com/SiliconLabs/gecko_sdk/releases|title=gecko_sdk Releases on github.com|website=[[GitHub]] |access-date=2023-01-04}}</ref>
| latest release date = {{Start date and age|2022|12|14}}
| repo = {{URL|https://github.com/SiliconLabs/gecko_sdk/tree/gsdk_4.2/platform/micrium_os}}
| marketing target = [[Embedded device]]s
| programmed in = [[ANSI C]]
| language = English
| supported platforms = exclusively Silicon Labs silicon
| kernel type = [[Real-time operating system|Real-time]] [[microkernel]]
| license = [[Apache License|Apache]]
| website = {{URL|https://www.silabs.com/developers/micrium-os}}
}}
{{Infobox OS
| name = Cesium = MicroC/OSRTOS
| logo =
| caption =
| developer = Weston Embedded = [http://micrium.com Micrium]Solutions
| family =
| source_model = Source available
| working state = Current
| kernel_type = [[Microkernel]]
| source model = [[Commercial software|Commercial]]
| supported_platforms = [[AT91SAM#Cortex-M3 Based Microcontrollers|ARM Cortex-M3]], [[AT91SAM#Cortex-M4 Based Microcontrollers|ARM Cortex-M4F]], [[ARM7TDMI|ARM ARM7TDMI]], [[Atmel AVR]]
| released = {{Start date and age|2020|06|23}} (forked from uC/OS-III V3.08.00)<ref name=cesium_changelog>{{cite web|url=https://weston-embedded.com/cesium-release-notes/cs-os3-release-notes|title=Cs/OS3 Release Notes|publisher= Weston Embedded Solutions}}</ref>
| ui = μC/GUI
| latest release version = Cs/OS3 3.09.05<ref name=cesium_changelog />
| family = [[Real-time operating system]]s
| latest release date = {{Start date and age|2025|04|22}}<ref name=cesium_changelog />
| latest_release_version = OS-III
| marketing target = [[Embedded device]]s
| latest_release_date =
| marketing_target programmed in = [[EmbeddedANSI devicesC]]
| language = English
| programmed_in = [[ANSI C]]
| supported platforms = 50+ unclear whether there is a 1-to-1 overlap with μC/OS
| prog_language =
| kernel type = [[Real-time operating system|Real-time]] [[microkernel]]
| language =
| license = [[Commercial software|Commercial]]
| working_state = Production, stable
| website = {{URL|weston-embedded.com/products/cesium}}
| license = Commercial, free education use
| website = {{URL|www.micrium.com/products}}
}}
'''Micro-Controller Operating Systems''' ('''MicroC/OS''', stylized as '''µCμC/OS''', or '''Micrium OS''') is a [[real-time operating system]] (RTOS) designed by embedded software developer, Jean J. Labrosse in 1991. It is a priority-based [[preemptionPreemption (computing)|pre-emptivepreemptive]] [[Real-time computing|real-time]] kernel for [[microprocessor]]s, written mostly in the programming language [[C (programming language)|C]] programming language. It is intended for use in [[embedded system]]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 [[CPUcentral processing unit]] (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. ThereOS services are operating system services provided for taskmanaging management,tasks inter-taskand communicationmemory, memorycommunicating managementbetween tasks, and for timing.<ref>{{cite web|title=NiosII GCC with MicroC/OS.|websiteurl=httphttps://people.ece.cornell.edu/land/courses/ece5760/NiosII_muCOS/index.html |title=NiosII GCC with MicroC/OS |author=<!--Unstated--> |date=June 2006 |website=School of Electrical and Computer Engineering |publisher=Cornell University |access-date=25 April 2017}}</ref>
 
==History==
The MicroC/OS kernel was originally published originally in a three-part article in Embedded Systems Programming magazine and the book ''µCμC/OS The Real-Time Kernel'' by Labrosse.<ref>{{cite book |last=Labrosse |first=Jean J. Labrosse|date=15 June 2002 |title=μC/OS The Real-Time Kernel |edition=2nd |publisher=CRC Press |isbn=978-1578201037}}</ref> He intended at first to simply describe the internals of a [[Software portability|portable]] OS he had developed for his own use, but later developed it as a commercial product in his own company Micrium, Inc. in versions II and III.
(ISBN 0-87930-444-8). The author intended at first to simply describe the internals of a portable operating system he had developed for his own use, but later developed the OS as a commercial product in versions II and III.
 
In 2016 Micrium, Inc. was acquired by Silicon Laboratories<ref>{{cite web|url=https://weston-embedded.com/about-micrium|title=What is Micrium?|access-date=2023-01-04|publisher=Weston Embedded Solutions}}</ref> and it was subsequently released as open-source under the [[Apache license]].
==Writing applications under μC/OS==
Tasks running under a multitasking kernel should be written in one of two ways:<ref>
Enric Pastor.
[http://studies.ac.upc.edu/EPSC/SED/Apuntes/uCOS-II.pdf "The Real-Time Operating System uCOS-II"].
p. 14.
</ref>
 
Silicon Labs continues to maintain an open-source product named Micrium OS for use on their own silicon<ref>{{cite web|url=https://www.silabs.com/developers/micrium|title=Micrium Software and Documentation|access-date=2023-01-04}}</ref> and a group of former Micrium, Inc. employees (including Labrosse) provides consultancy and support for both μC/OS and Cesium RTOS, a proprietary fork made just after the open-source release.<ref>{{cite web|url=https://weston-embedded.com/why-cesium|title=Why Cesium RTOS?|access-date=2023-01-04|publisher= Weston Embedded Solutions}}</ref>
# A non-returning [[endless loop]].
# A task that deletes itself after running.
 
==µCμC/OS-II==
Based on the source code written for µCμC/OS, and introduced as a commercial product in 1998, µCμC/OS-II is a [[PortableSoftware object (computing)portability|portable]], ROM-able, [[scalable]], pre-emptivepreemptive, real-time, deterministic, multitasking [[Kernel (operating system)|kernel]] for [[microprocessor]]s, and [[digital signal processor]]s (DSPs). It manages up to 255 application64 tasks, and. itsIts size can be scaled (between 5 Kbytes toand 24 Kbytes) to only contain the features needed for a specificgiven use.
 
Most of µCμC/OS-II is written in highly portable [[ANSI C]], with target microprocessor-specific code written in [[assembly language]]. AssemblyUse languageof the uselatter is minimized to ease [[porting]] to other processors.
 
=== Uses in embedded systems ===
µCμC/OS-II was designed for embedded uses,. which means that ifIf the producer has the proper tool chain[[toolchain]] (i.e., C compiler, assembler, and linker/-locator{{clarify|date=May 2024}}), theyμC/OS-II can embedbe µC/OS-IIembedded as part of a product.
 
µCμC/OS-II canis be foundused in the followingmany embedded systems, including:
* [[Avionics]]
* [[Medical equipment]]/ and devices
* [[Data communications equipment]]
* White goods ([[Home appliance|applianceappliances]]s)
* [[Mobile phonesphone]]s, [[PDApersonal digital assistant]]s (PDAs), MIDs
* Industrial controls
* [[Consumer electronics]]
Line 58 ⟶ 90:
 
===Task states===
µCμC/OS-II is a [[Computer multitasking|multitasking]] operating system]]. Each task is an infinite loop and can be in any one of the following five states (Seesee figure below additionally)
*Dormant
*Ready
*Running
*Waiting (for an event)
*Interrupted ([[Interrupt handler|Interruptedinterrupt service routine]] (ISR)]])
AdditionallyFurther, it can manage up to 25564 tasks;. howeverHowever, it is recommended that a user reserve eight of these tasks be reserved for µCμC/OS-II, leaving an application up to 24756 tasks.<ref>{{cite book|last1last=Labrosse,|first1first=Jean J.|title=MicroC/OS-II: The Real Time Kernel|page=77|edition=Second2nd}}</ref>
 
===Kernels===
The [[Kernel (operating system)|kernel]] 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.<ref>[[Wikiversity:Operating Systems/Kernel Models#Monolithic Kernel]]</ref> The kernel is responsible for managing tasks (i.e., for managing the CPU's time) and communicating between tasks.<ref>{{cite book|last=Labrosse|first=Jean J.|title=MicroC/OS-II: The Real Time Kernel|page=39|edition=2nd}}</ref> The fundamental service provided by the kernel is [[context switch]]ing.
The [[Kernel (operating system)|kernel]] is responsible for task management (i.e., for managing the CPU’s time) and communication between tasks.<ref>{{cite book|last1=Labrosse,|first1=Jean J.|title=MicroC/OS-II: The Real Time Kernel|page=39|edition=Second}}</ref> The fundamental service provided by the kernel is [[context switch]]ing.
 
The [[scheduler]] is the part of the kernel responsible for determining which task runs next.<ref name="LabrosseP40">{{cite book|last1last=Labrosse,|first1first=Jean J.|title=MicroC/OS-II: The Real Time Kernel|page=40|edition=Second2nd}}</ref> 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: [[Computer multitasking#Cooperative multitasking|non-preemptive]] and [[preemptionPreemption (computing)|preemptive]]. Non-preemptiveNonpreemptive kernels require that each task do something to explicitly give up control of the CPU.<ref>{{cite book|last1name=Labrosse,|first1=Jean"LabrosseP40" J.|title=MicroC/OS-II: The Real Time Kernel|page=40|edition=Second}}</ref> A preemptive kernel is used when system responsiveness is more important;. thereforeThus, µCμC/OS-II and most commercial real-time kernels are preemptive.<ref>{{cite book|last1last=Labrosse,|first1first=Jean J.|title=MicroC/OS-II: The Real Time Kernel|page=42|edition=Second2nd}}</ref> 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]].<ref>{{cite journal|last1=Liu|first1=Chung Lang|last2=Layland|first2=James W.|title=Scheduling algorithms for multiprogramming in a hard real-time environment|journal=Journal of the ACM 20|volume=20|issue=1|pages=46–61|doi=10.1145/321738.321743|year=1973|citeseerx=10.1.1.36.8216|s2cid=59896693 }}</ref> This scheduling algorithm is used in real-time operating systems (RTOS) with a [[static-priority scheduling class]].<ref>{{cite web|last1=Bovet |first1=Daniel |title=Understanding The Linux Kernel |url=http://oreilly.com/catalog/linuxkernel/chapter/ch10.html#85347 |url-status=dead |archiveurl=https://web.archive.org/web/20140921000832/http://oreilly.com/catalog/linuxkernel/chapter/ch10.html |archivedate=2014-09-21 }}</ref>
 
===Managing tasks===
In [[computing]], a task is a unit of [[execution]]. In some [[operating systems]], a task is synonymous with a [[Process (computing)|process]], in others with a [[Thread (computing)|thread]]. In [[batch processing]] computer systems, a task is a unit of execution within a [[Job stream|job]].
The system user of µCμ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’stask's priority
*Suspend and resume a task
*Get information about a task<ref>{{cite book|last1last=Labrosse,|first1first=Jean J.|title=MicroC/OS-II: The Real Time Kernel|pages=45–49|edition=Second2nd}}</ref>
 
===Managing memory===
In order toTo avoid [[Fragmentation (computing)|fragmentation]], µCμC/OS-II allows applications to obtain fixed-sized memory blocks from a [[PartitionMemory management (Computingoperating systems)#Partitioned allocation|partition]] made of a contiguous memory area. All memory blocks are the same size, and the partition contains an [[integral]] number of blocks. Allocation and deallocation of these memory blocks is done in constant time and is a [[deterministic system]].<ref>{{cite book|last1last=Labrosse,|first1first=Jean J.|title=MicroC/OS-II: The Real Time Kernel|pages=273–285|edition=Second2nd}}</ref>
 
===Managing time===
µCμC/OS-II requires that a user provide 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 faster the tick rate;, the more [[Overhead (computing)|overhead]] µCμ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]] from an [[alternating current]] (AC) power line (50/ or 60&nbsp;Hz) signal. This periodic time source is calledtermed a clock tick.<ref>{{cite book|last1last=Labrosse,|first1first=Jean J.|title=MicroC/OS-II: The Real Time Kernel|pages=145–152|edition=Second2nd}}</ref>
 
After a ''clock tick'' is determined, tasks can be:
Line 97 ⟶ 128:
 
===Communicating between tasks===
Intertask or interprocess communication in µCμC/OS-II occurs via: [[Semaphore (programming)|semaphores]], message mailbox, message queues, tasks, and [[Interrupt handler|Interruptinterrupt service routines]] (ISR)ISRs). They can interact with each other when a task or an ISR signals a task through a kernel object called an Eventevent Controlcontrol Blockblock (ECB). The signal is considered to be an event.
 
==MicroCμC/OS-III==
µCμC/OS-III is the acronym for Micro-Controller Operating Systems Version 3, introduced in 2009 and adding functionality to the µCμ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.<ref>{{cite web |url=http://micrium.com/rtos/ucosiii/rtos-comparison/ |title=μC/OS-II and μC/OS-III Features Comparison |website=Micrium}}</ref><ref>{{cite web |url=http://micrium.com/rtos/ucosiii/overview/ |title=μC/OS-III overview |website=Micrium}}</ref>
µC/OS-III offers all the features and functions of µC/OS-II.
The biggest difference is the number of tasks.
µC/OS-II allows only 1 task at each of 255 priority levels, so a maximum of 255 tasks.
µC/OS-III allows an unlimited number of application tasks at each one of an unlimited number of priority levels, constrained only by a processor’s access to memory.<ref>
Micrium.
[http://micrium.com/rtos/ucosiii/rtos-comparison/ "µC/OS-II and µC/OS-III Features Comparison"].
</ref><ref>
Micrium.
[http://micrium.com/rtos/ucosiii/overview/ "µC/OS-III overview"].
</ref>
 
µCμC/OS-II and µCμC/OS-III are currently maintained by [http://micrium.com/ 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μC/OS-II
 
===Task states===
µCμC/OS-III is a [[Computer multitasking|multitasking]] operating system. Each task is an infinite loop and can be in any one of the following five states (Seedormant, ready, running, interrupted, or Figurepending). TaskμC/OS-III prioritiessupports canan rangeunlimited fromnumber 0of (highesttask priority)priorities but configuring μC/OS-III to ahave maximumbetween of32 255and (lowest256 possibletask priority)priorities typically suits most embedded systems well.<ref>https://media.digikey.com/PDF/Data%20Sheets/Micrium%20PDFs/UC_OS-III_RTOS.pdf#:~:text=Micrium%E2%80%99s%20%CE%BCC%2FOS-III%20supports%20ARM7%2F9%2C%20Cortex-MX%2C%20Nios-II%2C%20PowerPC%2C%20Coldfire%2C,are%20available%20for%20download%20from%20the%20Micrium%20website. {{Bare URL inline|date=August 2025}}</ref>
<!-- Deleted image removed: [[File:MicroC-OS-111 task diagram.png|center|Each task is an infinite loop and can be in any one of the following five states.]] -->
 
===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, callednamed a ''quantum'', and then selects another task. This process is calledtermed [[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μC/OS-III is the same as for µCμC/OS-II.
 
===Managing tasks===
Task management also functions the same as for µCμC/OS-II,. howeverHowever, µCμC/OS-III supports multitasking and allows thean application to have any number of tasks. The maximum number of tasks is limited by only the amount of [[Computercomputer memory|memory]] (both code and data space) available to the processor.
 
A task can be implemented via [[runviarunning to completionscheduled scheduling]]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 handledperformed in the same way as performed in µCμC/OS-II.
 
===Managing time===
µCμC/OS-III offers the same time managementmanaging features as µCμC/OS-II. It also provides services to applications so that tasks can suspend their execution for user-defined time delays. Delays are either specified by a number of either clock ticks, or hours, minutes, seconds, and [[millisecond]]s.
 
===Communicating between tasks===
It is sometimes necessary forSometimes, a task or an ISR tomust communicate information to another task, because it is ''unsafe'' for two tasks to access the same specific data or hardware resource simultaneouslyat once. This can be resolved throughvia information transfer called inter-task communication. Thisan information transfer, is calledtermed 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]]s. If two tasks share data, each can gain exclusive access to variables either by either disabling interrupts, locking the scheduler, using a [[Semaphore (programming)|semaphore]], or preferably, using a [[mutual exclusion]] semaphore. Messages can either be sent to either an intermediate object called a [[message queue]], or directly to a task, since in µCμ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. WhenWhile a task waits for a message to arrive, it does notuses consumeno CPU time.
 
==Ports==
A port involves three aspects: CPU, OS, and board specific (BSP) code. µCμC/OS-II and µCμC/OS-III have ports for most popular processors and boards in the market and are suitable for use in [[safety critical]] embedded systems such as aviation, medical systems, and nuclear installations. A μC/OS-III port consists ofinvolves writing or changing the contents of three kernel specific files: - <code>OS_CPU.H</code>, <code>OS_CPU_A.ASM</code>, and <code>OS_CPU_C.C. It is necessary to write or change the content of three CPU specific files: CPU.H, CPU_A.ASM and CPU_C.C</code>. 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 [[Transport Layer Security|SSL/TLS]] libraries such as [[wolfSSL]], which ensure security across all connections.
 
==Licensing change==
After acquisition by Silicon Labs, Micrium in 2020 changed to [[open-source model]] licensing in February 2020. This includes uC/OS III, all prior versions, all components: USB, [[file system]], GUI, TCP/IP, etc.
 
==Documentation and support==
Support is available via a typical support forum, and several comprehensive books, of which some are 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 Weston Embedded Solutions.
 
==References==
{{Reflist}}
<references/>
 
==Sources==
*[http://www.mil-embedded.com/news/db/?13968 Protocol Support for μC/OS-II from Fusion Embedded]
*{{Official website|www.micrium.com/rtos/ucosii/overview/}}
*[http://www.mil-embedded.com/news/db/?13968 Protocol Support for µC/OS-II from Fusion Embedded]
*Micrium-uCOS-III-UsersManual 1st Edition
*[http://micrium.com/download/%C2%B5cos-iii-the-real-time-kernel-for-the-renesas-rx62n/ uC/OS-III: The Real-Time Kernel for the Renesas RX62N]
 
==External links==
*{{Official website|https://web.archive.org/web/20231206170818/https://www.silabs.com/developers/micrium}}
*[http://people.ece.cornell.edu/land/courses/ece5760/NiosII_muCOS/uC_Functions.html Summary of Commonly Used uC/OS-II Functions and Data Structures]
*{{GitHub|SiliconLabs}}
*[http://people.ece.cornell.edu/land/courses/ece5760/NiosII_muCOS/index.html NiosII GCC with MicroC/OS]
*[https://people.ece.cornell.edu/land/courses/ece5760/NiosII_muCOS/uC_Functions.html Summary of Commonly Used uC/OS-II Functions and Data Structures]
*[http://www.win.tue.nl/~mholende/automotive/uCOS-II-RefMan.pdf µC/OS-II Reference Manual]
*[https://people.ece.cornell.edu/land/courses/ece5760/NiosII_muCOS/ NiosII GCC with MicroC/OS]
*[http://ftp1.digi.com/support/documentation/0220047_e.pdf How to Get a µC/OS-II Application Running]
*[http://www.farnell.com/datasheets/1950186.pdf μC/OS-II Reference Manual]
*[http://ftp1.digi.com/support/documentation/0220047_e.pdf How to Get a μC/OS-II Application Running]
 
{{Real-time operating systems}}
{{Microkernel}}
 
{{DEFAULTSORT:Microc Os-II}}
Line 173 ⟶ 200:
[[Category:Embedded operating systems]]
[[Category:ARM operating systems]]
[[Category:Microkernel-based operating systems]]
[[Category:Microkernels]]