since: 2015/08/13
update: 2016/06/08
reference:
1.
PiMapper
2.
Raspberry Pi: Pi 2 with Pi Mapper ---- 1/3
3.
Raspberry Pi 2 Setup Guide
B. 安裝 openFrameworks
1. 確認目前所安裝的
Raspbian "wheezy" 是 "
hard float", 而非 "soft-float" 版本.
-> "
hard float" 版本才會有
/lib/arm-linux-gnueabihf 這目錄;
"soft-float" 版本才會有
/lib/arm-linux-gnueabi 目錄.
p.s.
Hard float just means the floating point calculations are done by
on chip hardware rather than being emulated by software.
2.
設定 Pi:
a. 說明:
Raspberry Pi 2 uses the
armv7 architecture,
here will install
openFrameworks (0.8.4)
b.
Expand the file system:
$
sudo raspi-config
選擇:
1. Expand Filesystem ->
Select > Ok
c. 編譯
openFrameworks 前, 須先確認 CPU 有 192MB 的RAM可使用.
(先將分配給 GPU 的記憶體縮小, 之後再改回來)
選擇:
8. Advanced Options >
Select
選擇: A3. Memory split: Change the amount of memory made available
to the GPU > Select
輸入: 64 > OK > YES > reboot
(限制分配給 GPU 的記憶體; 提供較多的記憶體給 CPU 使用)
3.
更新套件:
$ sudo apt-get clean
$ sudo apt-get update // 或: $ sudo apt-get update --fix-missing
$ sudo apt-get upgrade
4.
下載 openFrameworks 0.8.4 linuxarmv7 distribution
$
cd ~
$
curl -O http://www.openframeworks.cc/versions/v0.8.4/of_v0.8.4_linuxarmv7l_release.tar.gz
5.
解壓縮檔案:
$
cd ~
$
tar xvf of_v0.8.4_linuxarmv7l_release.tar.gz
6.
Add the updated Raspberry Pi 2 makefiles to the release
$
cd ~
$
curl
https://raw.githubusercontent.com/openframeworks/openFrameworks/master/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.rpi2.mk
-o
of_v0.8.4_linuxarmv7l_release/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.rpi2.mk
7.
Install the linux dependencies:
$
cd ~/of_v0.8.4_linuxarmv7l_release/scripts/linux/debian/
$
sudo ./install_dependencies.sh (
約 7 分鐘)
8.
Set an environmental variable:
This must be done before using the makefile system each time you enter a new
terminal or restart the Raspberry Pi 2. It can be automated by adding it to the
end of your bash init script (e.g. your bash ~/.profile file).
The following tells the make system to use all 4 cores for compiling and to use
the Raspberry Pi 2 variant of the armv7 makefiles.
$
sudo nano ~/.profile
# ctrl + g : get help
# ctrl + o : write
# ctrl + x : exit
....
# openframeworks: to use all 4 cores for compiling & armv7 makefiles
export MAKEFLAGS=-j4 PLATFORM_VARIANT=rpi2
# check the changes
$
cat ~/.profile
9.
logout &
login again
10. 由於已經編譯好 openFrameworks 了, 我們可以將之前限制分配給
GPU 的
64 MB 記憶體, 調整為
256 MB(或者更多).
11.
Compile an example:
$
cd ~/of_v0.8.4_linuxarmv7l_release/examples/3d/3DPrimitivesExample/
$
make
$
make run (
須在 Pi 2 上才看得到結果)