Lecture 2
Lecture 2
Fundamental Concepts
Pangun Park
Chungnam National University
Information Communications Engineering
Processor(s)
Power
Host Machine Chapter 1
SPMU296 – April 2013
Hardware
evaluation platform for ARM® Cortex™-M4F-based microcontrollers. The Tiva C Series LaunchPad design
highlights the TM4C123GH6PMI microcontroller USB 2.0 device interface, hibernation module, and motion
Hardware
control pulse-width modulator (MC PWM) module. The Tiva C Series LaunchPad also features
programmable user buttons and an RGB LED for custom applications. The stackable headers of the Tiva
C Series TM4C123G LaunchPad BoosterPack XL interface demonstrate how easy it is to expand the
functionality of the Tiva C Series LaunchPad when interfacing to other peripherals on many existing
BoosterPack add-on boards as well as future products. Figure 1-1 shows a photo of the Tiva C Series
LaunchPad.
MSP430 MSP430
LaunchPad-Compatible LaunchPad-Compatible
BoosterPack Interface BoosterPack Interface
3
Embedded System Development
Embedded PlatformPlatform
System Development
Processor(s)
Power
Host Machine Chapter 1
SPMU296 – April 2013
Hardware
evaluation platform for ARM® Cortex™-M4F-based microcontrollers. The Tiva C Series LaunchPad design
highlights the TM4C123GH6PMI microcontroller USB 2.0 device interface, hibernation module, and motion
Hardware
control pulse-width modulator (MC PWM) module. The Tiva C Series LaunchPad also features
programmable user buttons and an RGB LED for custom applications. The stackable headers of the Tiva
C Series TM4C123G LaunchPad BoosterPack XL interface demonstrate how easy it is to expand the
functionality of the Tiva C Series LaunchPad when interfacing to other peripherals on many existing
BoosterPack add-on boards as well as future products. Figure 1-1 shows a photo of the Tiva C Series
LaunchPad.
MSP430 MSP430
LaunchPad-Compatible LaunchPad-Compatible
BoosterPack Interface BoosterPack Interface
On-board
Debugger
Programmer
System
Processor
Host Machine
SW
Code Tools
Version Executable
IDE
Control Loader
Ø Personal Computers
• Personal à MegaBytes
Computers – TeraBytes
MegaBytes – TeraBytes 1 Byte
1 Bit
• Embedded Systems KiloBytes - MegaBytes
Ø Embedded Systems à KiloBytes - MegaBytes
Memory Models
Memory Models Address
Data Address
Data
Address
Data Address Byte Byte Byte Byte 0x00000000
Data 0 1 2 3
Byte Byte Byte Byte 0x00000000
0xFF 0
Byte 1
Byte 2
Byte 3
Byte 0x00000004
0xFF
0xFE 0
Byte 1
Byte 2
Byte 3
Byte 0x00000004
0xFE 0
Byte 1
Byte 2
Byte 3
Byte
… 0x00000008
0
Byte 1
Byte 2
Byte 3
Byte
…
0x08 0x00000008
0x08
0x07 4 Giga Bytes 0 1 2 3
256 Bytes 0x07 4OfGiga Bytes
Memory
256 Bytes 0x06
Of Memory 0x06
0x05 Of Memory
(232 Bytes) …
Of
(2Memory
8 Bytes) 0x05
0x04 32
(2 Bytes) …
Increments
Increments
by 4 Bytes
(28 Bytes) 0x04
0x03
by 4 Bytes
0x03
0x02
0x02
0x01
0x01
0x00 Byte Byte Byte Byte
0x00 0
Byte 1
Byte 2
Byte 3
Byte 0xFFFFFFFC
1 Byte 0 1 2 3 0xFFFFFFFC
1 Byte 1 Bit 32 bits wide
1 Bit 32 bits wide
Memory
Ø Capacity
Hierarchy Expensive, Fast
(low latency),
Power
Ø Small Capacity
Volatility
Volatile Memories:
• SRAM
Non-Volatile Memories:
• ROM/PROM/EPROM/EEPROM
• DRAM • Flash
• Volatility:
• SDRAMThe ability for memory to hold
• Diskdata
1 without power
• Volatile Memory
• Register – Loses data when power
(most) removed
• Tape 1
• Non-Volatile – Retains data when power is removed
1Not used in modern design
Many pros and cons to the
Non-Volatile Memories:different technologies
• ROM/PROM Programmable only once
Tradeoffs
§ Want memory with:
Off-Chip Memories
Ø High Capacity Cheap,
• Want memory with: High latency,
Ø Low Latency Large Capacity
• High Capacity
Ø Low Power
• Low Latency On-Chip Memories
• Low
Ø High Reliability
Power
• High Reliability
§ Usually cannot
Expensive, External Memory
get all of these
…but Low latency, (Disc, Tape)
Bus Controller
ALU
Interrupt
Controller
Power Management
Computer Bus
Processor
Input Input
ports External Physical signals
RAM circuits devices
Output Output
ports signals
ROM
Address Control
Data
Harvard architecture of an
ARM® Cortex-M-based von Neumann architecture
microcontroller.
Memory Interfaces
§ CPU Reads or Writes data to Memory through Bus and Memory
Controllers
Requires or
• CPUØ Reads Address,
WritesData,
dataandto
Read/Write
Memorysignal
through Bus and Memory
Controllers
• Requires Address, Data, and Read/Write signal Memory
____
Read/Write
CPU
Memory Controller
Bus Controller
Registers Data
Address
ALU
Strobe
Enable
Flash
Linker CPU
File
SRAM
Command *.c
*.c Compiler &
SRCS Executable
Line Options Linker Peripherals GPIO
*.c
*.c Microcontroller
libs
Build System
Flash
CPU
Linker
File SRAM
Command *.c
*.c Compiler &
SRCS Executable Peripherals GPIO
Line Options Linker
Microcontroller
*.c
*.c
libs
Build System
Platform Dependent
Platform
Pangun Park (CNU) Dependent 31
Memory
§ Four types of storage needed for a program
Ø Code Memory
mory Ø
Ø
Data Memory
Runtime State of Program (Register Memory – Internal to chip)
Ø External
types of stoage neededMemory
for a(ifprogram
applicable) Microcontroller
de Memory CPU Code
Memory
a Memory Registers
ntime State of Program
Data
Memory
Peripherals GPIO
Registers Registers
Controller
CPU
Flash
require a controller to Flash
manage interface to CPU
Controller
Bus Controller
SRAM
• Internal Bus also has a SRAM
controller
Command *.c
*.c Compiler &
SRCS Executable SRAM
Line Options Linker
Address Space
(Ranges for
each device)
CPU§ Registers
Ø R0-R12
Special purpose track and control CPU state
General Purpose store
operation operands
• R0-R12
Register Contents
§ Register data constantly changes
Data is loaded in from memory
Ø
SRAM
CPU
Ø Results are stored back to memory Load into R4
• Register data constantly changes
§ Application Binary Interface (ABI)
• Data is loaded in from memory
provides architecture details to
• Results are stored
Compiler back to
/ Software memory
Programmer
§ Example Assembly relative load:
• Application Bus Interface
ldr Binary
r1, [r7,#8]Interface (ABI)
provides architecture
LDR rn [pc, #offsetdetails topool]
to literal
Compiler / Software Programmer
; load register n with one word
; from the address [pc + offset] Store from R10
Example Assembly relative load/store:
ldr r1, [r7,#8]
str r1, [r7,#8]
Ø Time - data are encoded as a period, frequency, pulse width, or phase shift
Architecture of
TM4C123
microcontroller.
1 Byte = 8 Bits
1 Byte = 8 Bits
𝑏7 𝑏6 𝑏5 𝑏4 𝑏3 𝑏2 𝑏1 𝑏0
𝑏7 𝑏6 𝑏5 𝑏4 𝑏3 𝑏2 𝑏1 𝑏0
Most Least
Most Least
Significant Bit Significant Bit
Significant Bit Significant Bit
(MSb) (LSb)
(MSb) (LSb)
§ Observation:
Ø If the least significant binary bit is zero, then the number is even.
Ø Consider an 8-bit unsigned number system.
• If bit 7 is low, then the number is between 0 and 127, and if bit 7 is high then the
number is between 128 and 255.