[go: up one dir, main page]

0% found this document useful (0 votes)
9 views61 pages

Chapter 2 and 3

The document provides an overview of embedded systems, focusing on embedded firmware as a crucial component that controls hardware peripherals and imparts intelligence to the system. It discusses the development process, design approaches like the Super loop and Embedded Operating System, and the role of various tools such as compilers, linkers, and debuggers in the software development environment. Additionally, it covers hardware components including power supply, processors, and memory types essential for embedded systems.

Uploaded by

Bereket Mebratu
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)
9 views61 pages

Chapter 2 and 3

The document provides an overview of embedded systems, focusing on embedded firmware as a crucial component that controls hardware peripherals and imparts intelligence to the system. It discusses the development process, design approaches like the Super loop and Embedded Operating System, and the role of various tools such as compilers, linkers, and debuggers in the software development environment. Additionally, it covers hardware components including power supply, processors, and memory types essential for embedded systems.

Uploaded by

Bereket Mebratu
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/ 61

Intro to Embedded Systems

11/28/2023 By Mihiretu Kebede 1


11/28/2023 By Mihiretu Kebede 2
The embedded software is usually called firmware
It is an un-avoidable part of an embedded system
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.

11/28/2023 By Mihiretu Kebede 3


 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 embedded firmware is usually stored in a permanent memory (ROM) and
it is non alterable by end users.

11/28/2023 By Mihiretu Kebede 4


 Designing Embedded firmware requires understanding of the particular
embedded product hardware, like
 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)

11/28/2023 By Mihiretu Kebede 5


 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
11/28/2023 By Mihiretu Kebede 6
 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).
 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

11/28/2023 By Mihiretu Kebede 7


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.
11/28/2023 By Mihiretu Kebede 8
The ‘C’ program code for the super loop is given below
void main ()
{
Configurations ();
Initializations ();
while (1)
{
Task 1 ();
Task 2 ();
:
:
Task n ();
}
}
11/28/2023 By Mihiretu Kebede 9
Pros:
 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
Cons:
 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)

11/28/2023 By Mihiretu Kebede 10


 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
The embedded device contains an Embedded Operating System which can
be one of:
 A Real Time Operating System (RTOS)
 A General Purpose Operating System (GPOS)

11/28/2023 By Mihiretu Kebede 11


 Real-Time Nature: RTOS is designed for real-time applications where timing
constraints are critical. Real-time systems must respond to events or inputs
within a specified time frame, and an RTOS is optimized to provide
deterministic and predictable behavior in meeting these deadlines.
 Task Scheduling: RTOS typically employs priority-based or time-driven
scheduling algorithms to ensure that tasks with higher priority or deadlines are
executed in a timely manner.
 Predictability: RTOS aims for deterministic behavior, meaning that the time it
takes to respond to an event or execute a task is predictable and meets the
specified timing requirements.
 Examples: FreeRTOS, VxWorks, QNX.
11/28/2023 By Mihiretu Kebede 12
 Versatility: GPOS is a more general-purpose operating system that is
designed to meet the needs of a wide range of applications.
 Task Scheduling: GPOS typically uses priority-based scheduling, but the
emphasis is on providing fair access to resources rather than meeting strict
timing deadlines.
 Multitasking: GPOS is well-suited for multitasking environments, allowing
multiple applications or processes to run concurrently.
 Examples: Linux, Windows, macOS

11/28/2023 By Mihiretu Kebede 13


 An RTOS is usually designed for a low end, stand alone device like an ATM,
Vending machines etc.
 RTOS is light weight and small in size compared to a GPOS.
 A GPOS is made for high end, general purpose systems like a personal
computer, a work station, a server system etc.

11/28/2023 By Mihiretu Kebede 14


 Assembly Language
 High Level Language
 Subset of C (Embedded C)
 Subset of C++ (Embedded C++)
 Any other high level language with supported Cross-compiler
 Mix of Assembly & High level Language
 Mixing High Level Language (Like C) with Assembly Code
 Mixing Assembly code with High Level Language (Like C)
 Inline Assembly

11/28/2023 By Mihiretu Kebede 15


Host:
– A computer system on which all the programming tools run
– Where the embedded software is developed, compiled, tested, debugged,
optimized, and prior to its translation into target device.
Target:
– After writing the program, compiled, assembled and linked, it is moved to
target
– After development, the code is cross-compiled, translated – cross-assembled,
linked into target processor instruction set and located into the target.

11/28/2023 By Mihiretu Kebede 16


Host System Target Computer System
Writing, editing a program, compiling it, linking it, After the completion of programming
debugging it are done on host system work, it is moved from host system to
target system.
It is also referred as Work Station No other name

Software development is done in host system for Developed software is shifted to


