Você está na página 1de 19

Introduction to ARM and Embedded System Development tools


Nagarathna Yelluri Application Engineer

VLSI & Embedded Systems Group

Unistring Tech Solutions Pvt. Ltd

# D10, 5th Floor, Eureka court, Beside Image hospitals, Ameerpet, Hyderabad, ph:040-23732798, 09440318188 www.unistring.com

String Technologies
#309, Vederi complex, opp Dilshuk Nagar bus Depot, Dilsukh nagar, Hyderabad, ph: 040 24151900 www.stringtechnologies.net

What Is An Embedded System?

A special purpose system with a suitable hardware and software to meet a specific requirement/Application. Examples:
Mobile phone, keyboard, mouse, car speed indicator, electronic watch, GPS receiver unit

Where do we find embedded systems?

Communication Automobile


Embedded System
Household Appliances

Consumer Electronics Office Equipments

Embedded System General Block Diagram

Choices for processor architecture

CISC - Complex Instruction Set Computer
Many instructions which can perform involved operations: compact code Can be many clock cycles per instruction Large silicon area > Higher cost per die

RISC - Reduced Instruction Set Computer

More modern architecture One instruction executed per clock cycle > Very fast

DSP - Digital Signal Processor

Specialized type of uP Designed for real time mathematical manipulation of data streams
Radar image processing, audio/voice processing, ultrasound and photographic image processing

Includes instructions designed for multiplication and accumulation

Choice can be one of the three or a combination

Microprocessor and Microcontroller

An integrated circuit which forms the central processing unit for a computer or embedded controller, but requires additional support circuitry to function MC68000, 80486, Pentium, K6, etc.

A microprocessor plus additional peripheral support devices integrated into a single package Peripheral support devices may include:
Serial ports ( COM ), Parallel ( Ports ), Ethernet ports, A/D & D/A Interval timers, watchdog timers, event counter/timers, real time clock Other local processors ( DSP, numeric coprocessor, peripheral controller )

Intel 8051, ARM, PIC etc

History of ARM
ARM- Advanced RISC Machine. The first processor in ARM family was developed at Acorn Computers Ltd between October 1983 and April 1985. Now, ARM company is considered to be market dominant in the field of mobile phone chips, due to its power saving features

Where ARM is used?

We have several other basic microcontroller families such as PIC, M68HCXX, AVR etc. All these basic microcontrollers are useful for implementing basic interfacing and control mechanism for simple applications. There are several applications which require lot of computation and high speed data processing. In such applications advanced microcontrollers and microprocessors are used such as ARM and SHARC.

ARM Powered Products

Why is ARM popular?

ARM is widely used in embedded systems because of its power saving feature. ARM CPUs are dominant in the mobile electronics market, where low power consumption is critical design goal.

ARM Families

ARM7TDMI ARM and Thumb modes ARM7M strongARM Multiple instructions Load and store instructions

ARM6 & ARM7DI ARM3 ARM2 ARM1 26 Bit Addressing 32 Bit multiplier 32 Bit coprocessor On chip cache 32 Bit addressing

Features of ARM
ARM is popular with developers due to

Thumb mode of operation. A load store architecture. Fixed length 32-bit instructions. 3-Address instruction format. Large 16 word 32 bit register file. Orthogonal instruction set. Single cycle execution and many more

LPC2148 (ARM) architectures

The ARM architecture
RISC + additional features Occupies almost 75% of 32bit embedded RISC microprocessor market

Additional features of ARM

Auto-increment/decrement addressing modes Single data-processing instruction can perform both ALU and shifter operations Load/Store multiple instruction Conditional execution

Block Diagram

Processor Operating States

The ARM7TDMI processor has two operating states: ARM - 32-bit, word-aligned ARM instructions are executed in this state. Thumb -16-bit, half word-aligned Thumb instructions are executed in this state. The operating state of the ARM7TDMI core can be switched between ARM state and Thumb state using the BX (branch and exchange) instructions.

Processor Modes
ARM has seven operating modes
User FIQ IRQ Supervisor System Abort Undefined unprivileged mode under which most applications run entered, when a high priority (fast) interrupt is raised general purpose interrupt handling protected mode for the operating system
entered on reset or software interrupt instruction

privileged mode using same registers as user mode used to handle memory access violations used to handle undefined instructions

