Microcontroller Na D Embedded System PPT Module-1
Microcontroller Na D Embedded System PPT Module-1
Chapter -1
Performance is optimized with more focus Performance is optimized with more focus on
on software hardware.
2 It has no memory unit and uses separate It has a memory unit to implement complex
hardware to implement instructions.. instructions.
11 It does not require external memory for It requires external memory for
calculations calculations
12 The most common RISC microprocessors are Examples of CISC processors are the
Alpha, ARC, ARM, AVR, MIPS, PA-RISC, PIC, Power System/360, VAX, PDP-11, Motorola
Architecture, and SPARC. 68000 family, AMD, and Intel x86 CPUs.
RISC is implemented with four major design rules
• Instruction –
1. Less number of instruction set
2. Single cycle is required to execute instruction
3. Compiler synthesizes complicated operations by combining
several simple instructions
4. Each instruction is a fixed length
• Pipelines –
1. Instructions is broken down into smaller units that can be
executed in parallel by pipelines.
2. Maximizes throughput
• Registers –
1. Large general purpose register set
2. Can contain data or memory
• Load-store architecture –
1. The processor operates on data held in registers
2. Separate load store instructions required to transfer
data between register and memory
ARM design philosophy
• Physical features that have driven the ARM processor
design.
1. Small device that reduces power consumption and extend
battery operation
2. High code density: useful for applications that have limited on-
board memory
3. Price sensitive and use slow and low-cost memory devices.
4. Reduce the area of the die taken up by the embedded
processor.
Instruction set for Embedded systems
• The ARM instruction set differs from the pure RISC definition in several ways that make the
ARM instruction set suitable for embedded applications:
• Variable cycle execution for certain instructions- Not every ARM instruction executes in a
single cycle. For example, load-store-multiple instructions vary in the number of execution
cycles depending upon the number of registers being transferred.
• Inline barrel shifter leading to more complex instructions- The inline barrel shifter is a
hardware component that pre-processes one of the input registers before it is used by an
instruction.
• Thumb 16-bit instruction set- ARM enhanced the processor core by adding a second 16-bit
instruction set called Thumb that permits the ARM core to execute either 16- or 32-bit
instructions.
• Conditional execution- An instruction is only executed when a specific condition has been
satisfied
• Enhanced instructions- The enhanced digital signal processor (DSP) instructions were added
to the standard ARM instruction set to support fast 16×16-bit multiplier operations and
saturation.
Embedded system hardware
Embedded system hardware
Figure 1.2 shows a typical embedded device based on an ARM core. The device
has four main hardware components:
1. The ARM processor: It controls the embedded device. An ARM processor
comprises a core (the execution engine that processes instructions and
manipulates data) plus the surrounding components that interface with a bus.
2. Controllers: Two commonly found controllers are interrupt and memory
controllers.
❖ Memory Controllers: Memory controllers connect different types of memory to the
processor bus. On power-up a memory controller is configured in hardware to allow
certain memory devices to be active.
❖ An interrupt controller: An interrupt controller determines which peripheral or device
can interrupt the processor at any specific time.
3. Peripherals: Embedded systems that interact with the outside world need
some form of peripheral device. A peripheral device performs input and
output functions for the chip by connecting to other devices
Embedded system hardware
4. Bus: A bus is used to communicate between different parts of the
device.
• Embedded system uses on-chip bus called as AMBA (Advanced
microcontroller Bus architecture) that allows different peripheral
devices to be connected to ARM.
• AMBA buses introduced were the ARM System Bus (ASB), ARM
Peripheral Bus (APB). & ARM High Performance Bus (AHB)
• AHB-APB bridge: to connect ARM High Performance Bus (AHB) to ARM
Peripheral Bus (APB).
• AHB-external bridge: to connect ARM High Performance Bus (AHB) to
external devices
• AHB arbiter: The arbiter is used to ensure that, at any point in time,
Memory
• An embedded system have some form of memory to store and execute the code.
• It has some specific memory characteristics, such as hierarchy, width, and type.
Hierarchy
• Cache is placed between main memory and the core. It is used to speed up data transfer between the
processor and main memory.
• The main memory is around 256 KB to 256 MB, depending on the application.
• Secondary storage is the largest and slowest form of memory (600MB to 60GB).
Width
• The memory width is the number of bits the memory returns on each access. It may be 8, 16, 32 or 64-
bits.
Types
• Read only memory (ROM)
• Flash ROM
• Dynamic Random Access Memory (DRAM)
• Static Random Access Memory (SRAM)
• Synchronous dynamic Random Access Memory (SDRAM)
ARM bus technology
• Embedded systems use different bus technologies than those designed for
x86 PCs.
• Embedded devices use an on-chip bus that is internal to the chip and that
allows different peripheral devices to be interconnected with an ARM core.
• There are two different classes of devices attached to the bus.
• The ARM processor core is a bus master—a logical device capable of initiating a
data transfer with another device across the same bus.
• Peripherals tend to be bus slaves—logical devices capable only of responding to a
transfer request from a bus master device.
• A bus has two architecture levels.
• The first is a physical level that covers the electrical characteristics and bus width
(16, 32, or 64 bits).
• The second level deals with protocol—the logical rules that govern the
communication between the processor and a peripheral.
AMBA Bus Protocol
• The Advanced Microcontroller Bus Architecture (AMBA) was introduced in
1996 and has been widely adopted as the on-chip bus architecture used
for ARM processors.
• AMBA buses introduced were the ARM System Bus (ASB), ARM Peripheral
Bus (APB). & ARM High Performance Bus (AHB)
• AHB provides higher data throughput than ASB because it is based on a
centralized multiplexed bus scheme rather than the ASB bidirectional bus
design.
• This change allows the AHB bus to run at higher clock speeds and to be
the first ARM bus to support widths of 64 and 128 bits.
• ARM has introduced two variations on the AHB bus:
• Multi-layer AHB: the Multi-layer AHB bus allows multiple active bus masters.
• AHB-Lite: AHB-Lite is a subset of the AHB bus and it is limited to a single bus
Peripherals
• A peripheral device performs input and output functions for the chip by connecting to other devices that are
off-chip.
• Each peripheral device performs a single function
• All arm peripherals are memory mapped the programming interface is a set of memory addressed registers
• Specialized peripherals called as controllers that implement higher levels of functionality
• Two types of controllers
1. Memory controller
• Connect different types of memory to the processor bus
• On power-up a memory controller is configured in hardware to allow certain memory devices to
be active
• Some memory devices must be set up by software
2. Interrupt controller
• It provides a programmable that allows software to determine which peripheral or device can
interrupt the processor at any specific time by setting the appropriate bits in the interrupt controller
register
• Two types controller
1. Standard interrupt controller (SIC)
2. Vector Interrupt controller(VIC)
Embedded system software
• An embedded system needs software to drive it. Figure 1.4 shows four typical
software components required to control an embedded device.
Figure 1.4: four typical software components required to control an embedded device.
1. Initialization code:
• Initialization code (or boot code) takes the processor from the
reset state to a Run state.
• It usually configures the memory controller and processor caches
and initializes some devices.
• The initialization code handles a number of administrative tasks
namely initial hardware configuration, diagnostics, and booting.
❖ Initial hardware configuration involves setting up the target platform
so it can boot an image.
❖ Diagnostics are often embedded in the initialization code. Diagnostic
code tests the system by exercising the hardware target to check if the
target is in working order.
❖ Booting involves loading an image and handing control over to that
image.
2. Operating System
• The operating system provides an infrastructure to control applications and
manage hardware system resources.
• An operating system organizes the system resources: the peripherals,
memory, and processing time.
• ARM processors support over 50 operating systems. We can divide operating
systems into two main categories: real-time operating systems (RTOSs) and
platform operating systems.
3. Device drivers
• The device drivers are the third component shown in Figure 1.2. They provide
a consistent software interface to the peripherals on the hardware device.
4. Application
• Finally, an application performs one of the tasks required for a device.
• For example, a mobile phone might have a diary application. There may be
multiple applications running on the same device, controlled by the operating
ARM Processor Fundamentals
• The control field contains the processor mode, state, and interrupts mask
bits
• The flags field contains the condition flags
1. Processor Modes
• The processor mode determines which registers are active and the access
rights to the cpsr register itself.
• Each processor mode is either privileged or nonprivileged:
• A privileged mode allows full read-write access to the cpsr.
• Nonprivileged mode only allows read access to the control field in the cpsr but still
allows read-write access to the condition flags.
• There are seven processor modes in total: six privileged modes (abort, fast
interrupt request, interrupt request, supervisor, system, and undefined) and
one nonprivileged mode (user).
• The processor enters abort mode when there is a failed attempt to access memory.
• Fast interrupt request and interrupt request modes correspond to the two
interrupt levels available on the ARM processor.
• Supervisor mode is the mode that the processor is in after reset and is generally
the mode that an operating system kernel operates in.
Fields of CPSR
• System mode is a special version of user mode that allows full read-write
access to the cpsr.
• Undefined mode is used when the processor encounters an instruction that
is undefined or not supported by the implementation.
• User mode is used for programs and applications.
Interrupt Mask
• Interrupt masks are used to stop specific interrupt requests from interrupting the
processor.
• There are two interrupt request levels available on the ARM processor core—interrupt
request (IRQ) and fast interrupt request (FIQ).
• The I bit masks IRQ when set to binary 1, and similarly the F bit masks FIQ when set to
binary
State and Instruction Sets
• The state of the core determines which instruction set is being executed.
• There are three instruction sets: ARM, Thumb, and Jazelle.
• The ARM instruction set is only active when the processor is in ARM state (32 bit).
• Similarly the Thumb instruction set is only active when the processor is in Thumb state (16 bit). Once
in Thumb state the processor is executing purely Thumb 16-bit instructions.
• The ARM designers introduced a third instruction set called Jazelle. Jazelle executes 8-bit instructions.
Condition Flags
• Condition flags are updated by comparisons and the arithmetic and logical operations only
if instructions are used with the S suffix.
• For example, if SUBS subtract instruction results in a register value of zero, then
the Z flag in the cpsr is set. This particular subtract instruction specifically
updates the cpsr