embedded system customer from host

Compiler, linker, assembler and debugger are used Cross compiler is also used

Unit testing on host system ensures software is By using cross compiler, unit testing
working properly allows to recompile code, execute, test on
target system
Programming centric Customer centric

11/28/2023 By Mihiretu Kebede 17


Embedded system development environment
An Integrated Development Environment (IDE) is software that assists
programmers in developing software.
IDEs normally consist of a source code editor, a compiler, a
linker/locater and usually a debugger.
Sometimes, an IDE is devoted to one specific programming language
or one (family of) specific processor or hardware

11/28/2023 By Mihiretu Kebede 18


IDE
 But more often the IDEs support multiple languages, processors, etc.
 Some commonly used IDEs for embedded systems are Keil, the GNU compiler
collection (gcc), Eclipse, Proteus.
 Usually written in C programming language.

11/28/2023 By Mihiretu Kebede 19


Editor

 A source code editor is a text editor program designed specifically for editing
source code to control embedded systems.
 It may be a standalone application or it may be built into an integrated
development environment (e.g. IDE).
 Source code editors may have features specifically designed to simplify and
speed up input of source code, such as syntax highlighting and auto complete
functionality.

11/28/2023 By Mihiretu Kebede 20


Compiler
 The job of a compiler is mainly to translate programs written in some human-
readable language into an equivalent set of opcodes for a particular processor.
 A compiler translates source code from a high level language to a lower level
language (e.g., assembly language or machine language).
 Each processor has its own unique machine language, so you need to choose a
compiler that is capable of producing programs for your specific target
processor.

11/28/2023 By Mihiretu Kebede 21


Compiler
Two types:
 A Native-compiler runs on a computer platform and produces code for that
same computer platform
 Suppose the native compiler on a Windows NT system is based on Intel
Pentium. This compiler may possible if target microprocessor is also Intel
Pentium. This is not possible if the target microprocessor is other than Intel
i.e. like MOTOROLA, Zilog etc.
 A Cross compiler is a compiler capable of creating executable code for a
platform other than the one on which the compiler is running.
 For example, a compiler that runs on a Windows 7 PC but generates code that
runs on Android smartphone is a cross compiler.
11/28/2023 By Mihiretu Kebede 22
Compiler
Regardless of the input language (C/C++, assembly, or any other),
the output of the cross-compiler will be an object file.

11/28/2023 By Mihiretu Kebede 23


Linker
 Compiler and assembler produce object files that contain both machine binary
code and program data
 A linker takes these object files and produce an executable image or an object
file for further linking
 A linker is a program that takes one or more objects generated by compilers
and assembles them into a single executable program.
 All of the object files resulting from compiling must be combined in a special
way before the program locator will produce an output file that contains a
binary image that can be loaded into the target ROM
 A commonly used linker/locater for embedded systems is GNU.

11/28/2023 By Mihiretu Kebede 24


Debugger
A debugger is a computer program that is used to test and debug
other programs
A debugger is a piece of software running on the PC, which has to be
tightly integrated with the emulator that you use to validate your
code.
A Debugger allows you to download your code to the emulator's
memory and then control all of the functions of the emulator from a
PC.

11/28/2023 By Mihiretu Kebede 25


Debugging Tools
There are several different tools you can utilize that differ greatly in
terms of development time spend and debugging features available.
In this section we take a look at simulators, and emulators.

11/28/2023 By Mihiretu Kebede 26


Debugging Tools
Simulators try to model the behavior of the complete microcontroller
in software.
Some simulators go even a step further and include the whole system
(simulation of peripherals outside of the microcontroller).
Simulators are best suited to test algorithms that run completely
within the microcontroller.

11/28/2023 By Mihiretu Kebede 27


Debugging Tools

11/28/2023 By Mihiretu Kebede 28


Debugging Tools
An emulator is a piece of software that ideally behaves exactly like
the real microcontroller chip with all its integrated functionality.
 It is the most powerful debugging tool of all. A microcontroller’s
functions are emulated in real-time.

11/28/2023 By Mihiretu Kebede 29


Debugging Tools

11/28/2023 By Mihiretu Kebede 30


11/28/2023 By Mihiretu Kebede 31
11/28/2023 By Mihiretu Kebede 32
Embedded system hardware

There are multiple components involved in the design of an


embedded system.
The components used are grouped as software components and
hardware components.
Hardware components of embedded systems are discussed in
this chapter as follows

11/28/2023 By Mihiretu Kebede 33


Embedded system hardware

11/28/2023 By Mihiretu Kebede 34


1. Power supply
For the embedded system the power supply is the key component to
provide the power to the embedded system circuit.
Usually, the embedded system requires 5 V supply
The power supply source can be battery or can be provided by a
wall adaptor.

