ARM EMBEDDED SYSTEMS

The ARM processor core is a key component of many successful 32-bit embedded systems. ARM cores are widely used in mobile phones, handheld organizers, and a multitude of other everyday portable consumer devices.

The first ARM1 prototype was designed in 1985. Over one billion ARM processors had been shipped worldwide by the end of 2001. The ARM Company bases their success on a simple and powerful original design, which continues to improve today through constant technical innovation.

For example, one of ARM’s most successful cores is the ARM7TDMI. It provides up to 120 Dhrystone MIPS and is known for its high code density and low power consumption, making it ideal for mobile embedded devices.

THE RISC DESIGN PHYLOSOPHY:

Fig: CISC vs. RISC

The RISC philosophy is implemented with four major design rules:

  1. Instructions—RISC processors have a reduced number of instruction classes. These classes provide simple operations that can each execute in a single cycle. The compiler or programmer synthesizes complicated operations (for example, a divide operation) by combining several simple instructions. Each instruction is having fixed length to allow the pipeline to fetch future instructions before decoding the current instruction.
  1. Pipelines—The processing of instructions is broken down into smaller units that can be executed in parallel by pipelines. Ideally the pipeline advances by one step on each cycle for maximum throughput. Instructions can be decoded in one pipeline stage.
  1. Registers—RISC machines have a large general-purpose register set. Any register can contain either data or an address. Registers act as the fast local memory store for all data processing operations.
  1. Load-store architecture—The processor operates on data held in registers. Separate load and store instructions transfer data between the register bank and external memory. Memory accesses are costly, so separating memory accesses from data processing provides an advantage because you can use data items held in the register bank multiple times without needing multiple memory accesses.

o In contrast, traditional CISC processors are more complex and operate at lower clock frequencies.

THE ARM DESIGN PHYLOSOPHY:

There are a number of physical features that have driven the ARM processor design.

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:

These additional features have made the ARM processor one of the most commonly used 32-bit embedded processor cores.

EMBEDDED SYSTEM HARDWARE:

Embedded systems can control many different devices, from small sensors found on a production line, to the real-time control systems used on a NASA space probe. All these devices use a combination of software and hardware components.

The following Figure shows a typical embedded device based on an ARM core. Each box represents a feature or function. The lines connecting the boxes are the buses carrying data.

Figure: An ARM-based Embedded Device, a Microcontroller

We can separate the device into four main hardware components:

  1. The ARM processor controls the embedded device. Different versions of the ARM processor are available to suit the desired operating characteristics. An ARM processor comprises a core (the execution engine that processes instructions and manipulates data) plus the surrounding components (memory and cache) that interface it with a bus.
  2. Controllers coordinate important functional blocks of the system. Two commonly found controllers are interrupt and memory controllers.
  3. The peripherals provide all the input-output capability external to the chip and are responsible forthe uniqueness of the embedded device.
  4. A bus is used to communicate between different parts of the device.

ARM Bus Technology:

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:

  1. The ARM processor core is a bus master—a logical device capable of initiating a data transferwith another device across the same bus.
  2. Peripherals tend to be bus slaves—logical devices capable only of responding to a transferrequest from a bus master device.

A bus has two architecture levels:

A physical level—covers the electrical characteristics and bus width (16, 32, or 64 bits).

The protocol—the logical rules that govern the communication between the processor and a peripheral.

AMBA Bus Protocol:

Memory:

An embedded system has to have some form of memory to store and execute code. You have to compare price, performance, and power consumption when deciding upon specific memory characteristics, such ashierarchy, width, and type.

Hierarchy: All computer systems have memory arranged in some form of hierarchy. The following Figure shows the memory trade-offs: the fastest memory cache is physically located nearer the ARM processor core and the slowest secondary memory is set further away. Generally the closer memory is to the processor core, the more it costs and the smaller its capacity.

Figure: Memory Storage Trade-offs

Width: The memory width is the number of bits the memory returns on each access—typically 8, 16, 32,or 64 bits.

The following Table summarizes theoretical cycle times on an ARM processor using different memorywidth devices.

Table: Fetching Instruction from Memory

Instruction Size

8-bit Memory

16-bit Memory

32-bit Memory

ARM 32-bit

4 cycles

2 cycles

1 cycles

Thumb 16-bit

2 cycles

1 cycles

