Beruflich Dokumente
Kultur Dokumente
Embedded Systems
5 - Development of microprocessor-based systems
Example
RMR2012
Software architecture
Functional description must be broken into pieces: division among people; conceptual organization; performance;
2008 Wayne Wolf
testability; maintenance.
RMR2012
Hardware and software are intimately related: software doesnt run without hardware; how much hardware you need is determined by the software requirements:
Maths is not everything
speed; memory.
RMR2012
Software components
Need to break the design up into pieces to be able to write the code. Some component designs come up often. A design pattern is a generic description of a component that can be customized and used in different circumstances.
RMR2012
State machine keeps internal state as a variable, changes state based on inputs. Uses:
control-dominated code; reactive systems.
Maths is not everything
RMR2012
in1=1/x=a
B
r=1/out1=0
r=0/out2=1
in1=0/x=b
s=0/out1=0
2008 Wayne Wolf
Maths is not everything
C
s=1/out1=1
RMR2012
C code structure
RMR2012
RMR2012
May need to devise software stubs to allow testing of software elements without the full hardware/software platform.
Host/target design
target system
serial line
RMR2012
host system
Host-based tools
Cross compiler:
compiles code on host for target system.
Cross debugger:
displays target state, allows target system to be controlled.
Maths is not everything
RMR2012
Evaluation boards
Designed by CPU manufacturer or others. Includes CPU, memory, some I/O devices. May include prototyping section. CPU manufacturer often gives out evaluation board netlist---can be used as starting point for your custom board design.
RMR2012
Programmable logic devices (PLDs) provide low/medium density logic. Field-programmable gate arrays (FPGAs) provide more logic and multi-level logic.
2008 Wayne Wolf
RMR2012
The PC as a platform
Advantages:
cheap and easy to get; rich and familiar software environment.
Disadvantages:
requires a lot of hardware resources;
Maths is not everything
RMR2012
RMR2012
Challenges:
target system may be hard to observe; target may be hard to control; may be hard to generate realistic inputs; setup sequence may be complex.
Maths is not everything
RMR2012
Software debuggers
A monitor program residing on the target provides basic debugger functions. Debugger should have a minimal footprint in memory. User program must be careful not to destroy debugger program, but , should be able to recover from some damage caused by user code.
RMR2012
Breakpoints
A breakpoint allows the user to stop execution, examine system state, and change state. Replace the breakpointed instruction with a subroutine call to the monitor program.
Maths is not everything
RMR2012
ARM breakpoints
0x400 0x404 ADD r2,r2,r4 0x404 0x408 ADD r0,r0,#1 0x408 0x40c 0x40c B loop uninstrumented code
Maths is not everything
RMR2012
Save registers. Allow user to examine machine. Before returning, restore system state.
Safest way to execute the instruction is to replace it and execute in place. Put another breakpoint after the replaced breakpoint to allow restoring the original breakpoint.
RMR2012
In-circuit emulators
A microprocessor in-circuit emulator is a specially-instrumented microprocessor. Allows you to stop execution, examine CPU state, modify registers.
2008 Wayne Wolf
RMR2012
Logic analyzers
RMR2012
UUT
system clock
microprocessor
clock gen
Maths is not everything
RMR2012
- Checking memory (e.g. cache misses) or I/O access - Checking execution time (marks needed)
RMR2012
RMR2012
Manufacturing testing
Goal: ensure that manufacturing produces defect-free copies of the design. Can test by comparing unit being tested to the expected behavior.
But running tests is expensive.
RMR2012
Testing concepts
RMR2012
Faults
Manufacturing problems can be caused by many things. Fault model: model that predicts effects of a particular type of fault. Fault coverage: proportion of possible faults found by a set of test.
Maths is not everything
RMR2012
RMR2012
01
2008 Wayne Wolf
RMR2012
Combinational testing
Every gate can be stuck-at-0, stuck-at-1. Usually test for single stuck-at-x faults
One fault at a time. Multiple faults can mask each other.
RMR2012
Sequential testing
RMR2012
Fault behavior on one cycle can be masked by same fault on other cycles.
Scan chains
RMR2012
Test generation
Automatic test pattern generation (ATPG) programs: produce a set of tests given the logic structure. Some faults may not be testable--redundant.
Maths is not everything
redundancy may have been added for avoiding glitches Timeout on a fault may mean hard-to-test or untestable.
RMR2012
Boundary scan
RMR2012
JTAG
Poll the state-storage buffer (for information stored at watchpoint trigger) Poll the program counter (PC)
RMR2012
RMR2012
Alarm on PM
light
set time
Maths is not everything
Alarm ready
set alarm hour minute
RMR2012
button
Operations
Set time: hold set time, depress hour, minute. Set alarm time: hold set alarm, depress hour, minute. Turn alarm on/off: depress alarm on/off.
Maths is not everything
RMR2012
RMR2012
Lights*
Display
1 1
Mechanism
1
Buttons*
RMR2012
Speaker*
Lights*
Buttons*
Speaker*
set-time(): boolean set-alarm(): boolean alarm-on(): boolean alarm-off(): boolean minute(): boolean hour(): boolean
buzz()
RMR2012
Display class
Display time[4]: integer alarm-indicator: boolean PM-indicator: boolean set-time() alarm-light-on() alarm-light-off() PM-light-on() PM-light-off()
RMR2012
Mechanism class
Mechanism Seconds: integer PM: boolean tens-hours, ones-hours: integer tens-minutes, ones-minutes: integer alarm-ready: boolean alarm-tens-hours, alarm-ones-hours: integer alarm-tens-minutes, alarm-ones-minutes: integer
2008 Wayne Wolf
Maths is not everything
scan-keyboard() update-time()
RMR2012
Update-time behavior
display.set-time(current time)
AM->PM PM=true
PM->AM PM=false
RMR2012
Scan-keyboard behavior
Alarm-off
RMR2012
System architecture
Includes:
periodic behavior (clock); aperiodic behavior (buttons, buzzer activation).
RMR2012
Interrupt-driven routine
Timer probably cant handle one-minute interrupt interval. Use software variable to convert interrupt frequency to seconds.
2008 Wayne Wolf
RMR2012
Foreground program
check_alarm(); }
RMR2012
Testing
Component testing:
test interrupt code on the platform; can test foreground program using a mock-up.
System testing:
relatively few components to integrate;
2008 Wayne Wolf
RMR2012