MP Ppts & Notes
MP Ppts & Notes
EMBEDDED SYSTEMS -
AN INTRODUCTION
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
1. INTRODUCTION
• Today World is becoming more and more technology enabled and so the word
“Embedded Systems” becoming more familiar and widely used.
• Embedded systems are the one that uses electronics along with sensors and actuators.
• So, the world of embedded systems encompasses almost all the technological marvels
we see today.
• We can even say, any high-end machinery that has electronics control is considered to be
part of the world embedded systems, just as a small hand-held electronic device.
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
5. Many of the are part of a bigger systems- for example, washing machines,
refrigerators, automobiles etc. are all controlled by embedded electronics.
6. Many of them have to operate and produce results within a stipulated time. Thus, we
say that some of them need to do time critical computations.
7. Application wise- the domain is very fast. Some of them are placed in inaccessible
areas, such as forests, some in extreme climatic conditions like case of military and
space applications. Some will be very simple, as Temperature sensors, pedometers
etc..
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
III. APPLICATIONS
Lets have some few examples for Embedded Systems
1. Mobile Phones & Tablets: The range of smartphones and tablets available in the
market is very large. The design of these devices satisfy all the criteria for being
labelled as embedded systems
2. Consumer electronics and Household Appliances: This is also a very important
category. Cameras, Music Players, DVD players, remote controls, washing
machines, refrigerators and many more.
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
APPLICATIONS CONTD….
3. Automotive Controls: This is the largest application field for embedded systems.
It has electronic controls for engine, fuel system, windows, door, etc.. More
advanced automobiles have navigation, parking assistance, cruise control,
driverless cars.
4. Other fields applications are banking (ATMs, Currency Counters) Aviation and
Military,Toys and Robotics.
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
• Some embedded applications are time critical, such as ABS (Anti-Braking System) in cars.
• Even soft drink vending machine works on deadline, which the application has to produce
the correct result.
• If not, we say that the system failure has occurred.
• In order to manage that, it needs RTOS (Real Time Operating System) which imposes and
ensures the timing criterion.
• An RTOS uses deadline-based task scheduling algorithm.
• So, most of the embedded systems around us is managed and controlled by RTOS.
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
VI. CONNECTIVITY
• We live in a connected world where we use various
protocols for communications.
• Next is already on its way is the idea of connectivity
between devices without human intervention.
• The expectation is all devices will be connected
through the internet and that many functions will be
able to function efficiently without human intervention.
This expectation is the motivation behind the idea named Internet of Things (IoT)
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
• IoT is the scheme of things where devices are connected to the internet and sensor data
may be uploaded to the web.
• Later these data can be used by the system to make actuations, ideally, without human
intervention.
• Smart homes, smart cities, smart cars, smart factories etc. are some of the examples IoT
• All the IoT based devices need to internet connectivity and so Wi-Fi and/or Ethernet
protocols will become necessity.
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
• Shows components of a ‘smart home ‘ in which many appliances and facilities may be
automated by the IoT concept.
• Besides Internet protocols, other short range protocols like: Bluetooth classic, BLE
(Bluetooth Low Energy), Zigbee, NFC (Near Field Communication) etc. are also accessories
in the IoT revolution.
• To make the IoT dream a reality ‘Cloud Computing’ also needs to be more prevalent.
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
• During the talk of IoT, we could see that an immense amount of data is generated
from the sensors that are deployed.
• Where could all this data be stored ?
• Where could computation and analytics using this data be done ?
• For all this, its none other than ‘ Cloud’.
• In 1990’s it started as a metaphor for internet and later internet services began to
be represented by the word cloud.
PRASHANTH KAMBLI, Dept. of ISE, RIT, Bangalore 23-06-2020
CONCLUSION
• Hence, we see that world of embedded systems is vast and it is making its
entry into every aspect of our lives.
• The future of this field is very promising and exiting.
UNIT- 1
Chapter- 2
INTERNAL COMPONENTS OF A
SYSTEM-ON-CHIP (SOC)
➢ An 8-bit port is configured as output and is utilized for sending 8-bit data
to an LCD display.
➢ one-bit pin is used for a relay
➢ 4-bit output pins for sending commands to a motor driver IC.
➢ Two-bit input pins are controlled by switches (S1 & S2)
➢ Another one takes sensor data from a temperature sensor.
➢ This illustrates that, it is possible to use GPIO pins as we need.
➢ It is shown to have perform four functions, but only one of which may be chosen
at a time.
➢ This choice selection happens on the basis of multiplexing called multiplexer.
➢ The select bit of the multiplexer are realized by two bits in a ‘Pin Select’ register.
➢ First option of pin is using as GPIO, where it can be used either input or output
pin
➢ It works on the basis of set/reset.
➢ When we are able to change the duty cycle of a square wave, we say that it is “Pulse Width
Modulated”.
➢ A symmetric wave has half of it period in the high or ‘1’ state and the other half in the low or ‘0’
state.
➢ So its duty cycle is 50% where the duty cycle is defined as follows:
Duty Cycle in % = (Time in the high state/Period) x 100
=(t/T) x 100
= 50% if T = 2t
INTERNAL COMPONENTS OF A
SYSTEM-ON-CHIP (SOC)
➢ Fig shows that inside MCU chip, the core (CPU) communicates with memory.
➢ The code and data need to be stored in memory and it is the prime activity in any
computing system.
➢ Accessing data from memory by the core is termed as Reading/Writing.
➢ When data is written into the memory is called as ‘Store’
➢ Whereas the data reading from it is called ‘Load’.
23-06-2020 PRASHANTH KAMBLI, DEPT. OF ISE, RIT 5
➢ These operations take a certain amount of time depending on the type of
technology used for memory.
➢ The value of the 'access times' tells that a memory is either fast or slow, and this
depends on the technology used.
➢ So, in this section, let us discuss the different types of memory devices which are
used in embedded applications.
➢ Inside the memory hardware, each address stores one byte of data. It means that
memory is generally 'byte oriented‘
➢ So if a 32-bit word is stored in memory, it occupies four bytes space and four
addresses are used for it.
Let us examine the finer details of the bus. Figure 2.26 shows that there are only two wires for
the bus, namely the SCL (serial clock) and serial data (SDA). Each wire has a resistor connected
to the supply voltage. This is a 'wired AND connection' for the bus that indicates an open
collector or open drain connection depending on whether a bipolar transistor or FET is used.
Embedded systems-
The software
PRASHANTH KAMBLI, Dept. of ISE, RIT
The concepts covered in this chapter are:
❑ The difference between big endian and little endian data
formats
❑ Why data alignment is needed?
❑ The difference between memory mapped I/O and
peripheral I/O
❑ RISC processors and the Load—Store architecture
❑ How stacks are realized ?
❑ The different flags available in processors
❑ The meaning of the term 'Instruction Set Architecture'
❑ What constitutes an IDE ?
❑ The components of software debuggers PRASHANTH KAMBLI, Dept. of ISE, RIT
INTRODUCTION
❑ We have discussed the hardware aspects of general
embedded systems.
❑ Here, we will discuss additional aspects of processors
and embedded systems, which are more related more to
software.
THE ARCHITECTURE
OF ARM 7
INTRODUCTION
In the current world of embedded systems
ARM processor has made its mark in almost all high-end devices
It might be mobile phone, automotive hardware, factories or
aircrafts
The first popular one in this series is ARM7 which was used
extensively in Apple IPods, PDAs (Personal Digital Assistant) and
many other applications.
Even though the new Cortex series of ARM has superseded
ARM7 the architectural difference between them is rather
slight.
It is in this context that we learn the ARM7 architecture first,
before moving on to the Cortex series.
HISTORY OF ARM
It was a company named Acorn RISC machines
design of the first ARM processor and it was based on a Berkley university
design
ARM1 was launched in 1985, and it was found that its RISC core had
capabilities comparable to the CISC processors of that time
was made with less number of transistors and generated much less power
ARM2 to ARM6 were designed but never really made a big impact.
ARM7 was the first commercially successful ARM processor.
ARM7 was followed by ARM 9 and ARM 11 which were higher versions.
4.1.1 THE BUSINESS MODEL OF ARM
Right from the beginning, ARM's business model was different from
that of Intel, the semiconductor giant.
Intel is the company that manufactures the processors of personal
computers and servers.
Intel designs and fabricates its chips and sells them as Intel chips.
ARM, on the other hand only does the design of its computing core.
It sells these designs, designated as IP (Intellectual Property) to
licensees who can do adequate modifications or additions to the
design, and then get it fabricated in global foundries.
The designs sold by ARM may be in various forms — it can be a
hardware description code or a transistor layout.
Thus, ARM designs the 'processor' part or the computing engine,
which is also called a 'core'.
Licensees may add peripherals to it and make it into a
microcontroller or `SoC'.
4.1.2 ARM AS A RISC PROCESSOR
In the early days of ARM, it was common for some ARM processors
to execute Java bytecode in hardware as a third execution state
along with the existing ARM and Thumb mode.
This is useful to increase the execution speed of Java ME games
and applications.
Such an extension is now obsolete.
4.1.3.8 ENHANCED DSP INSTRUCTIONS
Now that we have covered the basic aspects of the ARM7 core,
let us move on to some of its advanced features
4.5.1 AMBA
AMBA is associated with ARM and it is a widely used interconnection
standard for System on Chip (SoC) design.
AMBA stands for Advanced Microcontroller Bus Architecture‘
n 1996 it was developed as a standard bus to facilitate the concept of
modularity when adding on-chip functional blocks like memory and
peripherals.
The AMBA specification has become a well-accepted de-facto standard for
the semiconductor industry
used by 95% of ARM's partners and a number of IP providers.
The AMBA interface is processor and technology independent
COMPONENTS OF AMBA BUS
AMBA SPECIFICATION
Figure shows that the high-performance modules are on the AHB/ ASB bus. There is a bridge which converts this
standard to a lower speed peripheral bus. This will be discussed further in Chapter 6.
4.5.2 COPROCESSORS
For ARM7 to ARM 11, additional and sometimes optional functions were
obtained by the concept of coprocessors
A coprocessor is an additional functional block which has its own
instruction set
When some function needs to be done, which is not supported by the
general ARM core, a coprocessor is brought in to do it
For example, the ARM core is not capable of high-end floating point
arithmetic processing.
When the need of such processing is needed, an arithmetic
coprocessor is used, which operates in unison with the main core.
Similar to this, there are coprocessors for the control of MMU, cache,
DSP etc.
A licensee of ARM, when designing a chip, has the option to add the
coprocessor modules that is needed for his design.
Each coprocessor has its own functional hardware with its instructions.
Up to 16 coprocessors (CPO to C15) have been defined in the ARM cores.
Some of the important architectures. All of them are not present in all
core coprocessors of ARM7 are as follows:
1. CP10: Vector Floating Point unit
2. CP11: SIMD hardware and software named NEON
3. CP14: Debug unit
4. CP15: System control coprocessor for memory and cache
management (including TCM)
4.5.3 MEMORY MANAGEMENT AND
MEMORY PROTECTION
Many ARM cores have only a memory protection unit (MPU).
More advanced ARM chips have a memory management unit which
includes protection features as well.
Here the MMU of a typical ARM7 chip. ARM710T is one such processor.
The MMU performs two primary functions:
1.Translation of virtual addresses to physical addresses
2. Provision of protection to memory by stipulating 'access permissions'
The MMU has the following dedicated hardware to perform these functions:
1.Translation Lookaside memory (TLB)
2.Access control Logic
3.Translation table walking logic
ARM7 memory sizes are designated as either sections orpages.
Sections are 1 MB blocks of memory. Pages may be small of size 4 KB, or
large of size 64KB
MMU also supports the concept of domains — which are areas of memory
that can be defined to possess individual access rights.
4.5.3.1 USING THE TLB
A TLB stores a certain number of translations of logical addresses to
physical addresses.
For the ARM7 MMU, 64 translated entries are saved in the TLB.
If the required translation is available in the TLB, the 'access control logic‘
performs a permission cheek to verify if access is to be allowed.
If access is permitted, the MMU outputs the appropriate physical address
corresponding to the virtual address.
If access is not permitted, the MMU signals the CPU to go to the abort
mode through the abort exception.
Chapter 5
ASSEMBLY PROGRAMING OF
ARM7
INTRODUCTION
❑ Assembly Language Programming (ALP) is an efficient way of using
the instruction set of a processor.
❑ Here coding is done in a symbolic language which is generally
referred to as “mnemonics”.
❑ These mnemonic are directly converted into machine language and
are executed by the processor.
❑ Assembler: Tool that does the translation from assembly language to
machine language.
❑ Means its process is one-to-one process such that, each mnemonic
gets translated to only a specific machine code.
5.1 EMBEDDED PROGRAM DEVELOPMENT
❑ ARM is an embedded processor and the code which is developed has
finally to be 'burned' into its ROM.
❑ Code has to be developed, and thoroughly tested and verified to be
correct and working.
❑ We need a host computer which is a PC, in which the development and
testing of the code is done
❑ PC runs on an x86 processor, but the program that we are working on is
for another processor's Instruction Set Architecture (ISA), that is, ARM.
❑ when the assembly process is complete, the binary code that is
obtained is of a processor which is not the host computer (x86). So the
conversion is termed as 'cross assembly'. If the source program is written
in high level language, the translation is called `cross compiling'.
5.1 EMBEDDED PROGRAM DEVELOPMENT (CONTD..)
❑When using the assembler, the results of the program are checked in registers
and/or memory.
❑When memory is being used, we may need to choose a specific processor, so that we
can define the ROM and RAM spaces.
❑ We have chosen NXP's LPC 214x series, which has ROM starting at address
Ox00000000 and RAM at Ox40000000.
5.1.1 FEATURES OF ARMV4T ISA
❑ The version of ISA used for ARM7 is v4T (the character 'T' means that
Thumb instructions are also included).
❑ Feature are:
1. In general, all Instructions are of size 32 bits for ARM and 16 bits for
THUMB, though there are a few exceptions.
2.There is a barrel shifter in the ALU, as shown in Fig. 5.1. This means
that one of the operands may be shifted/rotated. This is useful for
simplifying some types of operations.
3.The use of the barrel shifter makes possible the combination of shift
and ALU operations in a single instruction.
4.All operands of data processing instructions are in registers.
5. Only the load and store instructions access memory.
6.Most other processors use condition checking only with branch
instructions. In contrast, here we find that many other instructions
have conditions appended to it
7.There is a special technique for handling immediate instructions.
8.There are instructions to load/store data in multiple registers.
9.Arithmetic and logical instructions have a three operand format.
SOME POINTS TO NOTE BEFORE WE START
ASSEMBLY PROGRAMMING
The processor can opt to use the big endian or little endian format
In our discussion here, we choose the little endian format.
8-bit (byte), 16-bit(half word) and 32-bit(word) data sizes are possible.
Data alignment is necessary for efficiency.
5.1.2 ASSEMBLY LANGUAGE FORMAT
In the example line, SAM is the label, ADD is the opcode, and R7, R6, R5 are the operands.
What is written after the semicolon is a comment. It is good programming practice to include
comments as part of programming.
5.2 ARM7 INSTRUCTION SET
Lets start Assembly Language Programming by looking at the instruction
set.
The instructions can be classified into the following different types:
I. Data processing instructions
II. Load store instructions — single register, multiple register
III. Branch instructions
IV. Status register access instructions
❑ We will discuss only the first three types.
5.2.1 DATA PROCESSING INSTRUCTIONS
➢ This set includes move, arithmetic, logical and compare instructions.
➢ Lets start with the concept of the barrel shifter which is part of the
ALU.
➢ A barrel shifter is a unit which can shift and rotate operands by any
amount.
➢Figure shows that when there are two source operands in the ALU,
➢ one of them may be shifted/rotated any number of times
➢Note that the maximum size of any register is 32 bits
➢so the barrel shifter operations are not needed for shift/rotations
beyond 32 times.
5.2.1.1 LOGICAL SHIFT LEFT (LSL #n)
➢ This allows a 33-bit rotation by using both the register and the carry
flag.
PROBLEMS
➢ The most frequently used instruction in any processor is the one that
copies from a source to a destination.
➢In ARM, the `MOV' instruction does the copying of data to a destination
register.
➢The simplest formats of the MOV instruction are as follows:
EXAMPLE 1
EXAMPLE 2
5.2.1.7 THE SUFFIX ‘S’
➢ For any data processing instruction to have the capability to update the
conditional flags, it must be suffixed with the character 'S'.
➢If this suffix is not appended to the instruction, the updating of flags
does not occur.
➢For example, the MOV instruction may be appended as MOVS.
➢Other instructions which we will see presently, may also be appended
with the suffix S
5.2.1.8 CONDITIONAL EXECUTION
➢ Securcore Series
-- High Security Applications
❑This is the hardware block that handles all the interrupts that comes
to the processor.
❑ Mechanism is found, that handles multiple interrupts and accept one
of them on priority resolution schemes
❑ Once the specified interrupt is acknowledged, the interrupting
device can access its interrupt handler
❑ The NVIC has been designed for interrupt latency to be low and
deterministic.
7.2.4 AMBA AHB-LITE
❖ The lower six bits of the IPSR are for the exception/interrupt number
❖ bit filed 24 of the EPSR indicated the ‘state’ of the processor (Either
in ARM or Thumb)
❖ Since the processor operates only in the Thumb mode, this bit is
always 1
❖ clearing this bit causes an exception
Above table indicates that there are three other combinations of
these status registers, that is, with two of them taken together.
7.4.3 OTHER SPECIAL REGISTERS
PRI Masks
❖Certain interrupts which are ‘non-maskable’ and other whose priorities
are configurable
❖This register is related to the ‘masking’ of interrupts, it is bit prevent
the activation of all configurable interrupts
❖ This register has 32 bits, out of which only the LSB is used
❖ Setting the LSB to ‘1’ makes inactive
❖ all Interrupts with configurable priority
Control Register
❖This is another 32-bit register of which only one bit is meaningful
❖ Bit 1 selects the stack to be used when the processor is in the
‘Thread’ mode
❖If the Bit=0, the main stack is specified to be active, otherwise the
PSP is considered to be active
7.5 MEMORY MODEL
❖Have seen the different sections of the memory space allocated for
different applications
❖ Access to different areas of memory may be ‘Shareable’ if there is
more than one processor/bus master in the system
❖The order in which access is allowed to occur for region of memory, is
defined by certain memory attributes
❖ they are:
Normal, Device and Strongly-ordered
1. NORMAL
❖Memory used for program execution and data storage generally occurs
within the ‘Normal’ designation.
❖ In such kind, the processor has the freedom to do ‘Out of Order’
accessing and even speculative reads
❖ Means that memory access need not be in the order in which a
program is coded
❖ Examples: Preprogramed flash
ROM, SDRAM, SRAM and DDR memory
2. DEVICE
❖ In the case of I/O’s rules of access is stricter
❖ Out of order is not permitted
3. STRONGLY ORDERED
❖This attribute is required where it is necessary to ensure strict ordering
of the access relative to what occurred in program order before the
access and after it
❖ This means that the processor preserves transaction order relative to all
other transactions