microsoft powerpoint - embeddedsystem [compatibility mode]
TRANSCRIPT
Introduction to ARM and Embedded System
Development tools
By
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?
Automobile
Communication
Avionics
Embedded
Consumer Electronics
Household Appliances
Office Equipments
Embedded
System
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 fastOne 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
Microprocessor
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.
MicrocontrollerMicrocontroller
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. 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
�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.
Where ARM is used?
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 �ARM CPUs are dominant in the mobile electronics market, where low power consumption is critical design goal.
ARM Families
ARM7M strongARM
Multiple instructions
Load and store
instructions
ARM7TDMI
ARM and
Thumb modes
ARM1
26 Bit Addressing
ARM2
32 Bit multiplier
32 Bit
coprocessor
ARM3
On chip
cache
ARM6 & ARM7DI
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.�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
LPC2184LPC2184
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 unprivileged mode under which most applications run
FIQ entered, when a high priority (fast) interrupt is raised
IRQ general purpose interrupt handling
Supervisor protected mode for the operating systemSupervisor protected mode for the operating system
entered on reset or software interrupt instruction
System privileged mode using same registers as user mode
Abort used to handle memory access violations
Undefined 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
20212223
bit 31 bit 0
half-word4
word16
0123
4567
891011
byte0
byte
12131415
16171819
byte1byte2
half-word14
byte3
byte6
address
half-word12
word8
Word, half word and byte views
0x0000001C 0x0000000E 0x00000007
6B25 9D0x00000018 0x0000000C 0x00000006
4E87 960x00000014 0x0000000A 0x00000005
1939 6E0x00000010 0x00000008 0x00000004
10 25 6B<62 9D49 A60x0000000C 0x00000006 0x00000003
4E 39 1987 6E96 890x00000008 0x00000004 0x00000002
9D 96 6E49 89A6 2B0x00000004 0x00000002 0x00000001
89 2B 3CA6 3C2B 3C0x00000000 0x00000000 0x00000000
(a) Word view (b) Half word view (c) Byte view
Registers
� 37 registers31 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
Cond…
�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
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 Program Counter (R15)
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 branchMOV 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 register’s functions are:These register’s 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 bitsThe 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?�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 �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
[Label:] Mnemonic [Operands] [;Comment][Label:] Mnemonic [Operands] [;Comment]
add r1, r2, r3, lsl #4
sub r1, r2, r3, lsl #4
adds r1, r2, r3, lsl #4
Sample Assembly Language Program
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 �Supported addressing modes for each instruction
PROGRAMMING IN C
• Why C?
• Easier and less time consuming
• C is easier to modify
• Portability• 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
Initialization
• 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 initializes your variables. Here is a segment
of this code: LJMP 0003h
0003: MOV R0, #7FH
CLR A
back: MOV @R0, A
DJNZ R0, back
...
Thank YouThank YouThank YouThank You