eecs 473 advanced embedded systems misc. things midterm review

Post on 21-Jan-2016

229 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

EECS 473Advanced Embedded Systems

Misc. thingsMidterm Review

Exam

• When and Where:– Tuesday 10/27 6-8pm– Rooms: 1500 EECS & 1003 EECS

• If you have a conflict, let Yitian and I know ASAP.• Coverage:

– Everything we’ve done (lab, homework, lecture) other than switching supplies.

• Study:– Sample questions in this presentation– Old exams– Labs, homework.

• HW1 answer key up on Friday

Milestone meetings

• Tuesday during the day– No class on Tuesday– Doodle out later today.

• Basically – You tell us where you are at

• bring 3 copies of MS1 e-mail

– We ask you questions– You ask us questions

• The goal here is not evaluation– It’s to help where we can

Start the Review

• Interface design for hardware

• Real-time systems– Scheduling

• Licensing issues • Software platforms

– Barebones– Barebones w libraries

(Arduino)– RTOS (FreeRTOS)– Full OS (embedded Linux)

• PCBs and power– Terminology– Power integrity– Batteries– Linear regulators

including LDOs

• Design– Expect a design

question

Topic: Interfacing• Writing software interfaces for hardware

– Ideally have a standard interface forboth hardware and programmer.

• Makes it easy to port software.• Also means it’s obvious what hardware control to

provide.

– Like any interface, standardization here is very powerful, but comes at a cost. Abstracting away interface issues makes things less efficient.

» Examples?

Interface questions

• Might be asked to design an API• Might be asked to critique an API

– Arduino, Tinkerforge worth looking at.• Might be asked to explain this figure

or ideas related to it.• Might be asked to explain or apply this figure:

Topic: Real-time systems and scheduling

• Time matters– Hard, soft, firm deadlines

• Validation if very difficult– How do you know the worst case timing?

• Really difficult to prove worst case. Cache misses, branch prediction, etc. make for a very complex situation.

• For safety critical things, even a “large engineering margin” isn’t enough.

– Need to actually figure it out.

"those systems in which the correctness of the system depends not only on the logical result of the computation, but also on the time at which the results are produced";

Topic: Real-time systems and scheduling

• Rate monotonic scheduling– Static priority scheme– Assumes all* tasks are periodic.

• Give priority to tasks with lower period.

– Total utilization helps figure if schedulable.• If is less than n(21/n-1) (n=number of tasks) it is schedulable.• If over 100% not schedulable• If neither is true, do critical

instant analysis.

• EDF– Requires dynamic priorities– Works if less than 100% utilization

Example scheduling questions• Find a set of tasks with % utilization, period, etc. that

RM can’t schedule but EDF can.• Solve specific problems:

• Explain properties of EDF/RMS/RR/FIFO.– We didn’t do much in class with RR and FIFO…

• Why might we prefer RMS over EDF?

GroupT1

ExecutionTime

T1Period

T2ExecutionTime

T2Period

T3ExecutionTime

T3Period

CPUUtilization?

RMSchedulable?

EDFSchedulable?

A 1 3 1 3 1 3    

B 1 6 2 4 1 10    

C 1 2 1 3 1 4    

D 2 5 4 7    

Topic: Software platform• We covered three or four basic platforms for software

development for an embedded system.– Barebones

• Write everything yourself

– Barebones plus libraries• Import some useful libraries but otherwise write it all yourself.

– RTOS• Basic scheduler with a lot of control• Generally a fair bit of support.

– I/O devices, memory management, etc.

• Fast interrupts processing possible/reasonable/”easy”

– Full OS• Give up a lot of control• Have to deal with a very complex system• Get lots (and lots) of software support

– Vision, databases, etc.

FreeRTOS

• Tasks and scheduling– Creating tasks (xTaskCreate)– Semaphores– Deferred interrupt processing.– Can dynamically change priority.

FreeRTOS questions

• Given needed function prototypes used in lab:– Write code which does RM scheduling of two tasks.

• “A” has a period of 10 clocks and runs for at most 4 clocks. • “B” has a period of 6 clocks and runs for at most 3 clocks.

– Might also be asked to handle deferred interrupts and semaphores

• What is the difference between Ready, Running, Blocked and Suspended in the diagram to the right?

Embedded Linux

• What limitations on real-time you might have• Can be fairly small

– Things like busybox help• I/O has a standard interface

– File model• Not always ideal.

• But there is a lot of complexity here– We spent a fair bit of time writing drivers.

1) Consider the following code for a Linux module. [12 points] struct file_operations memory_fops = { .read = memory_read, .write = memory_write, .open = memory_open, .release = memory_release }; module_init (memory_init); module_exit (memory_exit); int memory_major = 60; char *memory_buffer; int memory_init (void) { int result; result = register_chrdev (memory_major, "memory", &memory_fops); if (result < 0) { printk ("<1>memory: cannot obtain major number %d\n", memory_major);}

a) What is is “register_chrdev” doing? Describe how each of the 3 arguments is used. [6]

b) The module_init() and module_exit() do something very similar to the memory_fops initialization code. Why are they being done in a different way? Address why we don’t use just one scheme or the other. [6]

More questions

• What is busybox? Why is it useful?

• Explain how a “file” in /dev gets linked to a given LKM.

Licensing

• What a viral license is– Why it matters in embedded perhaps more than

elsewhere.• LKM• Impact on business model• Hardware people tend to use a lot of other people’s

code (legally).– Vendor’s driver code etc.

– Libraries.• GPL and Creative Commons Licensing.

PCBs

• Basic terminology and issues– Trace, mil, thou, via, silkscreen, clearance, layers,

rat’s nest, etc.– Through-hole vs surface mount– Schematic vs. Layout– When to “neckdown”

Power integrity

• Discuss keeping Vcc/GND constant as possible.– Recognize that our devices can generate current

draw variations at a huge number of frequencies.– Spikes or droops could break our device.

• Need caps.– Small and large– Get right values

Batteries

• Understand mAh– Understand that mAh will be less if draw too

quickly.– Be able to work basic math using specific battery

properties.

Simple battery example

• 800mAh battery. – If we need 3.5V (or

more) how long will this battery last at a 1.6A draw?

Battery note

• Be very careful putting batteries in parallel.– Homework question made it seem easy

• And it generally is

– But putting two battery packs in parallel that aren’t balanced (same charge) for some reason can cause problems.

• Where problems can include a fire.

• Overcharge examples:• https://www.youtube.com/watch?v=gz3hCqjk4yc• https://www.youtube.com/watch?v=IsgnZCEeqsE

Other things

• Linear regulator– Understand ideal

• Or nearly ideal with just a constant IQ.

– Be able to read and use a Linear regulator part specification

Design

• Expect a design question– We’ll give you the datasheet (or needed parts of a

datasheet) for some part. – You’ll be asked to do some design.– Code will probably be Arduino (easiest to work

with)• We’ll also give you any Arduino APIs needed.

top related