11/28/2023 By Mihiretu Kebede 35


1. Power supply
The power supply is selected as per user requirements and
application requirements.
The power supply should be smooth and should be efficient so that
continuous power supply can be provided to an embedded system.
 The power supply should also allow dissipation and should be as
efficient as possible.

11/28/2023 By Mihiretu Kebede 36


2. Processor
For any embedded system the processor acts as the brain of the
system.
The processor is responsible for deciding the performance of the
embedded system.
In the market there are multiple types of processors available and
can be selected as per user requirement.
The embedded system can be designed using microcontroller or
microprocessor.

11/28/2023 By Mihiretu Kebede 37


2. Processor
The processor can be an 8-bit processor, a 16-bit processor, and a
32-bit processor.
The lesser the bit the smaller the application is for embedded
systems.
When large applications are used the higher bit processor is needed
in the embedded system.
The processor needs to be very fast, the price should be minimum,
performance should be good so that functions can be performed very
fast in an embedded system.

11/28/2023 By Mihiretu Kebede 38


2. Processor
A processor has two essential units −
 Program Flow Control Unit (CU)
 Execution Unit (EU)
The CU includes a fetch unit for fetching instructions from the
memory.
The EU has circuits that performs the task of executing instructions

11/28/2023 By Mihiretu Kebede 39


2. Processor
The EU includes the Arithmetic and Logical Unit (ALU) and also
the circuits that control task such as interrupt, or jump to another set
of instructions.
A processor runs the cycles of fetch and executes the instructions in
the same sequence as they are fetched from memory.

11/28/2023 By Mihiretu Kebede 40


2. Processor
Microcontroller vs Microprocessor.

11/28/2023 By Mihiretu Kebede 41


Why Micro-controller?
Low cost, small packaging
Low Power Consumption
Programmable, re-programmable
Lots of I/O Capability
Single purpose

11/28/2023 By Mihiretu Kebede 42


Architecture
vonNuman Architecture

11/28/2023 By Mihiretu Kebede 43


Architecture
Harvard Architecture

11/28/2023 By Mihiretu Kebede 44


3. Memory
In the embedded system that uses microcontrollers, the memory is
present in the microcontroller itself.
There are basically two types of memory RAM(Random access
memory) and ROM (Read-only memory).
RAM is used to store data that can be used by processors in
embedded systems.
Read-only memory is used to store code or program.

11/28/2023 By Mihiretu Kebede 45


Memory Types
A. Processor Memory
Processor memory is a group of register along with processor. They
temporarily hold the data during computation since processor and
register are fabricated with same technology and they have same
speed.
Separate memory is kept alongside the processor to keep the most
frequently needed information.
This memory is known as cache memory.

11/28/2023 By Mihiretu Kebede 46


Memory Types
B. Primary or Main Memory
This is the memory the microprocessor uses in executing and storing programs. Usually the
size of the primary memory is larger and speed is slower than the processor memory.
Primary memory can be categorized as:
 Random Access Memory (RAM)
 Read Only Memory (ROM)

11/28/2023 By Mihiretu Kebede 47


Memory Types
RAM
 RAM is read\write memory in which data can be written into and read from any selected
address in any sequence.
 A RAM is typically used for short term data storage because it cannot retain stored data
when power is turned off

11/28/2023 By Mihiretu Kebede 48


Memory Types
Types of RAM
i. Static Ram (SRAM)
 SRAM stores binary information as long as dc power is applied. It stores bit as a voltage.
 They have low packaging density but high speed and consume more power.
 SRAM is easier to use and has shorter read and write cycles
ii. Dynamic Ram (DRAM)
 DRAM consists of capacitors as a storage element and cannot retain data very long without
the capacitor being recharged by a process called refreshing. This is done by cycling
through words every few milliseconds, reading them and rewriting them.
 DRAM offers reduced power consumption and large storage capacity. The disadvantage is
that the storage capacitor cannot hold its charge over an extended period of time and will
lose the stored data bit unless its charge is refreshed periodically.

11/28/2023 By Mihiretu Kebede 49


Memory Types
Read Only Memory (ROM)
 ROM is a programmable logic device which contains permanently or semi
permanently stored data which can be read from memory but either cannot be
changed at all or cannot be changed without specialized equipment.
 The information must be specified by the designer and is them embedded into
the ROM to form the required interconnection or electronic device pattern.

11/28/2023 By Mihiretu Kebede 50


Memory Types
Types of ROM
1. The Masked ROM
MROM is permanently programmed during the manufacturing process to provide widely used
standard functions, such as popular conversions or to provide user defined functions.
Once the memory is programmed it cannot be changed. Generally, manufacturers use this
process to produce ROM in large numbers.
2. Programmable ROM
 These are un-programmed ROM. A PROM uses some type of fusing process to store bits,