The Memory System

4 G address space
8-bit bytes, 16-bit half-words, 32-bit words Support both little-endian and big-endian
bit 31
23 19 15 22 18 14 21 17 13 9 5 1

bit 0
20 16 12 8 4 0


11 7 3 10 6





byte3 byte2 byte1 byte0

byte address

Word, half word and byte views

0x0000001C 0x00000018 0x00000014 0x00000010 0x0000000C 62 0x00000008 87 0x00000004 49 0x00000000 A6 0x0000000E 0x0000000C 25 0x0000000A 87 0x00000008 39 6B 4E 19 9D 6E 89 3C 0x00000007 0x00000006 9D 0x00000005 96 0x00000004 6E 0x00000003 A6 0x00000002 89 0x00000001 2B 0x00000000 3C

4E 9D 89

25 39 96 2B

6B< 19 6E 3C

0x00000006 49 0x00000004 96 0x00000002 A6 0x00000000 2B

(a) Word view

(b) Half word view

(c) Byte view

37 registers
31 general 32 bit registers, including PC 6 status registers 15 general registers (R0 to R14), and one status registers and program counter are visible at any time when you write user-level programs

The visible registers depend on the processor mode The other registers (the banked registers) are switched in to support IRQ, FIQ, Supervisor, Abort and Undefined mode processing

Register Bank

Indicates that the normal register used by User or System mode has been replaced by an alternative register specific to the exception mode

R0 to R15 are directly accessible R0 to R14 are general purpose R13: Stack point (sp) (in common)
Individual stack for each processor mode

R14: Linked register (lr) R15 holds the Program Counter (PC) CPSR - Current Program Status Register contains condition code flags and the current mode bits 5 SPSRs (Saved Program Status Registers) which are loaded with CPSR when an exceptions occurs

The Program Counter (R15)

When the processor is executing in ARM state:
All instructions are 32 bits in length All instructions must be word aligned Therefore the PC value is stored in bits [31:2] with bits [1:0] equal to zero (as instruction cannot be halfword or byte aligned).

R14 is used as the subroutine link register (LR) and stores the return address when Branch with Link (BL) operations are performed, calculated from the PC. Thus to return from a linked branch
MOV r15,r14 MOV pc,lr

Program Status Registers - 1

The ARM7TDMI contains a Current Program Status Register (CPSR), plus five Saved Program Status Registers (SPSRs) for use by exception handlers. These registers functions are:
Hold information about the most recently performed ALU operation. Control the enabling and disabling of interrupts. Set the processor operating mode

Program Status Registers - 2

The N, Z, C and V are condition code flags
may be changed as a result of arithmetic and logical operations in the processor may be tested by all instructions to determine if the instruction is to be executed N : Negative. Z : Zero. C : Carry. V : oVerflow

The I and F bits are the interrupt disable bits The M0, M1, M2, M3 and M4 bits are the mode bits

How Microcontroller Works

Is Powering the Microcontroller is enough? Why the Programmability Feature? What is instruction? Where does the Instructions Stores? Instruction Fetching & Decoding Fixed Set of instructions & Uniqueness

Advantage of Assembly Language

Improved readability of program Ease of debugging Speed - Faster running code with assembly Some low-level programming is actually easier to do with assembly Few embedded systems are also programmed in assembly to utilize limited computational resources.

Instruction Format


Mnemonic [Operands] [;Comment]

Sample Assembly Language Program add r1, r2, r3, lsl #4 sub r1, r2, r3, lsl #4 adds r1, r2, r3, lsl #4 subs r1, r2, r3, lsl #4 .end

Issues in Assembly programming

Size of each instruction (in bytes) Execution time of each instruction Supported addressing modes for each instruction

Why C? Easier and less time consuming C is easier to modify Portability How can processor understand C language? What is Compiler & Cross Compiler?

C for Microcontrollers
Of higher level languages, C is the closest to assembly languages
bit manipulation instructions pointers (indirect addressing)

Most microcontrollers have available C compilers Writing in C simplifies code development for large projects.

System development scheme

When a C program is compiled, some code is created that runs BEFORE the main program. This code clears RAM to zero and initializes your variables. Here is a segment LJMP 0003h of this code:
0003: back: ... MOV R0, #7FH CLR A MOV @R0, A DJNZ R0, back

Thank You