advertisement

2015年9月4日

Raspberry Pi 2 Energy Analysis

事前準備

  1. 一台Linux OS x86或x86-64 主機(有3GB以上硬碟空間,RAM>2GB)
  2. 一塊SBC(UDOO, Raspberry Pi 2)
  3. USB 延長線公對母
  4. ARM Energy Probe

下載DS-5 Streamline

# mkdir /usr/local/DS500-Strealine
# cd /home/clementyan/下載/
# mv DS500-BN-00019-r5p0-21rel1.tgz /usr/local/DS500-Strealine
# cd /usr/local/DS500-Strealine
# tar xfva DS500-BN-00019-r5p0-21rel1.tgz

安裝須知

1.先確認容量是否足夠,至少3GB

# df -h
檔案系統        容量  已用  可用 已用% 掛載點                                                                                                                                                                                    
/dev/sda1       2.7G  392M  2.2G   16% /
udev             10M     0   10M    0% /dev
tmpfs           1.6G  9.0M  1.6G    1% /run
/dev/sda3        19G   14G  3.8G   79% /usr
tmpfs           3.8G  321M  3.5G    9% /dev/shm
tmpfs           5.0M  4.0K  5.0M    1% /run/lock
tmpfs           3.8G     0  3.8G    0% /sys/fs/cgroup
/dev/sda6       9.1G  2.5G  6.2G   29% /var
/dev/sda8        68G   13G   52G   20% /home
/dev/sda5        19G  472M   17G    3% /opt
/dev/sda2        88M   48M   35M   58% /boot
tmpfs           777M  4.0K  777M    1% /run/user/0

2.DS-5 Streamline Setup

DS-5 Streamline相依32位元函式庫,需要加入ia-32架構的套件,並安裝所需套件。

安裝所需套件

# apt-get install libasound2:i386 libatk1.0-0:i386 libc6:i386 libcairo2:i386 libfontconfig1:i386 libfreetype6:i386 libgl1-mesa-glx:i386 libglu1-mesa:i386 libglib2.0-0:i386 libgtk2.0-0:i386 libncurses5:i386 libstdc++6:i386 libusb-0.1-4:i386 libx11-6:i386 libxcursor1:i386 libxft2:i386 libxi6:i386 libxp6:i386 libxrandr2:i386 libxrender1:i386 libxt6:i386 libxtst6:i386
底下兩個套件請跟上面套件分開裝
# apt-get install zlib1g:i386 libxmu6:i386 libwebkitgtk-1.0-0


開始安裝

# sh install.sh
=============================================
Welcome to the Installer for ARM DS-5 v5.21.1
=============================================
--- Host target check...[x86_64]
END USER LICENCE AGREEMENT FOR THE ARM(r) DS-5 DEVELOPMENT STUDIO ("DS-5")
.
.
.
--- Running installation platform requirement checks


Running dependency check [failed]
*** WARNING ***
One or more of the DS-5 system dependencies are not installed, see below for a list of the missing libraries.


libXmu.so.6 (32-bit)
One of:
libwebkitgtk-1.0.so.0 (64-bit)
libwebkit-1.0.so.2 (64-bit)
libxpcom.so (64-bit)
We recommend you install the missing dependencies, otherwise the programs will not run correctly. For further information see the DS-5 readme.


由上述警告訊息得知套件未安裝,我們透過底下方式搜尋套件名稱
# dpkg -S libXmu.so.6
libxmu6:amd64: /usr/lib/x86_64-linux-gnu/libXmu.so.6.2.0
libxmu6:amd64: /usr/lib/x86_64-linux-gnu/libXmu.so.6
google 搜尋libwebkitgtk-1.0.so.0
# apt-get install libxmu6:i386 libwebkitgtk-1.0-0


安裝完成後在執行一次
# sh install.sh
=============================================
Welcome to the Installer for ARM DS-5 v5.21.1
=============================================
--- Host target check...[x86_64]
.
.
.
Please answer with one of: 'yes' or 'no/quit'
Do you agree to the above terms and conditions? yes


Please answer with one of: 'yes/y' or 'no/n'
Run installation platform requirement checks? [default: yes]


--- Running installation platform requirement checks


Running dependency check [succeeded]


Where would you like to install to? [default: /usr/local/DS-5_v5.21.1]


Please answer with one of: 'yes/y' or 'no/n'
'/usr/local/DS-5_v5.21.1' does not exist, create? [default: yes]


--- Installing to '/usr/local/DS-5_v5.21.1' (This may take a while...)


