ECE 353 Introduction to Microprocessor Systems - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

ECE 353 Introduction to Microprocessor Systems

Description:

What does an assembler do? Syntax checking. Offset calculation ... Borland Development Tools. Debugger Primer. So, why is it called a bug, anyway? Terminology ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 39
Provided by: mikemorrow
Category:

less

Transcript and Presenter's Notes

Title: ECE 353 Introduction to Microprocessor Systems


1
ECE 353Introduction to Microprocessor Systems
Week 3
  • Michael J. Schulte

2
Topics
  • 80C188EB Organization (continued)
  • Segmentation
  • Reset Processing
  • Programmers Model
  • 80C188EB Machine Language
  • 80C188EB Assembly Language and Assemblers
  • 80C188EB Debuggers

3
80C188EB/80C186EBImplementation
4
Segmented Memory Architecture
  • Memory Segmentation
  • Logical vs. Physical Addresses
  • Segment Organization
  • Topologies
  • Disjoint
  • Overlapping
  • Identical
  • Physical Address Generation
  • Advantages
  • Disadvantages

5
80C188EBArchitecture
6
80C188EB Programmers Model
7
Programming
  • Programming Languages
  • HLL
  • Assembly Language
  • Machine Language
  • Machine Language Instructions
  • 1 6 bytes in length
  • Encoding

8
Assembler Primer
  • Assembler Types
  • Native Assembler
  • Cross Assembler
  • General Instruction Syntax
  • Assembler Functions
  • What does an assembler do?
  • Syntax checking
  • Offset calculation
  • Encoding to machine code

9
ExampleProgram Hardware
10
Source Code File
.186 use 80186 instructions SWITCHES equ 123
4h define symbols LEDS equ 5678h assume csc
ode establish CS addressability code segment
start of code segment main mov dx,
SWITCHES load switch port address in al,
dx read switches not al switch off turns
LED on mov dx, LEDS load LED port
address out dx, al write to LED
port jmp main and repeat indefinitely code e
nds end of code segment end main code
entry point is at main
11
Assembler Listing File (page 1)
Turbo Assembler Version 4.1 09/12/01
084911 Page 1 week3.ASM
1 .186 use 80186 instructions 2
3 1234 SWITCHES equ 1234h
define symbols 4 5678 LEDS equ
5678h 5 6 assume cscode
establish CS addressability 7
8 0000 code segment start of code
segment 9 10 0000 BA 1234 main mov dx,
SWITCHES load switch port address
11 0003 EC in al, dx read switches
12 0004 F6 D0 not al SW1 --gt LED on
13 0006 BA 5678 mov dx, LEDS load
LED port address 14 0009 EE out dx, al
write to LED port 15 000A EB F4 jmp
main and repeat indefinitely 16
17 000C code ends end of code segment
18 19 end main code entry
point is at main
12
Assembler Listing File (page 2)
Turbo Assembler Version 4.1 09/12/01
084911 Page 2 Symbol Table Symbol Name
Type Value ??DATE Text "09/12/01" ??FILENAM
E Text "week3 " ??TIME Text
"084911" ??VERSION Number 040A _at_CPU
Text 0103H _at_CURSEG Text
CODE _at_FILENAME Text WEEK3 _at_WORDSIZE Text
2 LEDS Number 5678 MAIN Near
CODE0000 SWITCHES Number 1234 Groups
Segments Bit Size Align Combine
Class CODE 16 000C Para none
13
Code Generation Process
14
Intel Hex Record Format
020000021000EC 0C000000BA3412ECF6D0BA7856EEEBF4E
D 00000001FF
Disassembling the data record payload.
BA3412(mov dx, 1234h)EC(in al, dx)F6D0(not al)
BA7856(mov dx, 5678h)EE(out dx, al)EBF4(jmp 12)
15
Borland Development Tools
16
Debugger Primer
  • So, why is it called a bug, anyway?
  • Terminology
  • Typical Debugger Operation
  • Debugging Tools
  • Software
  • Hardware
  • Comparison of Debugging Tools

17
Code Development Tips
  • Use structured programming methods - no spaghetti
    code.
  • Use descriptive symbols and names.
  • Write comments as you go (or before!).
  • When fixing assembler errors, fix only the top
    one or two and re-assemble a lot of the later
    errors may be due to the first few.
  • When debugging, verify what the registers are
    loaded with as compared to what you think they
    should be loaded with.

