Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Porting of Micro C/OS-II kernel in ARM powered microcontroller

By D. Rajarajan, Chennai, India April 21, 2008

[[wysiwyg_imageupload:1701:]]D.RAJARAJAN Belongs from Chennai. He is Electronics and Communication Engineer and currently pursuing post graduate diploma in Embedded System at ACCEL IT Academy.


 

This Project deals with the porting of Micro C/OS-II kernel in ARM powered microcontroller for the implementation of multitasking and time scheduling. Here a real time kernel is the software that manages the time of a micro controller to ensure that all time critical events are processed as efficiently as possible.
 
We have applied advanced real-time techniques software, that are intensively used in critical areas like space research and defense applications, to realize an industrial real time parameter Monitoring System. The heart of the system is a real-time kernel that uses preemptive scheduling to achieve multitasking on hardware platform. The Arm processor gets all relevant information from one source i.e. the remote terminal section. The temperature analysis data is plotted in convenient diagram in graphical LCD. The trend of all these parameters is available with a granularity of one minute. 
kernel-in-ARM-powered-microcontroller

 Fig 1.1: Multitasking

In this project we are going to perform multitasking simultaneously. In Micro C/OS-II maximum number of task is 64, but here we going to perform up to 6 tasks the tasks like LED scrolling, alarm, temperatures sensor, graphical LCD, serial communication, relay are perform simultaneously.

 

1.1. Existing System
General-computing non-real-time operating systems are often quite non-deterministic. Their services can inject random delays into application software and thus cause slow responsiveness of an application at unexpected times. Other problems in this kind of system are single program approach (one task), power consumption problem.
1.2. Proposed System

In this paper, the proposed method is implemented on a coarse grain reconfigurable architecture with 8 and 32 processing elements. A large amount of random scenario have been simulated and the statistical results presented here clearly show real advantages of the proposed method, but also some limitations drawing the line of future works. The design of embedded systems has become more complex than ever, and the design qualities depend more on the cooperation of multidisciplinary design teams: hardware engineers and software engineers in general.

 

 

 

 

 

CHAPTER 2

EMBEDDED SYSTEM

 

An embedded system is a special-purpose computer system designed performs one or a few dedicated functions, often with real-time computing constraint [2]. In general, embedded system means the processors is embedded into that application. The majority of computer system in use today is embedded in other machinery, such as telephones, clocks, applications and vehicles.
An embedded system may have minimal requirement for memory and program length. Input and output devices may be discrete switches, relays or solenoids. An embedded controller may lack human-readable interface devices. For example, embedded systems usually don’t have keyboards, screen, disks, printers or other recognizable I/O devices of a personal computer.
Microcontrollers may control electric motors, relays, voltages and many read switches, variable resistors and other electronic devices. An embedded product uses either a microcontroller or microprocessors to do one task at a time .in an embedded system, there is only one application software that is typically burned into ROM. Example, printer, keyboard, video game player, etc…

 

2.1. Characteristics

 

       1. Embedded system is designed to do some specific task, rather than a general purpose computer for multiple tasks. Some also have real-time performance constraints that must be met, for reason such as safety and usability; others may have low or no performance requirement, allowing the system hardware to be simplified to reduce cost.
       2. Embedded systems are not always separate devices [2]. Most often they are physically built-in to the devices they control.
       3. The software written for the computer systems is often called firmware, and is stored in read-only memory or flash memory chips rather than disk drives. It often runs with limited computer hardware resources small or no keyboard, screen and little memory.

 

2.2. Real-Time Embedded Systems

In the simplest form, real-time systems can be defined as those systems that respond to external events in a timely fashion, the response time is guaranteed [4]. We revisit this definition after presenting some examples of real-time systems.
kernel-in-ARM-powered-microcontroller1

 

 

Fig 2.1: A simple view of real-time systems
External events can have synchronous or asynchronous characteristics. Responding to external events includes recognizing when an event occurs, performing the required processing as a result of the event, and outputting the necessary results within a given time constraint. Timing constraints include finish time, or both start time and finish time.
A good way to understand the relationship between real-time systems and embedded systems is to view them as two intersecting circles, as shown in. It can be seen tha0t not all embedded systems exhibit real-time behaviors nor are all real-time systems embedded. However, the two systems are not mutually exclusive, and the area in which they overlap creates the combination of systems known as real-time embedded systems.
kernel-in-ARM-powered-microcontroller3Fig 2.2: Real-time embedded systems
Knowing this fact and because we have covered the various aspects of embedded systems in the previous sections, we can now focus our attention on real-time systems.
 

