KEMBAR78
Chapter_2_Embedded Systems Design_introduction_ARM.pdf
Chapter 1
Fundamentals of
Microprocessor and
Microcontroller
Dr. Farid Farahmand
Updated: Monday, February 5, 2018
Evolution
n First came transistors
n Integrated circuits
¨ SSI (Small-Scale Integration) to ULSI
¨ Very Large Scale Integration circuits (VLSI)
n 1- Microprocessors (MPU)
¨ Microcomputers (with CPU being a microprocessor)
¨ Components: Memory, CPU, Peripherals (I/O)
¨ Example: Personal computers
n 2- Microcontroller (MCU)
¨ Microcomputers (with CPU being a microprocessor)
¨ Many special function peripheral are integrated on a single
circuit
¨ Types: General Purpose or Embedded System (with special
functionalities)
Microcontrollers –
Embedded Systems
n An embedded system is a special-purpose computer
system designed to perform one or a few dedicated
functions often with real-time
n An integrated device which consists of multiple devices
¨ Microprocessor (MPU)
¨ Memory
¨ I/O (Input/Output) ports
n Often has its own dedicated software
Embedded Systems
4
Amazon Warehouse
5
Kiva Robot
Microprocessor-Based Systems
• Central Processing Unit (CPU)
• Memory
• Input/Output (I/O) circuitry
• Buses
– Address bus
– Data bus
– Control bus
Arithmetic
Logic
Unit
Register
Arrays
Control Unit
GP-
CPU
CLK Reg
MPU
CPU
Microprocessor-based System
Microprocessor-Based System with
Buses: Address, Data, and Control
Microprocessor-based Systems
Microprocessor
n The microprocessor (MPU) is a computing and
logic device that executes binary instructions in a
sequence stored in memory.
n Characteristics:
¨General purpose central processor unit (CPU)
¨Binary
¨Register-based
¨Clock-driven
¨Programmable
Microprocessor-based Systems
Microprocessor
n the “brains” of the computer
¨ its job is to fetch instructions, decode them, and then execute them
¨ 8/16/32/etc –bit (how it moves the data
n contains: Arithmetic
Logic
Unit
Register
Arrays
Control Unit
ALU performs computing tasks – manipulates the data/ performs numerical and logical
computations
Registers are used for temp. storage
Control unit is used for timing and other controlling functions – contains a program
counter (next instruction’s address and status register)
System software: A group of programs that monitors the functions of the entire system
Remember
Microprocessor-based Systems
Memory
n Memory is a group of registers
n 16 register – address: 0-15 – in binary: 0-
1111; Address lines: A0-A3
n Serves two major purposes
q storing the binary codes for the sequence of
instructions specified by programs (program)
q storing binary data that the computer needs
to execute instructions (data)
Microprocessor-based Systems
Memory Types
¨ R/W: Read/Write Memory; also called RAM
n It is volatile (losses information as power is
removed)
n Write means the processor can store information
n Read means the processor can receive information
from the memory
n Acts like a Blackboard!
¨ ROM: Read-Only memory;
n It is typically non-volatile (permanent) – can be
erasable
n It is similar to a Page from your textbook
Microprocessor-based Systems
Memory Classification
Expensive
Fast/
Cheap
Slow
Onetime programmable
Electronically Erasable
PROM
Basic Technologies:
Semiconductor
Magnetic
Optical
(or combination)
Microprocessor-based Systems
Memory Classification
Expensive
Fast/
Cheap
Slow
Onetime programmable
Electronically Erasable
PROM
-4/6 transistor to
save a single bit
- Volatile
- Fast but
expensive
-one transistor and one
capacitor to store a bit
-Leakage problem, thus
requires refreshing
-Used for dynamic
data/program storage
-Cheap and slow!
Erasable ROMs
n Marked Programmed ROM
¨ Programmed by the manufacturer
n Programmable ROM (PROM)
¨ Can be programmed in the field via the programmer
n Erasable Programmable ROM (EPROM)
¨ Uses ultraviolet light to erase (through a quartz window)
¨ OTP refers to one-time programmable
n Electrically Erasable Programmable ROM (EEPROM)
¨ Each program location can be individually erased
¨ Expensive
¨ Requires programmer
n FLASH
¨ Can be programmed in-circuit (in-system)
¨ Easy to erase (no programmer)
¨ Only one section can be erased/written at a time (typically 64 bytes at a time)
Microprocessor-based Systems
I/O Ports
n The way the computer communicates with the
outside world devices
n I/O ports are connected to Peripherals
¨ Peripherals are I/O devices
n Input devices
n Output devices
¨ Examples
n Printers and modems,
n keyboard and mouse
n scanner
n Universal Serial Bus (USB)
Microprocessor-based
Systems - BUS
n The three components – MPU, memory, and I/O – are connected by a
group of wires called the BUS
n Address bus
n consists of 16, 20, 24, or 32 parallel signal lines (wires) - unidirectional
n these lines contain the address of the memory location to read or written
n Control bus
¨ consists of 4 to 10 (or more) parallel signal lines
¨ CPU sends signals along these lines to memory and to I/O ports
n examples: Memory Read, Memory Write, I/O Read, I/O Write
n Data bus
¨ consists of 8,16, or 32 parallel signal lines
¨ bi-directional
¨ only one device at a time can have its outputs enabled,
¨ this requires the devices to have three-state output
Expanded Microprocessor-Based System
1. Note the directions
of busses
2. What is the width of
the address bus?
3. What is the value of
the Address but to
access the first
register of the
R/WM?
You must know how to
draw it!
Remember: 111 1111 1111 = 7FF = 2^11-1 = 2047
2^11=2K=2048
2^11 Requires 11 bits
2K
Registers or bytes of
memory
000
What?
How many bits
001
2K
Registers or bytes of
memory
800
801
How much memory do we have?
What?
How many bits
Example
2K
(2^11 = 2048)
Registers or bytes of
memory
000
2^11 -1=7FF
Requires 11 bits
001
2K
(2^11 = 2048)
Registers or bytes of
memory
800
FFF
Requires 12 bits
For a total of 4095 bytes
801
Total of 4K bytes of memory: 2^12 (FFF) Ă  12 bits ; last values 2^12-1 = 4096-1
Example
1G bytes of memory
000
2^30 -1=3FFF FFFF
Next number: 4000 0000 (in Hex)
001
Example
8 bits
30 bits!
800
FFF
Example of an 8-bit MPU
RAM
2K
ROM
2K
A15
A0
D7
D0
8-bit
So what are
microcontrollers?
What is a Microcontroller?
n A microcontroller is a small computer on a
single integrated circuit containing
¨processor core,
¨memory,
¨programmable input/output peripherals
n Used for specific (embedded) applications
Embedded controllers
n Used to control smart machines
n Examples: printers, auto braking systems
n Also called microcontrollers or
microcontroller units (MCU)
Embedded controllers
Software Characteristics
n No operating systems
n Execute a single program, tailored exactly to the
controller hardware
n Assembly language (vs. High-level language)
¨Not transportable, machine specific
¨Programmer need to know CPU architecture
¨Speed
¨Program size
¨Uniqueness
Microcontroller Unit (MCU)
Block Diagram
n An integrated electronic computing and logic device that
includes three major components on a single chip
¨ Microprocessor
¨ Memory
¨ I/O ports
n Includes support devices
¨ Timers
¨ A/D converter
¨ Serial I/O
¨ Parallel Slave Port
n All components connected by common communication
lines called the system bus.
First Microcontrollers
n IBM started using Intel processors in its PC
¨Intel started its 8042 and 8048 (8-bit
microcontroller) – using in printers
n Apple Macintosh used Motorola
n 1980 Intel abandoned microcontroller business
n By 1989 Microchip was a major player in
designing microcontrollers
¨PIC: Peripheral Interface Controller
Different Microcontrollers (MCU)
http://en.wikipedia.org/wiki/Microcontroller A more complete list is here: http://en.wikipedia.org/wiki/Category:Microcontrollers
What is the
difference?
8/16/24/32 bits
Architecture
Package
Capability
Memory
Software (IDE)/cloud
ADC (10-12 bit)
MCU Architecture
n RISC
¨ Reduced instruction set computer
¨ Simple operations
¨ Simple addressing modes
¨ Longer compiled program but faster to execute
¨ Uses pipelining
¨ Most embedded system
n CISC
¨ Complex instruction set computer
¨ More complex instructions (closer to high-level language
support)
¨ x86 standard (Intel, AMD, etc.), but even in the mainframe
territory CISC is dominant via the IBM/390 chip
Bench marks: How to compare MCUs together
MIPS: Million Instructions / second (Useful when the compilers are the same)
CISC vs RISC
CISC
Pentium/x86 are CISC-based
RISC
ARM-based
Most mobile-phones
Complex instructions require
multiple cycles
Reduced instructions take 1
cycle
Many instructions can reference
memory
Only Load and Store instructions
can reference memory
Instructions are executed one at
a time
Uses pipelining to execute
instructions
Few general registers Many general registers
RISC and CISC architectures are becoming more and more alike.
*Read the LINK on the web site!*
CISC vs RISC
RISC and CISC architectures are becoming more and more alike.
*Read the LINK on the web site!*
The Performance Equation
The following equation is commonly
used for expressing a computer's
performance ability:
The CISC approach
attempts to minimize the
number of instructions per
program, sacrificing the
number of cycles per
instruction.
RISC does the opposite, reducing the
cycles per instruction at the cost of
the number of instructions per
program.
8-bit Controllers…
(Main Players)
n Microchip
¨ RISC architecture (reduced instruction set computer)
¨ Has sold over 2 billion as of 2002
¨ Cost effective and rich in peripherals
n Motorola
¨ CISC architecture
¨ Has hundreds of instructions
¨ Examples: 68HC05, 68HC08, 68HC11
n Intel
¨ CISC architecture
¨ Has hundreds of instructions
¨ Examples: 8051, 8052
¨ Many difference manufacturers: Philips, Dallas/MAXIM Semiconductor, etc.
n Atmel
¨ RISC architecture (reduced instruction set computer) – with CISC instruction set!
¨ Cost effective and rich in peripherals
¨ Claims to be very code efficient – less memory for the same code!
¨ AVR (Advanced Virtual RISC): TunyAVR, MegAVR, XmegaAVR
n Freescale
n Ziglog (Z8)
What is the
difference?
Speed
Package
Power
RAM/ROM
IO Pins
Software (IDE)/cloud
A Bit About ARMs
Architecture (Advanced RISC Machine)
n ARM design takes the RISC based computer design
approach – Linux –like architecture
n ARM is a British semiconductor (and software) design
company that designs and licenses ARM processor
cores to semiconductor manufacturers
¨ They just sell the ARM core
¨ Other manufacturers license the core from them and then design
microcontrollers around that core by adding in peripherals and
memory to suit their design goals
n There are different cores for different applications
¨ Cortex-M0/M0+, Cortex-M3, or Cortex-M4.
ARM Processor IP
Applications of ARM-Based
Microcontrollers
http://en.wikipedia.org/wiki/List_of_applications_of_ARM_cores
Who is using ARM? Check this out!
Most Cellphones!
Design Examples …..
Microcontrollers vs. Microprocessors
MPU-Based Time
and Temperature System
MCU-Based Time
and Temperature System
References
n Computer History Museum: http://www.computerhistory.org/
n Read about microcontrollers:
http://www.mikroe.com/en/books/picbook/2_01chapter.htm
n Lots of good information exist on Wikipedia about microcontrollers
http://en.wikipedia.org/wiki/
n History of transistors:
http://inventors.about.com/library/weekly/aa061698.htm
n Nice transistor timeline by Intel:
http://www.intel.com/technology/timeline.pdf
n I used a few slides from here:
http://www.ceng.metu.edu.tr/courses/ceng336/_documents/introduct
ion.pdf
n ARM related references:
¨ http://mc2.unl.edu/2013/10/03/getting-started-with-arm-microcontrollers/
¨ http://www4.cs.fau.de/Lehre/SS06/HS_AKES/slides/ARM.pdf - Very good reference !
References - RISC
n http://cse.stanford.edu/class/sophomore-
college/projects-00/risc/
n http://en.wikipedia.org/wiki/Complex_instruction_set_co
mputer
n http://en.wikipedia.org/wiki/RISC
n http://arstechnica.com/articles/paedia/cpu/pipelining-
1.ars/4

Chapter_2_Embedded Systems Design_introduction_ARM.pdf

  • 1.
    Chapter 1 Fundamentals of Microprocessorand Microcontroller Dr. Farid Farahmand Updated: Monday, February 5, 2018
  • 2.
    Evolution n First cametransistors n Integrated circuits ¨ SSI (Small-Scale Integration) to ULSI ¨ Very Large Scale Integration circuits (VLSI) n 1- Microprocessors (MPU) ¨ Microcomputers (with CPU being a microprocessor) ¨ Components: Memory, CPU, Peripherals (I/O) ¨ Example: Personal computers n 2- Microcontroller (MCU) ¨ Microcomputers (with CPU being a microprocessor) ¨ Many special function peripheral are integrated on a single circuit ¨ Types: General Purpose or Embedded System (with special functionalities)
  • 3.
    Microcontrollers – Embedded Systems nAn embedded system is a special-purpose computer system designed to perform one or a few dedicated functions often with real-time n An integrated device which consists of multiple devices ¨ Microprocessor (MPU) ¨ Memory ¨ I/O (Input/Output) ports n Often has its own dedicated software
  • 4.
  • 5.
  • 6.
    Microprocessor-Based Systems • CentralProcessing Unit (CPU) • Memory • Input/Output (I/O) circuitry • Buses – Address bus – Data bus – Control bus
  • 7.
  • 8.
    Microprocessor-Based System with Buses:Address, Data, and Control
  • 9.
    Microprocessor-based Systems Microprocessor n Themicroprocessor (MPU) is a computing and logic device that executes binary instructions in a sequence stored in memory. n Characteristics: ¨General purpose central processor unit (CPU) ¨Binary ¨Register-based ¨Clock-driven ¨Programmable
  • 10.
    Microprocessor-based Systems Microprocessor n the“brains” of the computer ¨ its job is to fetch instructions, decode them, and then execute them ¨ 8/16/32/etc –bit (how it moves the data n contains: Arithmetic Logic Unit Register Arrays Control Unit ALU performs computing tasks – manipulates the data/ performs numerical and logical computations Registers are used for temp. storage Control unit is used for timing and other controlling functions – contains a program counter (next instruction’s address and status register) System software: A group of programs that monitors the functions of the entire system
  • 11.
  • 12.
    Microprocessor-based Systems Memory n Memoryis a group of registers n 16 register – address: 0-15 – in binary: 0- 1111; Address lines: A0-A3 n Serves two major purposes q storing the binary codes for the sequence of instructions specified by programs (program) q storing binary data that the computer needs to execute instructions (data)
  • 13.
    Microprocessor-based Systems Memory Types ¨R/W: Read/Write Memory; also called RAM n It is volatile (losses information as power is removed) n Write means the processor can store information n Read means the processor can receive information from the memory n Acts like a Blackboard! ¨ ROM: Read-Only memory; n It is typically non-volatile (permanent) – can be erasable n It is similar to a Page from your textbook
  • 14.
    Microprocessor-based Systems Memory Classification Expensive Fast/ Cheap Slow Onetimeprogrammable Electronically Erasable PROM Basic Technologies: Semiconductor Magnetic Optical (or combination)
  • 15.
    Microprocessor-based Systems Memory Classification Expensive Fast/ Cheap Slow Onetimeprogrammable Electronically Erasable PROM -4/6 transistor to save a single bit - Volatile - Fast but expensive -one transistor and one capacitor to store a bit -Leakage problem, thus requires refreshing -Used for dynamic data/program storage -Cheap and slow!
  • 16.
    Erasable ROMs n MarkedProgrammed ROM ¨ Programmed by the manufacturer n Programmable ROM (PROM) ¨ Can be programmed in the field via the programmer n Erasable Programmable ROM (EPROM) ¨ Uses ultraviolet light to erase (through a quartz window) ¨ OTP refers to one-time programmable n Electrically Erasable Programmable ROM (EEPROM) ¨ Each program location can be individually erased ¨ Expensive ¨ Requires programmer n FLASH ¨ Can be programmed in-circuit (in-system) ¨ Easy to erase (no programmer) ¨ Only one section can be erased/written at a time (typically 64 bytes at a time)
  • 17.
    Microprocessor-based Systems I/O Ports nThe way the computer communicates with the outside world devices n I/O ports are connected to Peripherals ¨ Peripherals are I/O devices n Input devices n Output devices ¨ Examples n Printers and modems, n keyboard and mouse n scanner n Universal Serial Bus (USB)
  • 18.
    Microprocessor-based Systems - BUS nThe three components – MPU, memory, and I/O – are connected by a group of wires called the BUS n Address bus n consists of 16, 20, 24, or 32 parallel signal lines (wires) - unidirectional n these lines contain the address of the memory location to read or written n Control bus ¨ consists of 4 to 10 (or more) parallel signal lines ¨ CPU sends signals along these lines to memory and to I/O ports n examples: Memory Read, Memory Write, I/O Read, I/O Write n Data bus ¨ consists of 8,16, or 32 parallel signal lines ¨ bi-directional ¨ only one device at a time can have its outputs enabled, ¨ this requires the devices to have three-state output
  • 19.
    Expanded Microprocessor-Based System 1.Note the directions of busses 2. What is the width of the address bus? 3. What is the value of the Address but to access the first register of the R/WM? You must know how to draw it! Remember: 111 1111 1111 = 7FF = 2^11-1 = 2047 2^11=2K=2048 2^11 Requires 11 bits
  • 20.
    2K Registers or bytesof memory 000 What? How many bits 001 2K Registers or bytes of memory 800 801 How much memory do we have? What? How many bits Example
  • 21.
    2K (2^11 = 2048) Registersor bytes of memory 000 2^11 -1=7FF Requires 11 bits 001 2K (2^11 = 2048) Registers or bytes of memory 800 FFF Requires 12 bits For a total of 4095 bytes 801 Total of 4K bytes of memory: 2^12 (FFF) Ă  12 bits ; last values 2^12-1 = 4096-1 Example
  • 22.
    1G bytes ofmemory 000 2^30 -1=3FFF FFFF Next number: 4000 0000 (in Hex) 001 Example 8 bits 30 bits!
  • 23.
    800 FFF Example of an8-bit MPU RAM 2K ROM 2K A15 A0 D7 D0 8-bit
  • 24.
  • 25.
    What is aMicrocontroller? n A microcontroller is a small computer on a single integrated circuit containing ¨processor core, ¨memory, ¨programmable input/output peripherals n Used for specific (embedded) applications
  • 26.
    Embedded controllers n Usedto control smart machines n Examples: printers, auto braking systems n Also called microcontrollers or microcontroller units (MCU)
  • 27.
    Embedded controllers Software Characteristics nNo operating systems n Execute a single program, tailored exactly to the controller hardware n Assembly language (vs. High-level language) ¨Not transportable, machine specific ¨Programmer need to know CPU architecture ¨Speed ¨Program size ¨Uniqueness
  • 28.
    Microcontroller Unit (MCU) BlockDiagram n An integrated electronic computing and logic device that includes three major components on a single chip ¨ Microprocessor ¨ Memory ¨ I/O ports n Includes support devices ¨ Timers ¨ A/D converter ¨ Serial I/O ¨ Parallel Slave Port n All components connected by common communication lines called the system bus.
  • 29.
    First Microcontrollers n IBMstarted using Intel processors in its PC ¨Intel started its 8042 and 8048 (8-bit microcontroller) – using in printers n Apple Macintosh used Motorola n 1980 Intel abandoned microcontroller business n By 1989 Microchip was a major player in designing microcontrollers ¨PIC: Peripheral Interface Controller
  • 30.
    Different Microcontrollers (MCU) http://en.wikipedia.org/wiki/MicrocontrollerA more complete list is here: http://en.wikipedia.org/wiki/Category:Microcontrollers What is the difference? 8/16/24/32 bits Architecture Package Capability Memory Software (IDE)/cloud ADC (10-12 bit)
  • 31.
    MCU Architecture n RISC ¨Reduced instruction set computer ¨ Simple operations ¨ Simple addressing modes ¨ Longer compiled program but faster to execute ¨ Uses pipelining ¨ Most embedded system n CISC ¨ Complex instruction set computer ¨ More complex instructions (closer to high-level language support) ¨ x86 standard (Intel, AMD, etc.), but even in the mainframe territory CISC is dominant via the IBM/390 chip Bench marks: How to compare MCUs together MIPS: Million Instructions / second (Useful when the compilers are the same)
  • 32.
    CISC vs RISC CISC Pentium/x86are CISC-based RISC ARM-based Most mobile-phones Complex instructions require multiple cycles Reduced instructions take 1 cycle Many instructions can reference memory Only Load and Store instructions can reference memory Instructions are executed one at a time Uses pipelining to execute instructions Few general registers Many general registers RISC and CISC architectures are becoming more and more alike. *Read the LINK on the web site!*
  • 33.
    CISC vs RISC RISCand CISC architectures are becoming more and more alike. *Read the LINK on the web site!* The Performance Equation The following equation is commonly used for expressing a computer's performance ability: The CISC approach attempts to minimize the number of instructions per program, sacrificing the number of cycles per instruction. RISC does the opposite, reducing the cycles per instruction at the cost of the number of instructions per program.
  • 34.
    8-bit Controllers… (Main Players) nMicrochip ¨ RISC architecture (reduced instruction set computer) ¨ Has sold over 2 billion as of 2002 ¨ Cost effective and rich in peripherals n Motorola ¨ CISC architecture ¨ Has hundreds of instructions ¨ Examples: 68HC05, 68HC08, 68HC11 n Intel ¨ CISC architecture ¨ Has hundreds of instructions ¨ Examples: 8051, 8052 ¨ Many difference manufacturers: Philips, Dallas/MAXIM Semiconductor, etc. n Atmel ¨ RISC architecture (reduced instruction set computer) – with CISC instruction set! ¨ Cost effective and rich in peripherals ¨ Claims to be very code efficient – less memory for the same code! ¨ AVR (Advanced Virtual RISC): TunyAVR, MegAVR, XmegaAVR n Freescale n Ziglog (Z8) What is the difference? Speed Package Power RAM/ROM IO Pins Software (IDE)/cloud
  • 35.
    A Bit AboutARMs Architecture (Advanced RISC Machine) n ARM design takes the RISC based computer design approach – Linux –like architecture n ARM is a British semiconductor (and software) design company that designs and licenses ARM processor cores to semiconductor manufacturers ¨ They just sell the ARM core ¨ Other manufacturers license the core from them and then design microcontrollers around that core by adding in peripherals and memory to suit their design goals n There are different cores for different applications ¨ Cortex-M0/M0+, Cortex-M3, or Cortex-M4.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
    References n Computer HistoryMuseum: http://www.computerhistory.org/ n Read about microcontrollers: http://www.mikroe.com/en/books/picbook/2_01chapter.htm n Lots of good information exist on Wikipedia about microcontrollers http://en.wikipedia.org/wiki/ n History of transistors: http://inventors.about.com/library/weekly/aa061698.htm n Nice transistor timeline by Intel: http://www.intel.com/technology/timeline.pdf n I used a few slides from here: http://www.ceng.metu.edu.tr/courses/ceng336/_documents/introduct ion.pdf n ARM related references: ¨ http://mc2.unl.edu/2013/10/03/getting-started-with-arm-microcontrollers/ ¨ http://www4.cs.fau.de/Lehre/SS06/HS_AKES/slides/ARM.pdf - Very good reference !
  • 42.
    References - RISC nhttp://cse.stanford.edu/class/sophomore- college/projects-00/risc/ n http://en.wikipedia.org/wiki/Complex_instruction_set_co mputer n http://en.wikipedia.org/wiki/RISC n http://arstechnica.com/articles/paedia/cpu/pipelining- 1.ars/4