0% found this document useful (0 votes)
10 views35 pages

Embedded System Lec - Week2

Uploaded by

c7740947d2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views35 pages

Embedded System Lec - Week2

Uploaded by

c7740947d2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Fall 2023-2024

Semester 2

Embedded Systems
Software Engineering
Point of view
Dr. Ahmed Ezz
Reference

Chapter 20
What is Embedded System
• An embedded software system is part of a hardware/software
system that reacts to events in its environment.
• The software is ‘embedded’ in the hardware.
• Embedded systems are normally real-time systems.
Embedded system characteristics
• Embedded systems generally run continuously and do not terminate.
• Interactions with the system’s environment are uncontrollable and
unpredictable.
• There may be physical limitations (e.g. power) that affect the design of a
system.
• Direct hardware interaction may be necessary.
• Issues of safety and reliability may dominate the system design.
Reactive systems
• Given a stimulus, the system must produce a
reaction or response within a specified time.

• Periodic stimuli. Stimuli which occur at predictable time intervals


• For example, a temperature sensor may be polled 10 times per second.

• Aperiodic stimuli. Stimuli which occur at unpredictable times


• For example, a system power failure may trigger an interrupt which must be
processed by the system.
Responsiveness
• Responsiveness in real-time is the critical difference between embedded systems and
other software systems, such as information systems, web-based systems or personal
software systems.

• For non-real-time systems:, correctness can be defined by specifying how system


inputs map to corresponding outputs that should be produced by the system.

• In a real-time system, the correctness depends both on the response to an input and
the time taken to generate that response. If the system takes too long to respond,
then the required response may be ineffective.
A General Model of an embedded
Real-Time System
• Sensor is a device used for the conversion of physical events or
characteristics into the electrical signals.
This is a hardware device that takes the input from environment and gives
to the system by converting it.
For example, a thermometer takes the temperature as physical
characteristic and then converts it into electrical signals for the system.
Actuator is a device that converts the electrical signals into the physical
events or characteristics.

It takes the input from the system and gives output to the environment.
For example, motors and heaters are some of the commonly used
actuators.
Sensor and actuator processes
System elements
• Sensor control processes
• Collect information from sensors. May buffer information
collected in response to a sensor stimulus.
• Data processor
• Carries out processing of collected information and
computes the system response.
• Actuator control processes
• Generates control signals for the actuators.
Real-time system modelling
• The effect of a stimulus in a real-time system may trigger a transition
from one state to another.

• State models are therefore often used to describe embedded real-time


systems.

• UML state diagrams may be used to show the states and state
transitions in a real-time system.
State machine model of a petrol (gas) pump
Real-time programming
• Programming languages for real-time systems development have to include
facilities to access system hardware, and it should be possible to predict the timing
of particular operations in these languages.

• Systems-level languages, such as C, which allow efficient code to be generated are


widely used in preference to languages such as Java.

• There is a performance overhead in object-oriented systems because extra code is