2.3. Peripherals

 

Embedded system talk with the outside world via peripherals, such as
·         Serial communication interfaces (SCI): RS-232, RS-422, RS-485 etc.
·         Synchronous serial communication interfaces: 12C, JTAG, SPI, SSC, AND ESSI.
·         Universal serial bus(USB)
·         Networks: Ethernet, Controller Area Network, LAN Works etc.
·         Timers: PLL(s) capture/compare and Time Processing Units.
·         Discrete I/O: General Purpose Input/output (GPIO).
.         Analog to Digital/Digital to Analog (ADC/DAC). 

 

Top

CHAPTER 3

REAL TIME OPERATING SYSTEM
3.1. Real-Time System
•         Definition:
A real-time system (defined by IEEE) is a system whose correctness includes its response time as well as its functional correctness.
In other words, in a real-time system, it not only matters that the answers are correct, but it matters when the answers are produced.
A Late Answer is a Wrong Answer!

 

3.1.1. Real-Time Systems – Categories

 

1. Hard Real-Time Systems
2. Soft Real-Time Systems

 

Hard Real-Time Systems

 

Hard real-time means that the system (i.e., the entire system including OS, middleware, application, HW, communications, etc.) must be designed to GUARANTEE that response requirements are met. Hard Real-Time doesn’t mean fast execution. Examples:Electronic Engines, Automotive and Flight Control Systems, Medical Systems, Industrial Control Systems, Robotics.

 

Soft-Real Time Systems 

Soft real-time is exactly the same as hard real-time in its infrastructure requirements, but it is not necessary for system success that EVERY time constraint be met. Example:Telecommunication Systems, Internet Video, ATM

 

kernel-in-ARM-powered-microcontroller3

 Fig 3.1: The Real-Time Spectrum 

 

3.1.2. Real-Time Design Approaches

 

•         There are two primary techniques used in real-time designs
                        – Super- loops
                                    One program running
                        -Multitasking
                                    Many programs running, taking turns.

 

Super-Loops

        Super loops also called Foreground/Background Systems.There is a background loop that is always running anytime an ISR isn’t executing.The CPU is always busy. Small system of low complexity is generally designed as shown figure [1]. An application consists of an infinite loop that calls modules to perform the desired operation (background). Interrupt services routine handle asynchronous events (foreground). Foreground is also called interrupt level; background is called task level. Critical operation must be performed by the ISR is ensure that they are dealt with in a timely fashion. Because of this ISR have a tendency to take longer than they should. Also, information for a background module made available by an ISR is not processed until the background routine gets its turn to execute. This is called the task level response. The worst-case task level response time depends on how long the background loop takes to executes. Because of the execution time of typical code is not constant; the time for successive passes through a portion of the loop is nondeterministic.

kernel-in-ARM-powered-microcontroller4

 

Foreground/Background System

Disadvantage

  • Background response time is the background execution time
–        Non-deterministic
§ Affected by if, for, while …
–        May not be responsive enough
–        Changes as you change your code
  • All ‘tasks’/functions () have the same priority!
–        Code executes in sequence
–        If an important event occurs it’s handled at the same priority as everything else!
–        You may need to execute the same code often to avoid missing an event.

 

3.2. Introduction to RTOS

A real time operating system (RTOS) is key to many embedded systems today and, provides a software platform upon which to build applications [1]. Not all embedded systems, however, are designed with an RTOS. Some embedded systems with relatively simple hardware or a small amount of software application code might not require an RTOS. Many embedded systems, however, with moderate-to-large software applications require some form of scheduling, and these systems require an RTOS. This chapter sets the stage for all subsequent chapters in this section. It describes the key concepts upon which most real-time operating systems are based.

 

3.2.1. Defining an RTOS

