Upload
boopathy-prabhaharan
View
215
Download
4
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
EMBEDDED SYSTEMS AND ITS
APPLICATIONS
Boopathy Prabhaharan A
AGENDA
Introduction Development Cycle Operating System Firmware Development System Initialization Exceptions Design Problems Applications How to design
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.
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
DEVELOPMENT CYCLE Hardware design Manufacturing and Testing Boot the system Add Peripherals Complete Boot process Port firmware/operating system Application development
OPERATING SYSTEMS An operating system is an
interface between user and hardware. It is responsible for the management and co-ordination of activities and the sharing of limited resources of computer
Why ???? To do more specialized
operations such as multi-processing, interfacing complicated devices
Utilizing processing power Making generic for different
architecture (e.g ARM, X86, Power PC and more)
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.
RTOS Threads/Task Scheduler Semaphore Mutex Message Queue Event Registers Timers
THREADS/TASK
THREADS/TASK STATES
Blocked Ready Running Suspended etc….
THREADS/TASK CONTEXT SWITCHING
SCHEDULER
Priority based Priority inversion
Priority inheritance
Time sharing based
PRIORITY INVERSION
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.
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
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 )
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
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
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.
MESSAGE QUEUE STATES
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.
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
VENDORS
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
SYSTEM SETUP
Host Resident Software – Cross Compiler Target Resident Software – Firmware/Binary
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-architecture-specific binary instructions and data
symbol table and the symbol relocation table
debug information, which the debugger uses.
ELF OBJECT FILE
E.g. Code
char foo_bar=10;
extern void func_a(void);
Static void func_X(void){
_nop();}
void do_it(void){
func_X();}
MEMORY { ROM: origin = 0x0000h, length = 0x0020h FLASH: origin = 0x0040h, length = 0x1000h RAM: origin = 0x1000h, length = 0x10000h }
MEMORY MAP
COMBINING AN IMAGE
Sections .text
.data/.rw
.bss/.zi
User defined
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
}
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
BOOT STRAP
ROM IMAGE EXECUTION
ROM &RAM IMAGE EXECUTION
HOST IMAGE TRANSFER
BOOTING PROCESS
ISR MECHANISM
ISR HANDLING
ISR HANDLING
ISR RESPONSE TIME
DESIGN PROBLEMS
resource classification,
resource request models,
definition of deadlocks,
deadlock detection, recovery, avoidance and prevention
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
APPLICATION
Automotive
Telecommunication
Healthcare
Entertainment
Industrial automation
Security … etc…
HOW TO DESIGN ???
?
THANK YOU