required to mediate access to attributes and handle calls to operations. The loss of
performance may make it impossible to meet real-time deadlines.
Architectural patterns for embedded systems
• Characteristic system architectures for embedded systems
• Observe and React This pattern is used when a set of sensors are routinely
monitored and displayed.
• Environmental Control This pattern is used when a system includes sensors, which
provide information about the environment and actuators that can change the
environment
• Process Pipeline This pattern is used when data has to be transformed from one
representation to another before it can be processed.
The Observe and React pattern
Name Observe and React
Description The input values of a set of sensors of the same types are collected
and analyzed. These values are displayed in some way. If the
sensor values indicate that some exceptional condition has arisen,
then actions are initiated to draw the operator’s attention to that
value and, in certain cases, to take actions in response to the
exceptional value.
Stimuli Values from sensors attached to the system.
Responses Outputs to display, alarm triggers, signals to reacting systems.
Processes Observer, Analysis, Display, Alarm, Reactor.
Used in Monitoring systems, alarm systems.
Observe and React process structure
Process structure for a burglar alarm system
The Environmental Control pattern
Name Environmental Control
Description The system analyses information from a set of sensors that collect data from
the system’s environment. Further information may also be collected on the
state of the actuators that are connected to the system. Based on the data
from the sensors and actuators, control signals are sent to the actuators that
then cause changes to the system’s environment. Information about the
sensor values and the state of the actuators may be displayed.
Stimuli Values from sensors attached to the system and the state of the system
actuators.
Responses Control signals to actuators, display information.
Processes Monitor, Control, Display, Actuator Driver, Actuator monitor.
Used in Control systems.
Environmental Control process structure
Control system architecture for an anti-skid braking system
The Process Pipeline pattern
Name Process Pipeline
Description A pipeline of processes is set up with data moving in sequence
from one end of the pipeline to another. The processes are often
linked by synchronized buffers to allow the producer and
consumer processes to run at different speeds. The culmination
of a pipeline may be display or data storage or the pipeline may
terminate in an actuator.
Stimuli Input values from the environment or some other process
Responses Output values to the environment or a shared buffer
Processes Producer, Buffer, Consumer
Used in Data acquisition systems, multimedia systems
Process Pipeline process structure
Neutron flux data acquisition
Timing analysis
• The correctness of a real-time system depends not just on the correctness
of its outputs but also on the time at which these outputs were produced.
• In a timing analysis, you calculate how often each process in the system
must be executed to ensure that all inputs are processed and all system
responses produced in a timely way.
• The results of the timing analysis are used to decide how frequently each
process should execute and how these processes should be scheduled by
the real-time operating system.
Timing requirements for the burglar alarm system
Stimulus/Response Timing requirements
Power failure The switch to backup power must be completed within a deadline of 50 ms.
Door alarm Each door alarm should be polled twice per second.
Window alarm Each window alarm should be polled twice per second.
Movement detector Each movement detector should be polled twice per second.
Audible alarm It should be switched on within half a second of an alarm being raised by a sensor.
Lights switch It should be switched on within half a second of an alarm being raised by a sensor.
Communications The call to the police should be started within 2 seconds of an alarm being raised by a
sensor.
Voice synthesizer A synthesized message should be available within 2 seconds of an alarm being raised
by a sensor.
Alarm process timing
Real-Time Operating Systems (RTOS)

• ROTS are specialised operating systems which manage the processes in the
Real Time Systems (RTS).
• Responsible for process management and resource (processor and memory)
allocation.
• May be based on a standard kernel which is used unchanged or modified for a
particular application.
• Do not normally include facilities such as file management.
Operating system components
• Real-time clock
• Provides information for process scheduling.
• Interrupt handler
• Manages aperiodic requests for service.
• Scheduler
• Chooses the next process to be run.
• Resource manager
• Allocates memory and processor resources.
• Dispatcher
• Starts process execution.
Non-stop system components
• Configuration manager
• Responsible for the dynamic reconfiguration of the system software and hardware.
• Hardware modules may be replaced and software upgraded without stopping the
systems.

• Fault manager
• Responsible for detecting software and hardware faults and taking appropriate
actions (e.g. switching to backup disks) to ensure that the system continues in
operation.
Components of a RTOS
Process priority
• The processing of some types of stimuli must sometimes take priority:
• Interrupt level priority. Highest priority which is allocated to processes
requiring a very fast response.
• Clock level priority. Allocated to periodic processes.
• Within these, further levels of priority may be assigned.
Interrupt Servicing
• Control is transferred automatically to a pre-determined memory location.

• This location contains an instruction to jump to an interrupt service routine.

• Further interrupts are disabled, the interrupt serviced and control returned to
the interrupted process.

• Notice: Interrupt service routines MUST be short, simple and fast.


Periodic process servicing
• In most real-time systems, there will be several classes of periodic process, each with
different periods (the time between executions),
execution times and deadlines (the time by which processing must be completed).
• The real-time clock ticks periodically and each tick causes an interrupt which schedules
the process manager for periodic processes.
• The process manager selects a process which is ready for execution.

You might also like