Embedded Systems: Unit 3
Embedded Systems: Unit 3
Disadvantages
3. Failure in execution of single task will lead to total system failure
4. While execution if program hangs, then controller will be in hanging state forever
5. Require Watchdog timer to reset during system failure
THE EMBEDDED OPERATING SYSTEM (OS) BASED APPROACH
Introduction:
Embedded Firmware
The control algorithm (Program instructions) and or the configuration settings that an embedded
system developer dumps into the code (Program) memory of the embedded system
It is an un-avoidable part of an embedded system.
The embedded firmware can be developed in various methods like
o Write the program in high level languages like Embedded C/C++ using an Integrated Development
Environment (The IDE will contain an editor, compiler, linker, debugger, simulator etc. IDEs are
different for different family of processors/controllers.
o Write the program in Assembly Language using the Instructions Supported by your application’s
target processor/controller
Embedded Firmware Design & Development:
The embedded firmware is responsible for controlling the various peripherals of the embedded
hardware and generating response in accordance with the functional requirements of the product.
The embedded firmware is the master brain of the embedded system. The embedded firmware imparts
intelligence to an Embedded system. It is a onetime process and it can happen at any stage.
The product starts functioning properly once the intelligence imparted to the product by embedding
the firmware in the hardware.
The product will continue serving the assigned task till hardware breakdown occurs or a corruption in
embedded firmware.
In case of hardware breakdown , the damaged component may need to be replaced and for firmware
corruptions the firmware should be re-loaded, to bring back the embedded product to the normal
functioning.
The embedded firmware is usually stored in a permanent memory (ROM) and it is non alterable by end
users.
Designing Embedded firmware requires understanding of the particular embedded product hardware,
like various component interfacing, memory map details, I/O port details, configuration and register
details of various hardware chips used and some programming language (either low level Assembly
Language or High level language like C/C++ or a combination of the two)
The embedded firmware development process starts with the conversion of the firmware requirements
into a program model using various modeling tools.
The firmware design approaches for embedded product is purely dependent on the complexity of the
functions to be performed and speed of operation required.
There exist two basic approaches for the design and implementation of embedded firmware,
namely;
The Super loop based approach
The Embedded Operating System based approach
The decision on which approach needs to be adopted for firmware development is purely
dependent on the complexity and system requirements
Embedded firmware Design Approaches – The Super loop:
The Super loop based firmware development approach is Suitable for applications that are not time
critical and where the response time is not so important (Embedded systems where missing
deadlines are acceptable).
It is very similar to a conventional procedural programming where the code is executed task by task
The tasks are executed in a never ending loop.
The task listed on top on the program code is executed first and the tasks just below the top are
executed after completing the first task
A typical super loop implementation will look like:
1. Configure the common parameters and perform
initialization for various hardware components memory,
registers etc.
2. Start the first task and execute it
3. Execute the second task
4. Execute the next task 5. :
6. :
7. Execute the last defined task
8. Jump back to the first task and follow the same flow.
The ‘C’ program code for the super loop is given below void
main ()
{
Configurations (); Initializations ();
while (1)
{
Task 1 ();
Task 2 ();
:
:
Task n ();
}
}
Pros:
Cons:
Doesn’t require an Operating System for task scheduling and monitoring and free from OS related
overheads
Simple and straight forward design Reduced memory footprint
Non Real time in execution behavior (As the number of tasks increases the frequency at which a
task gets CPU time for execution also increases)
Any issues in any task execution may affect the functioning of the product (This can be effectively
tackled by using Watch Dog Timers for task execution monitoring)
Enhancements:
Combine Super loop based technique with interrupts
Execute the tasks (like keyboard handling) which require Real time attention as Interrupt Service
routines.
2. Embedded firmware Design Approaches – Embedded OS based Approach:
The embedded device contains an Embedded Operating System which can be one of:
A Real Time Operating System (RTOS)
A Customized General Purpose Operating System (GPOS)
The Embedded OS is responsible for scheduling the execution of user tasks and the allocation of system
resources among multiple tasks
It Involves lot of OS related overheads apart from managing and executing user defined tasks
Microsoft® Windows XP Embedded is an example of GPOS for embedded devices
Point of Sale (PoS) terminals, Gaming Stations, Tablet PCs etc are examples of embedded devices running
on embedded GPOSs
‘Windows CE’, ‘Windows Mobile’,‘QNX’, ‘VxWorks’, ‘ThreadX’, ‘MicroC/OS-II’, ‘Embedded Linux’, ‘Symbian’
etc are examples of RTOSs employed in Embedded Product development
Mobile Phones, PDAs, Flight Control Systems etc are examples of embedded devices that runs on RTOSs
Embedded firmware Development Languages/Options
Assembly Language High Level Language
o Subset of C (Embedded C)
o Subset of C++ (Embedded C++)
o Any other high level language with supported Cross-compiler