1 cycles

Types: There are many different types of memory:

Many devices also use a ROM to hold boot code.

DRAM. It can run at much higher clock speeds than conventional memory. SDRAM synchronizes itself with the processor bus, because it is clocked. Internally the data is fetched from memory cells, pipelined, and finally brought out on the bus in a burst.

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 or sensors that are off-chip.

802.11 wireless device.

Memory Controllers: Memory controllers connect different types of memory to the processor bus. o On power-up a memory controller is configured in hardware to allow certain memory

devices tobe active. These memory devices allow the initialization code to be executed.

Some memory devices must be set up by software; for example, when using DRAM, you first have to setup the memory timings and refresh rate before it can be accessed.

Interrupt Controllers: When a peripheral or device requires attention, it raises an interrupt to the processor. An interrupt controller provides a programmable governing policy 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 registers.

There are two types of interrupt controller available for the ARM processor: the standard interrupt controller and the vector interrupt controller.

  1. The standard interrupt controller sends an interrupt signal to the processor core when an externaldevice requests servicing. It can be programmed to ignore or mask an individual device or set of devices.

page: 11

  1. The vector interrupt controller (VIC) is more powerful than the standard interrupt controller, because it prioritizes interrupts and simplifies the determination of which device caused the interrupt.

EMBEDDED SYSTEM SOFTWARE:

An embedded system needs software to drive it. The following Figure shows four typical software components required to control an embedded device.

Figure: Software Abstraction Layers Executing on Hardware

o  For example, a mobile phone might have a diary application.

There may be multiple applications running on the same device, controlled by the operating

system.


o        For example, the memory system normally requires reorganization of the memory map,as shown in the following Example.

Initialization (Boot) Code

Initialization code (or boot code)takes the processor from the reset state to a state where the operating system can run. It usually configures the memory controller and processor caches and initializes some devices. In a simple system the operating system might be replaced by a simple scheduler or debug monitor.

The initialization code handles a number of administrative tasks prior to handing control over to an operating system image. We can group these different tasks into three phases: initial hardware configuration, diagnostics, and booting.

Initial hardware configuration involves setting up the target platform so it can boot an image. Although the target platform itself comes up in a standard configuration, this configuration normally requires modification to satisfy the requirements of the booted image. For example, the memory system normally requires reorganization of the memory map, as shown in Example 1.1.

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. It also tracks down standard system-related issues. This type of testing is important for manufacturing since it occurs after the software product is complete. The primary purpose of diagnostic code is fault identification and isolation.

Booting involves loading an image and handing control over to that image. The boot process itself can be complicated if the system must boot different operating systems or different versions of the same operating system.

Booting an image is the final phase, but first you must load the image. Loading an image involves anything from copying an entire program including code and data into RAM, to just copying a data area containing volatile variables into RAM. Once booted, the system hands over control by modifying the program counter to point into the start of the image.

Sometimes, to reduce the image size, an image is compressed. The image is then decompressed either when it is loaded or when control is handed over to it

Example: Initializing or organizing memory is an important part of the initialization code, because many operating systems expect a known memory layout before they can start.

Figure: Memory Remapping

The above Figure shows memory before and after reorganization. It is common for ARM-based embedded systems to provide for memory remapping because it allows the system to start the initialization codefrom ROM at power-up. The initialization code then redefines or remaps the memory map to place RAM at address 0x00000000—an important step because then the exception vector table can be in RAM and thus can be reprogrammed.

Operating System:

  1. RTOSs provide guaranteed response times to events. Different operating systems have different amounts of control over the system response time.
  1. Platform operating systems require a memory management unit to manage large, non- real-timeapplications and tend to have secondary storage.

Applications:

ARM PROCESSOR FUNDAMENTALS

A programmer can think of an ARM core as functional units connected by data buses, as shown in the following Figure.

The ARM processor, like all RISC processors, uses load-store architecture—means it has two instruction   types   for   transferring   data   in   and   out   of   the   processor:

Figure: ARM Core dataflow Model

The arrows represent the flow of data, the lines represent the buses, and the boxes represent either an operation unit or a storage area.

REGISTERS:

General-purpose registers hold either data or an address. They are identified with the letter r prefixed to the register number. For example, register 4 is given the label r4. The Figure shows the active registers available in user mode. (A protected mode is normally used when executing applications).