A real-time operating system (RTOS) is a program that schedules execution in a timely manner, manages system resources, and provides a consistent foundation for developing application code. For example, in some applications, an RTOS comprises only a kernel, which is the core supervisory software that provides minimal logic, scheduling, and resource-management algorithms.
Although many RTOSes can scale up or down to meet application requirements, this book focuses on the common element at the heart of all RTOSes-the kernel [3]. Most RTOS kernels contain the following components:

 

kernel-in-ARM-powered-microcontroller5
 

Scheduler-is contained within each kernel and follows a set of algorithms that determines which task executes when.

Objects-are special kernel constructs that help developers create applications for real-time embedded systems. Common kernel objects include tasks, semaphores, and message queues.
Services-are operations that the kernel performs on an object or, generally operations such as timing, interrupt handling, and resource management.
Common components in an RTOS kernel that including objects, the scheduler, and some services. This diagram is highly simplified; remember that not all RTOS kernels conform to this exact set of objects, scheduling algorithms, and services.
kernel-in-ARM-powered-microcontroller6

 

 

3.3. Commercial RTOSs

C/OS-II, VxWorks, pSOS System, Nucleus, Windows CE

 

3.4. RTOS Advantages

•      Software that manages the time of a microprocessor or microcontroller
–     Ensures that the most important code runs first
•      Allows Multitasking
–     Do more than one thing at the same time
–     Application is broken down into multiple tasks, each handling one aspect of your application
–     It’s like having multiple CPUs
•      Provides valuable services to your application
–     Time delays, Resource sharing.

 

 

 

Chapter 4

C/OS-II

4.1. Why we choose Micrium µC/OS-II

 

•      Written in ANSI C
–     Source code provided
–     Consistent coding style
•      Pre-emptive
•      Deterministic
•      Royalty-free
–     Licensed on a per-end-product basis
•      Extensive Documentation and Support
•      Meets requirements of Safety-Critical Systems
•      Large user base
–     Used in hundreds of products all over the world

 

4.2. C/OS-II

 

Written by Jean J. Labrosse in ANSI C .A portable, ROMable, scalable, preemptive, real-time, multitasking kernel .Used in hundreds of products since its introduction in 1992[1] .Certified by the FAA for use in commercial aircraft .Available in ARM Firmware Suite (AFS) .Over 90 ports for free download

 

4.2.1. Overview to µC/OS-II

 

MicroC/OS-II (commonly termed µC/OS-II or uC/OS-II), is a low-cost priority-based pre-emptive real time multitasking operating system kernel for microprocessors, written mainly in the C programming language. It is mainly intended for use in embedded systems. UC/OS-II is currently maintained by Micrium Inc. and can be licensed on as per product or product line basis. Use of the operating system is free for educational non-commercial use. Additionally, Micrium provides other middleware software products such as uC/OS-View, uC/CAN, uC/TCP-IP, uC/FS, uC/GUI, uC/MOD-BUS, uC/LCD, uC/USB (Mass Storage Device and Bulk) and a large assortment of uC/TCP-IP applications such as client software for DHCP, POP3, SNTP, FTP, TFTP, DNS, SMTP, and TTCP [1]. Server software includes HTTP, FTP, and TFTP. PPP is also available.
To describes the design and implementation of µC/OS-II (pronounced “Micro C O S 2”), which stands for Microcontroller Operating System Version 2. µC/OS-II is based on µC/OS, The Real-Time Kernel that was first published in 1992. Thousands of people around the world are using µC/OS in all kinds of applications, such as cameras, medical instruments, musical instruments, engine controls, network adapters, highway telephone call boxes, ATM machines, industrial robots, and more. Numerous colleges and universities also have used µC/OS to teach students about real-time systems.
            &n

Filed Under: Electronic Projects
Tagged With: arm, kernel, microcontroller, operating system
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • How to preserve hierarchical instance names like \adder_1/U1 in flattened gate-level netlist in Design Compiler?
  • Can anyone provide a guide or tutorial for Candece simulation?
  • Voltage mode pushpull is a nonsense SMPS?
  • High Side current sensing
  • MOSFET thermal noise in Weak vs Strong inversion

RSS Electro-Tech-Online.com Discussions

  • Photo interrupter Connections
  • Is AI making embedded software developers more productive?
  • Can I make two inputs from one??
  • Why can't I breadboard this oscillator?
  • Cataract Lens Options?

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe