2. AGENDA
Introduction
Development Cycle
Operating System
Firmware Development
System Initialization
Exceptions
Design Problems
Applications
How to design
3. INTRODUCTION
Embedded systems are computing systems with tightly coupled hardware and
software integration, that are designed to perform a dedicated function.
real-time systems can be defined as those systems that respond to external
events in a timely fashion, as shown in Figure. The response time is guaranteed.
4. INTRODUCTION
Characteristics:
Speed
Power
Accuracy
Adaptability
Reliability
Energy
Security
Deciding Factors:
Application Awareness
Hardware and Software Co-Design Model
Cross-Platform Development
Software Storage and Upgradeability
5. DEVELOPMENT CYCLE
Hardware design
Manufacturing and Testing
Boot the system
Add Peripherals
Complete Boot process
Port firmware/operating system
Application development
6. OPERATING SYSTEMS
An operating system is an
interface between user and
hardware. It is responsible for
the management and coordination of activities and the
sharing of limited resources of
computer
Why ????
To do more specialized
operations such as multiprocessing, interfacing
complicated devices
Utilizing processing power
Making generic for different
architecture (e.g ARM, X86,
Power PC and more)
7. RTOS
A real-time operating system (RTOS)
is an operating system (OS) intended
to serve real-time application
requests.
It must be able to process data as it
comes in, typically without buffering
delays.
Processing time requirements
(including any OS delay) are
measured in tenths of seconds or
shorter.
Design Philosophies
Event-driven which switches tasks only
when an event of higher priority
needs servicing, called preemptive
priority, or priority scheduling.
Time-sharing designs switch tasks on a
regular clocked interrupt, and on
events, called round robin.
14. PRIORITY INVERSION ISSUES
Priority Inversion Avoidance
Priority inversion commonly happens in poorly designed real-time embedded applications. Priority
inversion occurs when a higher priority task is blocked and is waiting for a resource being used by
a lower priority task, which has itself been preempted by an unrelated medium-priority task. In this
situation, the higher priority task’s priority level has effectively been inverted to the lower priority
task’s level.
Enabling certain protocols that are typically built into mutexes can help avoid priority inversion.
Two common protocols used for avoiding priority inversion include:
priority inheritance protocol—ensures that the priority level of the lower priority task that
has acquired the mutex is raised to that of the higher priority task that has requested the
mutex when inversion happens. The priority of the raised task is lowered to its original
value after the task releases the mutex that the higher priority task requires.
ceiling priority protocol—ensures that the priority level of the task that acquires the mutex
is automatically set to the highest priority of all possible tasks that might request that
mutex when it is first acquired until it is released.
15. SEMAPHORE
A semaphore (sometimes called a semaphore token) is a kernel
object that one or more threads of execution can acquire or
release for the purposes of synchronization or mutual exclusion.
Binary Semaphores
Counting Semaphores
Mutual Exclusion (Mutex) Semaphore
16. BINARY SEMAPHORE
A binary semaphore can have a value of either 0 or 1. When a
binary semaphore’s value is 0, the semaphore is considered
unavailable (or empty); when the value is 1, the binary
semaphore is considered available (or full )
17. COUNTING SEMAPHORE
A counting semaphore uses a count to allow it to be acquired or released
multiple times. When creating a counting semaphore, assign the
semaphore a count that denotes the number of semaphore tokens it has
initially. If the initial count is 0, the counting semaphore is created in the
unavailable state. If the count is greater than 0, the semaphore is created
in the available state, and the number of tokens it has equals its count
18. MUTUAL EXCLUSION SEMAPHORE
A mutual exclusion (mutex) semaphore is a special binary semaphore that supports
ownership, recursive access, task deletion safety, and one or more protocols for
avoiding problems inherent to mutual exclusion
19. MESSAGE QUEUE
A message queue is a buffer-like object through which tasks and ISRs send and
receive messages to communicate and synchronize with data. A message queue
is like a pipeline. It temporarily holds messages from a sender until the intended
receiver is ready to read them. This temporary buffering decouples a sending and
receiving task; that is, it frees the tasks from having to send and receive messages
simultaneously.
21. EVENT REGISTERS
event register, is an object belonging to a task and consists of a group of binary
event flags used to track the occurrence of specific events.
Depending on a given kernel’s implementation of this mechanism, an event
register can be 8-, 16-, or 32-bits wide, maybe even more. Each bit in the event
register is treated like a binary flag (also called an event flag) and can be either set
or cleared.
22. APPLICATION MODULARIZATION
1. system requirements,
2. inputs and outputs,
3. real-time deadlines,
4. events and event response times,
5. event arrival patterns and frequencies,
6. required objects and other components,
7. tasks that need to be concurrent,
8. system schedulability, and
9. useful or needed synchronization protocols for inter-task communications
24. FIRMWARE DEVELOPMENT
Firmware is a combination of software and hardware. ROMs,
PROMs and EPROMs that have data or programs recorded on
them are firmware.
Design Elements
System setup
ELF object file
Memory Map
Linker Description
mapping the executable image / image scatter
26. ELF OBJECT FILE
Figure illustrates how
different tools take various
input files and generate
appropriate output files to
ultimately be used in
building an executable
image
general information about
the object file, such as file
size, binary code and data
size, and source file name
from which it was created,
machine-architecturespecific binary instructions
and data
symbol table and the symbol
relocation table
debug information, which
the debugger uses.
30. MAPPING AN IMAGE
The SECTION command in
the linker command file
instructs the linker to
combine the input section
named my_section and the
default .text sections from all
object files into the final
output .text section.
SECTION {
.text : {
my_section *(.text)
}
loader : > FLASH
GROUP ALIGN (4) : {
.text,
.data : {}
.bss : {}
} >RAM
}
31. SYSTEM INITIALIZATION
Questions to resolve
how to load the image onto the target system,
where in memory to load the image,
how to initiate program execution, and
how the program produces recognizable output.
Focused Areas:
ROM Image execution
ROM & RAM Image execution
image transfer from the host to the target system,
the embedded system booting process
ISR Handling
42. DEADLOCKS
Mutual exclusion-A resource can be accessed by only one task at a time,
i.e., exclusive access mode.
No preemption-A non-pre emptible resource cannot be forcibly removed
from its holding task. A resource becomes available only when its holder
voluntarily relinquishes claim to the resource.
Hold and wait-A task holds already-acquired resources, while waiting for
additional resources to become available.
Circular wait-A circular chain of two or more tasks exists, in which each task
holds one or more resources being requested by a task next in the chain