CURRENT PROGRAM STATUS REGISTER:

The ARM core uses the cpsr to monitor and control internal operations. The cpsr is a dedicated 32-bit register and resides in the register file. The following Figure shows the basic layout of a generic program status register. Note that the shaded parts are reserved for future expansion.

Figure: A Generic Program Status Register (psr)

The cpsr is divided into four fields, each 8 bits wide: flags, status, extension, and control. In current        designs the extension and status fields are reserved for future use.

Some ARM processor cores have extra bits allocated. For example, the J bit, which can be found in theflags field, is only available on Jazelle-enabled processors, which execute 8-bit instructions.

It is highly probable that future designs will assign extra bits for the monitoring and control of newfeatures.

Processor Modes:

register itself. Each processor mode is either privileged or non-privileged:

accessto the cpsr.

User mode is used for programs and applications.

Banked Registers:

The following Figure shows all 37 registers in the register file.

Figure: Complete ARM Register Set

Comparision between ARM and Thumb Instruction:

-

ARM (cspr T = 0)

Thumb (cspr T = 1)

Instruction size

32-bit

16-bit

Core instructions

58

30

Conditional execution

most

only branch instructions

Data        processing

instructions

access to barrel shifter and

ALU

separate barrel shifter and

ALU instructions

Program status register

read-write in privileged mode

no direct access

Register usage

15        general-purpose registers

+pc

8 general-purpose registers +7 high registers

+pc

Condition Flags:

the S instruction suffix.

o For example, if a 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.

Table: Condition Flags

Flag

Flag Name

Set When

Q

Saturation

the result causes an overflow and/or saturation

V

OVerflow

the result causes a signed overflow

C

Carry

the result causes an unsigned carry

Z

Zero

the result is zero

N

Negative

bit 31 of the result is a binary 1

These flags are located in the most significant bits in the cpsr. These bits are used for conditional execution. The following Figure shows a typical value for the cpsr with both DSP extensions and Jazelle.

Conditional Execution:

Table: Condition Mnemonics

PIPELINE:

Figure: ARM7 Three-stage Pipeline

The above Figure shows a three-stage pipeline:

Below Figure shows Pipelined instruction sequence.

EXCEPTIONS, INTERRUPTS AND THE VECTOR TABLE:

Table: The Vector Table

Exception/Interrupt

Shorth and

Address

High Address

Reset

RESET

0x00000000

0x00000000

Undefined instruction

UNDEF

0x00000004

0xffff0004

Software interrupt

SWI

0x00000008

0xffff0008

Prefetch abort

PABT

0x0000000c

0xffff000c

Data abort

SABT

0x00000010

0xffff0010

Reserved

0x00000014

0xffff0014

Interrupt request

IRQ

0x00000018

0xffff0018

Fast interrupt request

FIQ

0x0000001c

0xffff001c

CORE EXTENSIONS:

Each ARM family has different extensions available. There are three hardware extensions: cache andtightly coupled memory, memory management, and the coprocessor interface.

Cache and Tightly Coupled Memory:

Figure: Von Neumann Architecture with Cache

Figure: Harvard Architecture with TCMs

Memory Management:

Coprocessors:

Previous year questions

  1. With neat block diagram, explain the ARM based Embedded device Microcontroller.

6M(Aug 21)

  1. With neat diagram outline the various functional block of embedded system.6M
  2. Explain RISC design principle.        4M(Feb21)
  3. Differentiate between CISC and RISC processors 4M(sept2020)
  4. Explain the Instruction set for Embedded systems.        6M
  5. Explain the Embedded system hardware.        6M(sept2020)
  6. Explain ARM core data flow model with neat diagram. 6M(Aug ,Feb21)8M(sept2020)(JAN2020)8M (2018)
  7. Explain Process Modes of CPSR with respect to ARM Processors. 6M (Aug 21)7M
  8. Explain the Pipeline mechanism in ARM Processors.        8M(Aug2021), 4M(Feb2021),6M(sept 2020)
  9. Explain interrupt handling in ARM processor.        4M(Feb21)
  10. Explain the memory remapping of embedded system software for initialization(Boot)code. 6M
  11. Explain ARM processors execution modes along with complete register set.        8M
  12. With neat diagram illustrate the seven processor modes.        8M
  13. Explain registers used under different processor modes.        5M