Download presentation
Presentation is loading. Please wait.
Published byRemington Rundle Modified over 9 years ago
1
Jon Stanley EE382N-4 Spring 2011
2
Objectives Tasks Keil MCB2300 ARM7 Evaluation Board ◦ System overview ◦ Measurement setup ◦ Instruction power usage ◦ Code power comparison Beagleboard-XM ◦ System overview ◦ Android and Ubuntu OS experience ◦ Measurement setup ◦ Code power comparison Summary Other notes
3
Explore several points in Lecture 16 on Power Aware Computing Characterize power of an ARM processor Characterize energy use of code ◦ Low level (bare metal) ◦ High level (Linux OS) ◦ Coding methods
4
Power and energy measurements Software ◦ Instruction level ◦ Small routines ◦ C-code comparisons: Delays, timer interrupts, OS scheduling ◦ Linux OS impact ◦ Optimization impact ◦ Data type size impact Hardware ◦ Keil MCP2300 and Beagleboard-XM
5
NXP LPC2387 microcontroller ◦ ARM7 processor core ◦ GPIO to LEDs, ADC I/O, etc. uVision IDE and Flash Magic for programming Bare metal code ◦ More accurate measure of power ◦ Can measure power of each instruction type
6
Measurement setup ◦ Ammeter with uA resolution due to tiny changes in power consumption of different instructions ◦ Use good shielded probe to VBUS jumper on board ◦ Careful of current drift if instrument isn’t high quality
7
0loopADD R0, R0, #1 1ADD R1, R1, #1 2ADD R2, R2, #1 3ADD R3, R3, #1 4ADD R4, R4, #1 5ADD R0, R0, #1 … 999ADD R4, R4, #1 B loop Same instruction 1000 times to minimize effect of Branch on power Consider data hazards when writing test code
8
InstructionCurrent (mA) NOP41.94 MOV41.56 ADD41.59 ADD with stall41.51 ADD with LSL41.52 MOV with LSL41.57 MUL41.65 B41.05 PC Load to Jump40.86 NOP uses more power? Stalled pipeline uses less power, but uses more energy due to longer execution time ADD uses less power than MUL MOV to PC uses less power than Branch
9
loopADD R0, R0, #1 CMP R0, #1 ADDLT R1, R1, #1 ADDEQ R1, R1, #1 ADDGT R1, R1, #1 B loop No measurable difference at instruction level Branch would be better when there is large amounts of code between each conditional statement to reduce execution time loopADD R0, R0, #1 CMP R0, #1 BLT jump BEQ jump jumpADD R1, R1, #1 B loop MethodCurrent (mA) Conditional42.33 Branch42.33
10
C Code LED PWM dimming Timer interrupt PWM ◦ Interrupt handler ◦ LED control by interrupt Delay PWM ◦ Main loop uses delays ◦ Main loop controls LED Surprising result? ◦ Delay did not put processor in idle (like OS sleep). ◦ Tests were repeated later in Linux OS. MethodCurrent (mA) Interrupt92.31 Delay92.31
11
Released in 2010 Features: ◦ TI DM3730 microcontroller 1GHz ARM Cortex-A8 core ◦ 512MB DDR ◦ Ethernet 10/100 ◦ 4-port USB ◦ RS232 ◦ Stereo audio ◦ S-video and DVI ◦ Boots from 4GB MicroSD card ◦ Comes with Angstrom Linux OS verification image ◦ Power usage is a realistic scenario of a system
12
Installation files: http://software- dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android _DevKit/02_00_00/exports/AM37X.tar.gz README is contained within the tarball PC with Ubuntu 10 to build file system on SD card Android boot-up and program execution was slow Not friendly for developing code within OS
13
Installation files and instructions: http://elinux.org/BeagleBoardUbuntu Use instructions for “ Demo Image - Maverick 10.10 ” ◦ Installation will take at least 4 hours ◦ Need internet connectivity - use “dhclient usb1” to get IP ◦ Note: the NetInstall method resulted in broken OS for me PC with Ubuntu 10 to build file system on SD card Ubuntu GUI runs faster than Android ◦ Built-in terminal and friendly for developing within OS ◦ “sudo apt-get install gcc” to install GCC compiler
15
Hardware: BeagleBoard with Ubuntu ◦ Fluctuating current consumption so a DMM is not practical for an average current measurement ◦ NI cDAQ-9174 with 9227 analog current module ◦ Sample current consumption at 2kS/sec ◦ Measure average current with ~1.5 minute window ◦ Turn off user-defined LEDs to reduce noise echo none >/sys/class/leds/beagleboard\:\:usr0/trigger echo none >/sys/class/leds/beagleboard\:\:usr1/trigger Software: 2 C-codes for each test ◦ First code has simple for loop for current measure ◦ Second code uses gettimeofday() and runs the same for loop 1000 times to determine average runtime
16
Simple code that accumulates iteration count main() { int i,c; while(1) { for(i=0;i<10000;i++) c += i; }
17
Idle OS Running Test Program
18
HW2 exercise – gcc creates poor asm code that performs unnecessary memory operations Direct correlation to energy consumption Energy = V * (I code – I IdleOS ) * T 3x decrease in energy consumption by eliminating unnecessary memory operations TestCurrent (mA) Time (us) Coulomb (mA*us) Idle OS602 For loop sum in C6731359585 Optimized for loop in asm677453375
19
Coulomb usage comparison of for loop sum code using different data types for the variable “c” Coulomb usage appears correlated to both the complexity of the library function that performs the add and size of the data type TestBytesCurrent (mA) Time (us) Coulomb (mA*us) Idle OS602 Short265718410120 Integer46731359585 Float463989132967 Double866048728246
20
Test application: ◦ Loop that writes to variable. 50% duty. ~2ms period. Test 1: Delay ◦ Cannot depend on CPU clock period for delay timing due to OS, so poll using gettimeofday Test 2: OS Scheduler ◦ Use usleep for timing with us resolution TestCurrent (mA) Time (us) Coulomb (mA*us) Jitter (us) MinAvgMax Idle OS598 Delay6212020464607107209 Scheduler59822380371809162
21
Smallest data type generally lower energy Use better compilers or check assembly code Direct correlation between code performance and energy usage for ARM processors ◦ Beware of stalling the pipeline ◦ Look at Coulomb usage of different code approaches Fast algorithms may use more power than slow ones but use less energy overall ◦ Memory transactions are energy expensive ◦ Use interrupts or OS scheduler instead of polling in OS Results may not entirely hold for x86 or other processors, but these can be characterized using the methods outlined here
22
Issues: ◦ Difficult to find documentation ◦ Community-oriented development ◦ Fairly new board Processor voltage and clock is adjustable but driver library not fully merged in Ubuntu yet ◦ cpufrequtils package Processor current consumption is accessible to software on the board via device on I2C
23
Processor current consumption is accessible to software on the board ◦ Not recommended for precision gauging because 10-bit ADC resolution yields ~53mA per LSB with series resistor Hardware details in BeagleBoard user manual Software: ◦ http://groups.google.com/group/beagleboard/browse_t hread/thread/7810fb7a93e44a4e ◦ Software is currently broken ◦ /dev/I2C-1 file access issue in Ubuntu “sudo i2cdump 1 0x4a” in terminal returns “Device or resource busy” error Permission conflict with OS over i2c file access? “sudo fuser –km /dev/i2c-1” will freeze the OS if attempting to kill any processes that use i2c-1
24
Current consumption comparison of various system energy saving or shutdown options accessible from the Ubuntu GUI TestCurrent (mA) Idle OS602 Blank screen598 Suspend566 Processor halted (shutdown)380
25
Embedded System Power ◦ Lecture 16 – Power Aware Programming ◦ http://www.newelectronics.co.uk/electronics-technology/optimising-the- power-consumption-of-embedded-systems/30528/ ◦ http://www.wimserc.org/members/Papers/1215608754-PID632073.pdf ◦ http : //www.netrino.com/node/178 ◦ http://low-powerdesign.com/article_cypress_093010.html Keil MCB2300 ◦ http://www.keil.com/support/man/docs/mcb2300/mcb2300_intro.htm Beagleboard-XM ◦ Beagleboard.org ◦ Google Groups on Beagleboard topics
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.