in which a memory link is burn open or left intact to represent a 0 or a 1. The fusing
process is irreversible, once a PROM is programmed, it cannot be changed

11/28/2023 By Mihiretu Kebede 51


Memory Types
3. Erasable PROM
 An EPROM is an erasable PROM. An EPROM can be reprogrammed if an existing
program in the memory array is erased first.
 The basic types of erasable PROM are ultraviolet erasable PROM (UVEPROM) and the
electrically erasable PROM (EEPROM)
3.1. Ultraviolet Erasable PROM
 In UVEPROM, the programming process causes electrons to be removed from the floating
gate.
 Erasure is done by exposure of the memory array chip to high intensity ultra violet
radiation.

11/28/2023 By Mihiretu Kebede 52


Memory Types
3.2. Electrically Erasable PROM
 EEPROM, an electrically erasable PROM can be both erased and programmed with
electrical pulses.
 Since it can be both electrically written into and electrically erased, the EEPROM can be
rapidly programmed and erased in circuits for reprogramming.
 A cheaper and faster variation of the EEPROM is Flash memory

11/28/2023 By Mihiretu Kebede 53


4. Timers/counters
In some of the applications there is always a requirement of delay
that needed to provide in the application.
For example, in LED display applications which requires some
delay so that LED can be continue blinking in fixed time interval .
And for that timer and counter can be used in the embedded system.
The programming can be done in such a way so that delay can be
generated in the embedded system.
The delay time span can be decided by using the crystal oscillator
and system frequency so that delay can be generated as per user
requirement.
11/28/2023 By Mihiretu Kebede 54
5. Communication ports
The communication port is the type of interface that is used to
communicate with other types of embedded systems.
In the embedded system there is multiple types of communication
ports like UART, USB, Ethernet, RS-485, and many more.
UART and USART both are serial communication protocols which
are used for interfacing serial devices like GSM, GPS, Bluetooth , etc.
When an embedded system is used in small scale application then the
communication ports can be used from the microcontroller.
There are also serial protocols that can be used for sending data from
one system board to another board.
11/28/2023 By Mihiretu Kebede 55
6. Output and Input
 Input/output signals allow the microcontroller to control and read relays,
lamps, switches, or any other discrete device.
 More complex components, such as keypads, LCD displays, or sensors, can
also be accessed through ports.
 The input to the embedded system can be provided by the sensor or by the
user itself.
 The proper configuration needs to be done for using the input and output port.
 In the embedded system there are fixed input and output ports so that devices
can be connected to that specified ports only.
For example, P0, P1, P2, and many more.
11/28/2023 By Mihiretu Kebede 56
Microcontrollers 8051 Input/Output Ports

11/28/2023 By Mihiretu Kebede 57


Microcontrollers 8051 Input/Output Ports
 8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured
as input or output.
 Hence, total 32 input/output pins allow the microcontroller to be connected
with the peripheral devices.
 Pin configuration, i.e. the pin can be configured as 1 for input and 0 for
output as per the logic state
 Input/Output (I/O) pin − All the circuits within the microcontroller must be
connected to one of its pins except P0 port because it does not have built-in
pull-up resistors.
 Input pin − Logic 1 is applied to a bit of the P register. The output FE
transistor is turned off and the other pin remains connected to the power
supply
11/28/2023
voltage over a pull-up resistor of high resistance
By Mihiretu Kebede 58
Microcontrollers 8051 Input Output Ports
 Port 0 − The P0 (zero) port is characterized by two functions −

i. When the external memory is used then the lower address(A0-A7)byte is


applied on it, else all bits of this port are configured as input/output.
ii. When P0 port is configured as an output, then other ports consisting of pins
with built-in pull-up resistor connected by its end to 5V power supply, the
pins of this port have this resistor left out.

11/28/2023 By Mihiretu Kebede 59


Microcontrollers 8051 Input Output Ports
Port 1: P1 is a true I/O port as it doesn’t have any alternative functions as in P0,
but this port can be configured as general I/O only.
 It has a built-in pull-up resistor and is completely compatible with TTL
circuits.
Port 2: P2 is similar to P0 when the external memory is used. Pins of this port
occupy addresses intended for the external memory chip.
 This port can be used for higher address byte with addresses A8-A15. When
no memory is added then this port can be used as a general input/output port
similar to Port 1.
Port 3: In this port, functions are similar to other ports except that the logic 1
must be applied to appropriate bit of the P3 register
11/28/2023 By Mihiretu Kebede 60
End of Chapter 3

11/28/2023 By Mihiretu Kebede 61

You might also like