22
Research Overview John Regehr Sept 06

Research Overview John Regehr Sept 06. Part 1 – Embedded Systems

Embed Size (px)

Citation preview

Research Overview

John Regehr

Sept 06

Part 1 – Embedded Systems

Embedded Systems Account for >99% of new

microprocessors Consumer electronics Vehicle control systems Medical equipment Etc.

Definitions of “Embedded System”

1. A special-purpose computer that interacts with the real world through sensing and/or actuation

2. A computer that you don’t think of as a computer

3. Almost any computer that isn’t a PC

4. …

More definitions Microprocessor: A regular CPU Microcontroller: A system on chip that

contains extra support for dealing with the real world Analog to digital and digital to analog converters Pulse width modulation Networks: serial, I2C, CAN, USB, 802.15.4, etc… General-purpose I/O pins Lots of interrupts Low-power sleep modes Voltage / frequency scaling Temperature / vibration resistance

Incremental cost of an extra feature is near zero

Why Are Microcontrollers Cool?

Because you can easily make almost anything smart Microcontroller: Under $1

Contains almost everything you need Board space + support logic: Cheap GNU compilers: Free

Hardest part: Writing the software Embarrassment of riches… But, this is a serious problem

Fun Microcontroller Example: ChipCon 2430 8051 processor

Old-style 8-bit, originated at Intel 32 MHz, 8 KB RAM, 128 KB Flash

802.15.4 radio on-chip Short-range, low-power wireless Zigbee is based on this

Low power: 25 mA for CPU + Zigbee receive Low cost: <$4 in large quantities This has potential to be big

Cheaply add wireless connectivity to any device Examples?

What Do Embedded Systems Do?

Five main categories: Digital signal processing Control – open loop or closed loop Networking – wired or wireless User interfacing – speech, text, graphics, … Data storage

Most embedded systems do 1-4 of these Which apply to:

Cell phone? LinkSys home router? Cruise control? iPod?

Issues Cutting Across System Designs

These are external system requirements not directly tied to what a system does Safety critical Real-time Upgradeable Energy-efficient Cost sensitive Highly available or fault-tolerant Secure Distributed

Dealing with these is very hard

Problems Creating Software Significant number of projects fail due to

problems creating good software Fail means…

Project unacceptably delayed Software has unacceptably low quality

Extreme cases: Spacecraft lost or people killed

Important skills for you to have: System-level understanding Debugging Testing Critical thinking Selective paranoia

Don’t underestimate the difficulty of creating good software

Future of Embedded Systems

Future is bright 1.6 B ARM processors sold in 2005

Trends for new systems Software intensive Networked Many new designs will use 32-bit chips Many new designs will be heterogeneous

multiprocessors / NoC

CE is a great major People skilled in software + control, signals,

circuits, analog are extremely valuable CS and EE curricula both miss the boat on this Lots of jobs for people like you

Part 2 – Research Overview

A Day in the Life…

Teaching – 20% Research

Advising students – 15% Writing papers – 15% Writing grants – 10% Travel – 10% My own research – 10%

Service Department service – 10% External service – 10%

My Research Algorithm

1. Find a problem that embedded system programmers have Another embarrassment of riches

2. Create a software tool that solves the problem Solution should involve ideas from compilers

and operating systems

3. Publish paper describing the solution As a professor, must do this

4. Sometimes: Release tool as open source Doing this well is a lot of work

It’s (sometimes) easy and (usually) fun!

Example Tool: Saving RAM

Observation 1: RAM is often the most limited resource on a microcontroller < 1 KB is common on inexpensive chips Running out of RAM == hosed

Observation 2: Many programs use RAM very poorly We ran an experiment showing that many

programs use only 1 bit out of every allocated byte, on average

How to Save RAM?1. Identify variables that use RAM poorly, e.g.

Boolean A uses 1 bit Enumerated type B with 6 variants uses 3 bits Pointer C that references a buffer of 16 elements

uses 4 bits Integer D with range -10 to 20 uses 5 bits

2. Perform bit-level packingstruct {

A_compressed : 1;

B_compressed : 3:

C_compressed : 4;

D_compressed : 5;

} compressed_variables;

Challenge: Do this all automatically!

How to Save RAM Cont’d

Machine-generated compression and decompression functions are needed

void * decompress_ptr (int compressed) {

switch (compressed) {

case 0: return (void *)0xabcd;

case 1: return (void *)0x1214;

case 2: return (void *)0xaa55;

}

}

How to Save RAM Cont’d

How do we automatically find limited-bitwidth variables? WRONG – look at the types

E.g. bools, enums, etc. These can lie! – if they do, compressing will

break the system RIGHT – use dataflow analysis

Analysis is conservative – if it says a variable has limited bit-width, it does

Dataflow Analysis

x = y-7

test x

z-flagset?

w = 10 w = 2*x

mem[w] = 7

YES NO

Z-flag = If z=1 then x=[0,0]If z=0 then x=[1,4]

x = [0,]y = [7,11]w = [0, ]

x = [0,4]y,w remainsthe same

w = [10,10]x = [0,0]

x = [1,4]w = [2,8]

x = [0,4]w = [2,10]

RAM Compression

Difficulties: Dataflow analysis is difficult when there are

interrupts, threads, pointers, etc. We solved these problems

This transformation will slow down execution How to deal with this?

This transformation will bloat code size How to deal with this?

Work is ongoing – no real results yet Being done by Nathan Cooprider, a PhD student

We also created tools to:

Avoid the need to declare variables as volatile

Detect potential for stack overflow Predict worst-case execution time Prevent ALL pointer and array errors in C

code Do automatic stress testing Optimize much better than GCC Compile towards application-specific goals

Summary

Embedded systems are fun Courses to keep in mind

Myers: Embedded Systems Regehr: Advanced Embedded Systems Provancher (ME): Advanced Mechatronics

Research is fun I’m always looking for smart people to work

in my group But generally people who have taken my

advanced embedded systems course