1 / 20

ELN5622 Embedded Systems Class 9 Spring, 2003

ELN5622 Embedded Systems Class 9 Spring, 2003. Aaron Itskovich itsk ova @ algonquincollege .com. Outline. Control systems/robotics Sensors Actuators Feedback (Open loop vs. closed loop) System performance Profiling Optimization Speed vs. size Bottlenecks Stack depth

hollye
Download Presentation

ELN5622 Embedded Systems Class 9 Spring, 2003

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ELN5622Embedded SystemsClass 9Spring, 2003 Aaron Itskovichitskova@algonquincollege.com

  2. Outline • Control systems/robotics • Sensors • Actuators • Feedback (Open loop vs. closed loop) • System performance • Profiling • Optimization • Speed vs. size • Bottlenecks • Stack depth • Iterative enhancements

  3. Control systems introduction • What is control system?

  4. Control systemsIntroduction • Control design specifications provided by the user usually come asa vague set of wants,e.g. • The door has to open before a person can walk into the glasspanel. • The train has to slow down enough to stop before theend of the track. • The same output power should be supplied to the transmittereven during changes in supply voltage. • Vibration of the read head of the CD reader due to a car drivingon a normal road should not cause the CD to lose track.

  5. Open loop vs. Closed loop Open loop Closed loop

  6. Control system example • House temperature control • Sensors • Temperature • Humidity • Actuators • Furnace on/off • Fan • Air conditioner on/off

  7. Sensors • Temperature • Contact: Thermocouple, resistance based, thermistors • Non contact: Infrared specter, Optical specter • Distance (Infrared, ultrasound, radio) • Motion/position indication • Image recognition/machinevision • Force (etc pressure)

  8. Actuators • DC motor control (PWM) • Step motor • Servo motor • Switches • MEMS

  9. Optimization • Things to consider when programming : • Register, cache and main memory utilization • System timing constraints • Variable optimization • Number of branches and function calls • Stack depth • Resulting application size

  10. Assembly may be required • In order to improve the run-time efficiency of some algorithms, it may be necessary to code them in assembly language • This practice may also be used in an effort to condense the space required to store the program data in the system memory

  11. count1( unsigned char c) { unsigned char mask = 1; unsigned char count = 0; while (c) { if (c && mask) count++; mask = mask << 1; } return count; }

  12. pshx ; allocate 2 byte auto variable des ; allocate 1 byte auto variable pshy ; Save stack frame tsy ; Set current stack frame ldx *ZD5 pshx ; pushed register *ZD5 ;;;END PROLOGUE ldab *ZD0+1 stab 2,y ; movqi: *ZD0 -> 2,y ldab #1 stab 3,y ; movqi: #1 -> 3,y ldab #0 stab 4,y ; movqi: #0 -> 4,y L2: ldab #0 stab *ZD5+1 ; movqi: #0 -> *ZD5 tst 2,y ; tstqi: MEM:2,y bne .+5 jmp L5 ; (beq) long branch ldab #1 stab *ZD5+1 ; movqi: #1 -> *ZD5 ; END L5: ldab *ZD5+1 ; tstqi: R:*ZD5 beq .+5 jmp L4 ; (bne) long branch jmp L3 L4: ldab #0 stab *ZD5+1 ; movqi: #0 -> *ZD5 tst 2,y ; tstqi: MEM:2,y bne .+5 jmp L7 ; (beq) long branch tst 3,y ; tstqi: MEM:3,y bne .+5 jmp L7 ; (beq) long branch ldab #1 stab *ZD5+1 ; movqi: #1 -> *ZD5 L7: ldab *ZD5+1 ; tstqi: R:*ZD5 bne .+5 jmp L6 ; (beq) long branch ldab 4,y addb #1 stab 4,y ; addqi3: 4,y by #1 -> 4,y

  13. L6: ldab 3,y aslb stab 3,y ; ashlqi3: 3,y by #1 -> 3,y jmp L2 L3: ldab 3,y clra std *ZD5 ; zero_extendqihi2: 3,y -> *ZD5 ldd *ZD5 std *ZD0 ; movhi: *ZD5 -> *ZD0 jmp L1 jmp L1 jmp L8 jmp L1 L8: L1: ;;;EPILOGUE pulx ; Pulling register *ZD5 stx *ZD5 puly ; Restore stack frame pulx ; deallocate 2 byte auto variable ins ; deallocate 1 byte auto variable rts ; return from function ;;;----------------------------------

  14. What to optimize • In order to enhance the performance of the system, we must first determine where it is deficient! • We get this information by performing tests on the system • The tests must be representative applications or kernels of the representative applications

  15. Profiling • One method of finding the performance of the system is to profile its performance • In software, each instruction, instruction block, loop or function may be analyzed gather critical information • This information may include frequency of execution, execution time in a loop, or latencies associated with function calls • This information provides the designer with detailed information to perform application tuning

  16. Bottleneck Analysis • One consequence of the Forced Flow Law is that the device utilization Ui is directly proportional to the service demand being placed on the device Di. • In more practical terms, if the memory system has the slowest service time but it has a high demand (large number of accesses) placed on it, it becomes the performance limiting factor for the entire system.

  17. Iterative performance enhancement • In general, as you proceed to fix each bottleneck, you will undoubtedly discover new ones • Performance enhancements for embedded systems may become an iterative process • This is especially true if the system has to perform tasks within strict time bounds

  18. Bottleneck elimination • As a general rule, the largest system bottleneck should be eliminated first • Once this is done, each newly discovered bottleneck must be recursively eliminated • Remember, sometimes a hardware bottleneck is caused by poor programming practices • The embedded system designer must be mindful of all system aspects (hardware and software)

  19. Software optimisation • Speed vs. size • Lookup vs. search • Table based approach • Loop transformation • branching • Interrupt vs. Polling

  20. Hardware optimizations • DMA (burst, cycle stealing, ..) • Buffers (FIFO) • Co-processors • Floating point Arithmetic • Communication

More Related