18
Instruction Decoding Exercise
  • The following memory dump was obtained from an
    80C188EB-based system
  • CS0013 is a valid instruction
  • Decode the memory data to determine the
    instructions that were assembled to produce it.

CS0013 B0 12 BA 34 12 FE C7 EB F7
19
Instruction Decoding Solution
16 000A B0 12 Target mov al,
12h 17 000C BA 1234 mov dx, 1234h 18 000F
FE C7 inc bh 19 0011 EB F7 jmp
Target
20
Wrapping Up
  • Homework 2 due Friday 2/18
  • Reading for next week
  • Chapter 6

21
80C188EB Instruction Encoding
22
JMP Instruction Encoding
23
INC Instruction Encoding
24
Debugging Tools
maybe
yes
Table 5.2-1 in book has some mistakes
25
Disjoint Segments
26
Overlapping Segments
27
Identical Segments
28
JTAG Boundary Cell
29
Simulator
  • Runs on a host computer, and simulates execution
    of your code. No actual hardware required.
  • Strengths
  • Useful for testing before hardware available,
    especially algorithm verification
  • Can use file input to simulate external
    interfaces
  • Weaknesses
  • Slow host must execute many instructions for
    each simulated instruction usually not possible
    to get real-time performance
  • Difficult to simulate complex processor
    environment and interactions need to have models

30
Native Debugger
  • Code is executed on a host computer with a
    compatible instruction set.
  • Strengths
  • Full speed execution
  • Can use file input to simulate external
    interfaces
  • Weaknesses
  • Debugger and UUT share same resources best
    suited for non-I/O parts of code
  • Must have a host computer with a compatible
    instruction set - not always available.

31
Resident Monitor
  • Monitor is a stand-alone program that runs on the
    UUT, typically communicates over serial interface
    to a terminal.
  • Strengths
  • Facilitates downloading and full-speed execution
    and debugging of code on actual hardware
  • Weaknesses
  • Usually have simple command set (i.e. LOAD, GO,
    etc.) and limited ability to display system state
  • Monitor uses system resources, may alter
    performance of UUT software or require additional
    resources
  • Program may crash monitor

32
Remote Debugger
  • Similar to resident monitor, but only small
    debugger kernel on UUT. Main debugger software
    runs on a host computer connected to the UUT.
  • Strengths
  • Facilitates downloading and full-speed execution
    of code on actual hardware
  • Debuggers usually support more advanced features
    (i.e. symbolic debugging, data visualization,
    etc.)
  • Weaknesses
  • Kernel uses (fewer) resources, may alter
    performance of UUT software or require additional
    resources
  • Program may crash kernel

33
(No Transcript)
34
ROM Emulator
  • Hardware plugs into ROM socket on UUT. Usually
    has serial connection to host computer.
  • Strengths
  • No disruption of system operation
  • Quick and easy to load new code to UUT
  • Weaknesses
  • Really just a quicker way to reprogram ROMs in
    place

35
Target Access Probe
  • Replaces the CPU on UUT. Connected to host
    computer for control.
  • Strengths
  • Full visibility of processor bus activity
  • Usually can record and playback execution traces
  • Weaknesses
  • Doesnt give arbitrary control of bus activity
  • Expensive

36
In-Circuit Emulator
  • Replaces UUT CPU with hardware that gives full
    control of CPU pins (i.e. can run arbitrary bus
    cycles). Often contain overlay memory to allow
    testing of software before system hardware is
    available. May clamp over existing CPU that is
    soldered in place.
  • Strengths
  • Complete visibility and control of CPU activity
  • Hardware assisted debugging can set breakpoints
    on specific bus operations (i.e. read X from Y)
  • Record and playback execution traces
  • Weaknesses
  • Even more expensive

37
JTAG Emulators
  • Special serial interface to a device originally
    created just for testing (IEEE Std 1149.1)
  • Boundary Scan
  • Emulation Scan
  • Strengths
  • No extra hardware except for small connector,
    usually left on production boards
  • Complete control over CPU state and operation
  • Can use for production and field
    testing/debugging
  • Weaknesses
  • Relatively slow must load/retrieve CPU serially
  • Actually stops CPU when loading/retrieving

38
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com