Please answer with one of: 'yes/y' or 'no/n'
Install desktop menu item additions? [default: yes]


--- Installing menu entries


Post install stage provides the following functions:
- Set default toolkit selection
- Installation of USB drivers for RealView ICE and DSTREAM hardware units


Please answer with one of: 'yes/y' or 'no/n'
Run post install setup scripts? [default: yes]


--- Running post install setup scripts


No default toolkit set


-----------------------------------
Installation completed successfully
-----------------------------------


To start using ARM DS-5 v5.21.1 either:
- Create a suite sub-shell using /usr/local/DS-5_v5.21.1/bin/suite_exec <shell>
- Launch GUI tools via their desktop menu entries


The Release notes for the product can be found here: file:///usr/local/DS-5_v5.21.1/sw/info/readme.html


=============================================

開始執行

$ eclipse
但執行時有小bug


我是這樣處理的
# cd /usr/local/DS-5_v5.21.1/bin/
# ln -s /usr/local/DS-5_v5.21.1/bin/eclipse /usr/local/bin/eclipse
$ eclipse
/usr/local/bin/eclipse: 11: .: Can't open /usr/local/sw/info/env.sh
# cd /usr/local/DS-5_v5.21.1/
# mv sw ../


$ eclipse
==================================================================

GPU Profiling and Energy Analysis

底下是在X86 PC上

安裝ARM Energy Probe driver

# apt-get install libudev-dev
安裝完後請把ARM Energy Probe USB插入電腦,確認是否會亮綠燈,紅燈表示可能沒裝驅動程式
$ mkdir -p ARM/Energy Probe

安裝Cross-compiler

請參考筆記安裝Cross-compiler

編譯arm kernel

Note: 檢查下列參數是否有致能
# cat .config |grep CONFIG_PROFILING
CONFIG_PROFILING=y
# cat .config |grep CONFIG_PERF_EVENTS
CONFIG_PERF_EVENTS=y
# cat .config |grep CONFIG_FTRACE
CONFIG_FTRACE=y
# cat .config |grep CONFIG_HIGH_RES_TIMERS
CONFIG_HIGH_RES_TIMERS=y
# cat .config |grep CONFIG_HW_PERF_EVENTS
CONFIG_HW_PERF_EVENTS=y
# cat .config |grep CONFIG_CPU_FREQ
CONFIG_CPU_FREQ=y
# cat .config |grep CONFIG_GENERIC_TRACER
CONFIG_GENERIC_TRACER=y
# cat .config |grep CONFIG_TRACING
CONFIG_TRACING=y


確認完成後即可開始編譯
請參考筆記編譯rpi 2的kernel

下載gator driver source code



# unzip gator-master.zip
# cd gator-master
# cd driver
# make -C /usr/src/linux M=`pwd` ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules -j8
Note:/usr/src/linux 是rpi 2 kernel 4.1.2的資料夾
# ls -l gator.ko
-rw-r--r-- 1 root root 100572  7月 24 14:26 gator.ko
# cd ..
# cd daemon
# make CROSS_COMPILE=arm-linux-gnueabihf- -j8
# ls -l g*
-rwxr-xr-x 1 root root 515076  7月 24 14:43 gatord


最後再把 目錄gatord和gator.ko放在所要測試的板子上同一個資料夾下
我是放在/usr/local/gator底下


底下是在SBC上
並執行
# chmod +x gatord
./gatord &


底下是在X86上
開啟streamline
$ eclipse
過於簡單的軟體操作在這裡省略


開啟Streamline Data
擷取選取區域_010.png
左方設定參數
擷取選取區域_011.png


擷取選取區域_012.png
Adress:填入rpi的ip
Working Directory:確認是否在家目錄,不建議裝在根目錄
Energy Catpure:我們是ARM Energy Probe
Tool Path:/usr/local/bin/caiman 灰字是它預設會去讀取此執行檔,但我們裝完caiman的路徑並不是這邊,請修正
Channel:請注意你USB上的接線是Channel幾


設定要偵測的項目
擷取選取區域_013.png
底下我沒變動用預設的
擷取選取區域_014.png
開始偵測
擷取選取區域_015.png
底下是apt-get update的耗能結果
擷取選取區域_009.png


Reference:
2.README_Streamline.txt

1 則留言:

  1. 請問,關於energy probe接到RPi上的接腳的接法?
    查了官方docs好像沒有講的很清楚。
    謝謝

    回覆刪除

文章有誤或有問題麻煩您留言告知! 謝謝您~~