OrangePi PC のベンチマーク計測

15ドルPCの Orange Pi PC が来たので、動作確認をかねて、とりあえずベンチマークを計測。温度が80度近くになって心配でとりあえず、手元にあった放熱板を仮置き。

$ cat /sys/class/thermal/thermal_zone*/temp

結構、熱くなるようです。まぁ、それだけ速いということですかね。電源はPSP のがなぜかジャンク箱にあったのでそれで。

orangePiPC

なかなか、速いんじゃないですかね。622.9 出ていますが。RasPI2が400くらいなので、それより速いことはわかりました。とりあえず、ログだけ乗せておきます。

mate1.8.2 重そうなmate desktop も実用に耐えうる速度。

VNC でつなげてみました。CPUパワーがあって、これが15ドルとは思えませんね。

Raspberry Piの設定【VNCサーバ(tightVNC)の設定】

OS は、とりあえずloborisさんの、OrangePI_Ubuntu_Vivid_Mate.img を使いました。デスクトップGUIで、ブラウザー起動しましたが、なかなか速いです。レンダリングはドライバーの問題か、少しもたつく感じ。環境を整えれば、何かの用途には使えそうですね。送料込み、2300円くらいの価値はあるかと。

 

oot@OrangePI:/usr/local/src/UnixBench# ./Run -c 4
make all
make[1]: Entering directory '/usr/local/src/UnixBench'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/usr/local/src/UnixBench'
sh: 1: 3dinfo: not found

   #    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
   #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
   #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
   #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
   #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
    ####   #    #  #  #    #          #####   ######  #    #   ####   #    #

   Version 5.1.3                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   January 13, 2011                   johantheghost at yahoo period com


4 x Dhrystone 2 using register variables  1 2 3 4 5 6 7 8 9 10

4 x Double-Precision Whetstone  1 2 3 4 5 6 7 8 9 10

4 x Execl Throughput  1 2 3

4 x File Copy 1024 bufsize 2000 maxblocks  1 2 3

4 x File Copy 256 bufsize 500 maxblocks  1 2 3

4 x File Copy 4096 bufsize 8000 maxblocks  1 2 3

4 x Pipe Throughput  1 2 3 4 5 6 7 8 9 10

4 x Pipe-based Context Switching  1 2 3 4 5 6 7 8 9 10

4 x Process Creation  1 2 3

4 x System Call Overhead  1 2 3 4 5 6 7 8 9 10

4 x Shell Scripts (1 concurrent)  1 2 3

4 x Shell Scripts (8 concurrent)  1 2 3

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: OrangePI: GNU/Linux
   OS: GNU/Linux -- 3.4.39 -- #1 SMP PREEMPT Sun Aug 30 14:14:50 CEST 2015
   Machine: armv7l (armv7l)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   04:53:35 up 37 min,  3 users,  load average: 3.34, 3.29, 2.93; runlevel 5

------------------------------------------------------------------------
Benchmark Run: Sat Dec 12 2015 04:53:35 - 05:22:08
0 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables       17790507.8 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2952.0 MWIPS (11.1 s, 7 samples)
Execl Throughput                               1727.4 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        158602.9 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           43633.7 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        435339.7 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1071712.4 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 109380.1 lps   (10.0 s, 7 samples)
Process Creation                               5064.7 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   3836.6 lpm   (60.1 s, 2 samples)
Shell Scripts (8 concurrent)                    515.5 lpm   (60.2 s, 2 samples)
System Call Overhead                        2668331.1 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   17790507.8   1524.5
Double-Precision Whetstone                       55.0       2952.0    536.7
Execl Throughput                                 43.0       1727.4    401.7
File Copy 1024 bufsize 2000 maxblocks          3960.0     158602.9    400.5
File Copy 256 bufsize 500 maxblocks            1655.0      43633.7    263.6
File Copy 4096 bufsize 8000 maxblocks          5800.0     435339.7    750.6
Pipe Throughput                               12440.0    1071712.4    861.5
Pipe-based Context Switching                   4000.0     109380.1    273.5
Process Creation                                126.0       5064.7    402.0
Shell Scripts (1 concurrent)                     42.4       3836.6    904.9
Shell Scripts (8 concurrent)                      6.0        515.5    859.2
System Call Overhead                          15000.0    2668331.1   1778.9
                                                                   ========
System Benchmarks Index Score                                         622.9

root@OrangePI:/usr/local/src/UnixBench# 
 
root@OrangePI:/usr/local/src/UnixBench# cat /etc/issue
Ubuntu 15.04 \n \l

root@OrangePI:/usr/local/src/UnixBench# cat /etc/debian_version
jessie/sid
root@OrangePI:/usr/local/src/UnixBench# cat /proc/cpuinfo
Processor    : ARMv7 Processor rev 5 (v7l)
processor    : 0
BogoMIPS    : 1920.00

processor    : 1
BogoMIPS    : 1920.00

processor    : 2
BogoMIPS    : 1920.00

processor    : 3
BogoMIPS    : 1920.00

Features    : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part    : 0xc07
CPU revision    : 5

Hardware    : sun8i
Revision    : 0000
Serial        : 940050340508303104ce
root@OrangePI:/usr/local/src/UnixBench# 
root@OrangePI:/usr/local/src/UnixBench# cat /proc/meminfo
MemTotal:        1027152 kB
MemFree:          469976 kB
Buffers:           24388 kB
Cached:           413636 kB
SwapCached:            0 kB
Active:           227240 kB
Inactive:         260016 kB
Active(anon):      50164 kB
Inactive(anon):    20632 kB
Active(file):     177076 kB
Inactive(file):   239384 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:        270336 kB
HighFree:          18500 kB
LowTotal:         756816 kB
LowFree:          451476 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         49176 kB
Mapped:            30624 kB
Shmem:             21568 kB
Slab:              38708 kB
SReclaimable:      29820 kB
SUnreclaim:         8888 kB
KernelStack:        1016 kB
PageTables:         1384 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      513576 kB
Committed_AS:     358160 kB
VmallocTotal:     245760 kB
VmallocUsed:       38296 kB
VmallocChunk:     196788 kB
root@OrangePI:/usr/local/src/UnixBench# 
root@OrangePI:/usr/local/src/UnixBench# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
1008000
root@OrangePI:/usr/local/src/UnixBench# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
1536000
root@OrangePI:/usr/local/src/UnixBench# cat /sys/class/thermal/thermal_zone0/temp
52
root@OrangePI:/usr/local/src/UnixBench# 

OrangePi PC にヒートシンク

オレンジパイにヒートシンクをつけると、温度が下がるのか実験してみました。

1

ジャンク品のヒートシンクです。これは、15年くらい前の日立のフローラについていたもの。大きいので、3cmくらいにカットして置いてみただけです。

3

2 UnixBench を計測していたら、80度くらいまで上がったのですが、置いてみただけでも10度ちょい下がっている感じです。

Every 0.5s: cat /sys/class/thermal/thermal_zone0/temp /sys/class/thermal/thermal_zone1/temp                                  Sun Dec 13 18:20:31 2015

67
67

こんな感じで、0.5秒置きに温度をモニタリングしていると最高でも70度までは行かないようです。これにファンをつければさらに下がると思い、小さなファンをゲット。

さがったと思っていたら、UnixBench を –c 4 オプションをつけると、やっぱり80度近くになっています。うーん、やっぱりファンをつけたほうがいいですかね。まぁ、でもつけないときと比べると、下がり方が速いですね。

Every 0.5s: cat /sys/class/thermal/thermal_zone0/temp /sys/class/thermal/thermal_zone1/temp                                  Sun Dec 13 18:39:42 2015

81
81

allwinner の H3 は、CPU の周波数も最大で、1600MHz まであがる様でかなり大丈夫かなと思わせます。6ドル程度の CPU なのに結構やりますね。これは。

Every 0.5s: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_f…  Sun Dec 13 18:53:18 2015

1536000
1536000
1536000
1536000

loboris さんが書いているフォーラムのガイドにもフルスピードでは、ヒートシンクとファンをつけろとあります。

to always run at full speed install heatsink and fan !

http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=342

4

薄いので安いのだと、7mm 厚のがありました。もっと薄いものだと、4mm のものがあるのですが、ちょっとお高く、本体が買えそうな値段なんでやめました。4mm厚のは、中国産と日本産のがあり1600円ほどします。考えちゃいますよね。

 

で、結局7mm厚の2個入りをゲット。RasPi2 と OrangePiPC につけようかと。RasPI2 はケースの都合で銅製のヒートシンクをゲット。

 

どちらも、24時間運転のサーバ化に転用する予定ですので、熱対策はしておいて損はないはず。ヒートシンクとCPU との接着は、サーマルパッドという3M の製品が良さそうでこれもゲットしておきました。

 

ついでに、耐熱性のあるポリイミド(Polyimide)テープもゲット。こんなのがあるのですね。知りませんでした。2cm 幅くらいが使いやすそうかなと。

UnixBench は 1CPU だと、以下のようでした。

root@OrangePI:/usr/local/src/UnixBench# ./Run 
make all
make[1]: Entering directory '/usr/local/src/UnixBench'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/usr/local/src/UnixBench'
sh: 1: 3dinfo: not found

   #    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
   #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
   #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
   #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
   #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
    ####   #    #  #  #    #          #####   ######  #    #   ####   #    #

   Version 5.1.3                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   January 13, 2011                   johantheghost at yahoo period com


1 x Dhrystone 2 using register variables  1 2 3 4 5 6 7 8 9 10

1 x Double-Precision Whetstone  1 2 3 4 5 6 7 8 9 10

1 x Execl Throughput  1 2 3

1 x File Copy 1024 bufsize 2000 maxblocks  1 2 3

1 x File Copy 256 bufsize 500 maxblocks  1 2 3

1 x File Copy 4096 bufsize 8000 maxblocks  1 2 3

1 x Pipe Throughput  1 2 3 4 5 6 7 8 9 10

1 x Pipe-based Context Switching  1 2 3 4 5 6 7 8 9 10

1 x Process Creation  1 2 3

1 x System Call Overhead  1 2 3 4 5 6 7 8 9 10

1 x Shell Scripts (1 concurrent)  1 2 3

1 x Shell Scripts (8 concurrent)  1 2 3

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: OrangePI: GNU/Linux
   OS: GNU/Linux -- 3.4.39 -- #1 SMP PREEMPT Sun Aug 30 14:14:50 CEST 2015
   Machine: armv7l (armv7l)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   18:04:49 up  1:13,  5 users,  load average: 3.24, 3.27, 3.25; runlevel 5

------------------------------------------------------------------------
Benchmark Run: Sun Dec 13 2015 18:04:49 - 18:32:58
0 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables        5498429.9 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                      902.6 MWIPS (10.0 s, 7 samples)
Execl Throughput                                512.7 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        127185.4 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           40063.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        300968.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                              341609.8 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  22945.9 lps   (10.0 s, 7 samples)
Process Creation                               1794.6 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   1461.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    458.4 lpm   (60.1 s, 2 samples)
System Call Overhead                         856556.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0    5498429.9    471.2
Double-Precision Whetstone                       55.0        902.6    164.1
Execl Throughput                                 43.0        512.7    119.2
File Copy 1024 bufsize 2000 maxblocks          3960.0     127185.4    321.2
File Copy 256 bufsize 500 maxblocks            1655.0      40063.0    242.1
File Copy 4096 bufsize 8000 maxblocks          5800.0     300968.0    518.9
Pipe Throughput                               12440.0     341609.8    274.6
Pipe-based Context Switching                   4000.0      22945.9     57.4
Process Creation                                126.0       1794.6    142.4
Shell Scripts (1 concurrent)                     42.4       1461.6    344.7
Shell Scripts (8 concurrent)                      6.0        458.4    763.9
System Call Overhead                          15000.0     856556.8    571.0
                                                                   ========
System Benchmarks Index Score                                         266.0

で、肝心のBackBoost はなかなか時間が取れず、今日も半田付けはできませんでした。12月はいろいろ忙しいですね。

 

まとめ

・アイドル時の温度は、ヒートシンクを置かないと60度。置くと、55度ほどになる。

・アルミヒートシンクを3cm 角に切って、置いただけでもそれなりに冷却効果はある。

・最高で80度ちょいまであがるので、ファンをつけたてみたいところ

・ヒートシンクの接着は、3M とかから出ているサーマルパッドのシリーズがよさそう

・厚み4mm のファンは高いので、7mm のにした。

OPI 備忘録 Kernel UPdate

loboris さんのスクリプトで、kernel を3.4.39-01-lobo にあげたので備忘録。

 

root@OrangePI:/usr/local/src# wget http://loboris.eu/update_kernel.sh
root@OrangePI:/usr/local/src# chmod 755 update_kernel.sh 
root@OrangePI:/usr/local/src# ./update_kernel.sh 

Unpacking ...
Files unpacked.
==============================================
Select the OrangePI board you want to upgrade:
  1   OrangePI 2
  2   OrangePI PLUS
  3   OrangePI PC
?  3
Updating OrangePI PC

===============================
Select hdmi display resolution:
  1   1080p 60Hz
  2   1080p 50Hz
  3    720p 60Hz
  4    720p 50Hz
?  1

Selected 1080p 60Hz

=====================================
Do you have HDMI->DVI adapter, (y/N)?  N
HDMI interface selected

================
CONTINUE, (y/N)?  y

kernel, script.bin and /lib/modules updated, please REBOOT.
AFTER REBOOT RUN:  sudo depmod -a
===========================================================

root@OrangePI:/usr/local/src# 

★リブート後

junkhack@OrangePI:~# sudo depmod -a

root@OrangePI:/usr/local/src/UnixBench# ./Run -c 4
========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: OrangePI: GNU/Linux
   OS: GNU/Linux -- 3.4.39-01-lobo -- #1 SMP PREEMPT Sun Oct 25 14:46:41 CET 2015
   Machine: armv7l (armv7l)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   19:49:11 up 3 min,  3 users,  load average: 0.38, 0.34, 0.15; runlevel 5

------------------------------------------------------------------------
Benchmark Run: Sun Dec 13 2015 19:49:11 - 20:17:47
0 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables       18592638.3 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2982.9 MWIPS (10.6 s, 7 samples)
Execl Throughput                               1728.9 lps   (29.4 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        159573.1 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           44372.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        435389.5 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1057156.0 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 102252.4 lps   (10.0 s, 7 samples)
Process Creation                               5051.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   3683.5 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    495.0 lpm   (60.3 s, 2 samples)
System Call Overhead                        2557956.5 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   18592638.3   1593.2
Double-Precision Whetstone                       55.0       2982.9    542.3
Execl Throughput                                 43.0       1728.9    402.1
File Copy 1024 bufsize 2000 maxblocks          3960.0     159573.1    403.0
File Copy 256 bufsize 500 maxblocks            1655.0      44372.0    268.1
File Copy 4096 bufsize 8000 maxblocks          5800.0     435389.5    750.7
Pipe Throughput                               12440.0    1057156.0    849.8
Pipe-based Context Switching                   4000.0     102252.4    255.6
Process Creation                                126.0       5051.4    400.9
Shell Scripts (1 concurrent)                     42.4       3683.5    868.7
Shell Scripts (8 concurrent)                      6.0        495.0    824.9
System Call Overhead                          15000.0    2557956.5   1705.3
                                                                   ========
System Benchmarks Index Score                                         616.2

OPIでx2go

オレンジパイで、x2go (VNC のようなもので、ssh ポートのみで出来るもの)をしてみました。

2

osx では、X2Go Client を使いました。

Getting X2Go

http://wiki.x2go.org/doku.php/download:start

1便利かどうかはまだ不明ですが、ssh ポートだけでいけるのはいいのではと。

インストールしたときのメモ。loborisさんは、いろいろ作ってくれているので楽させてもらっています。

 

ReadME
https://github.com/loboris/OrangePi-BuildLinux

root@OrangePI:/usr/local/src# wget https://github.com/loboris/OrangePi-BuildLinux/raw/master/install_x2goserver
root@OrangePI:/usr/local/src# chmod 755 install_x2goserver 
root@OrangePI:/usr/local/src# bash ./install_x2goserver 

    Sun Dec 13 20:30:21 JST 2015
    *********************
    Installing x2goserver
    *********************
    
    Downloading the package ...
    --2015-12-13 20:30:22--  http://loboris.eu/x2goserver_install.tar.gz
    Resolving loboris.eu (loboris.eu)... 82.196.4.208
    Connecting to loboris.eu (loboris.eu)|82.196.4.208|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 6033423 (5.8M) [application/x-gzip]
    Saving to: ‘/tmp/x2go_install/x2goserver_install.tar.gz’
    
    /tmp/x2go_install/x2goserver_install. 100%[==============================>]   5.75M   335KB/s   in 21s    
    
    2015-12-13 20:30:46 (278 KB/s) - ‘/tmp/x2go_install/x2goserver_install.tar.gz’ saved [6033423/6033423]
    
    Unpacking ...
    Installing...
    
    OK.
    
root@OrangePI:/usr/local/src# 

root@OrangePI:/usr/local/src# ps axu | grep [x]2go
root     12964  0.0  0.5  11184  6084 ?        S    20:32   0:00 /usr/bin/perl /usr/sbin/x2gocleansessions
root@OrangePI:/usr/local/src# 


orangepi@OrangePI:~$ ps axu | grep [x]2go
orangepi 24355 15.4  4.9 150072 50708 ?        S    20:57   0:57 /usr/lib/nx/../x2go/bin/x2goagent -extension XFIXES -nolisten tcp -nolisten tcp -dpi 72 -D -auth /home/orangepi/.Xauthority -geometry 1024x768 -name X2GO-orangepi-51-1450007864_stDMATE_dp32 :51
orangepi 24438  0.0  0.0   4296   636 ?        Ss   20:57   0:00 /bin/bash /usr/bin/x2goruncommand 51 24355 orangepi-51-1450007864_stDMATE_dp32 30005 mate-session esd D
orangepi@OrangePI:~$ 

OPIでLチカ GPIOをC で

前回、RasPi2 でWiringPiを使ってGPIO の制御をしました。

RasPi2 でCの王道? WiringPi

OrangePi でも同様に無いか探したところ、Forkしたものがありました。

WiringOP
https://github.com/zhaolei/WiringOP

サンプルソース

#include <wiringPi.h>

#define LED 16
#define MSEC 50

int main (void)
{
  wiringPiSetup () ;
  pinMode (LED, OUTPUT) ;
  for (;;)
  {
    digitalWrite (LED, HIGH) ; delay (MSEC) ;
    digitalWrite (LED,  LOW) ; delay (MSEC) ;
  }
  return 0 ;
}

GPIO

ビルド方法は以下のようにしました。

# gcc -o blink blink.c -lwiringPi -lpthread

ピンの指定が、以下で出てくる wPi の番号のようでした。

root@opi:~# gpio readall
 +-----+-----+----------+------+---+--OrangePiPC--+---+------+---------+-----+--+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
 |   2 |  -1 |    SDA.0 |      |   |  3 || 4  |   |      | 5V       |     |     |
 |   3 |  -1 |    SCL.0 |      |   |  5 || 6  |   |      | 0v       |     |     |
 |   4 |   6 | IO6 PA06 |  OUT | 0 |  7 || 8  |   |      | TxD3     |     |     |
 |     |     |       0v |      |   |  9 || 10 |   |      | RxD3     |     |     |
 |  17 |  -1 |     RxD2 |      |   | 11 || 12 | 0 | OUT  | IO1 PD14 | 1   | 18  |
 |  27 |  -1 |     TxD2 |      |   | 13 || 14 |   |      | 0v       |     |     |
 |  22 |  -1 |     CTS2 |      |   | 15 || 16 | 0 | OUT  | IO4 PC04 | 4   | 23  |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | OUT  | IO5 PC07 | 5   | 24  |
 |  10 |  -1 |     MOSI |      |   | 19 || 20 |   |      | 0v       |     |     |
 |   9 |  -1 |     MISO |      |   | 21 || 22 |   |      | RTS2     |     |     |
 |  11 |  -1 |     SCLK |      |   | 23 || 24 |   |      | SPI-CE0  |     |     |
 |     |     |       0v |      |   | 25 || 26 |   |      | CE1      |     |     |
 |   0 |  -1 |    SDA.1 |      |   | 27 || 28 |   |      | SCL.1    |     |     |
 |   5 |   7 |  IO7 PA7 |  OUT | 0 | 29 || 30 |   |      | 0v       |     |     |
 |   6 |   8 |  IO8 PA8 |  OUT | 0 | 31 || 32 | 0 | OUT  | IO9 PG08 | 9   | 12  |
 |  13 |  10 | IO10 PA9 |  OUT | 0 | 33 || 34 |   |      | 0v       |     |     |
 |  19 |  12 | IO12PA10 |  OUT | 0 | 35 || 36 | 0 | OUT  | IO13PG09 | 13  | 16  |
 |  26 |  14 | IO14PA20 | ALT3 | 0 | 37 || 38 | 0 | OUT  | IO15PG06 | 15  | 20  |
 |     |     |       0v |      |   | 39 || 40 | 1 | OUT  | IO16PG07 | 16  | 21  |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+--OrangePIPC--+------+----------+-----+-----+

とりあえず動きました。関数の扱いがちょっと?な部分もあり、完全に互換ソースで動くというわけじゃなさそうです。

root@opi:~# ls /sys/class/gpio_sw/
normal_led  PA10  PA13  PA14  PA15  PA21  PA3  PA6  PA7  PA8  PA9  PC3  PC4  PC7  PD14  PG6  PG7  PG8  PG9  PL10  standby_led
root@opi:~# lsmod
Module                  Size  Used by
gpio_sunxi              8233  0 
8189es                901572  0 
root@opi:~# modprobe gpio_sunxi
root@opi:~# modprobe gpio-sunxi
root@opi:~# modprobe gpio
modprobe: FATAL: Module gpio not found.
root@opi:~# echo 1 > /sys/class/gpio_sw/standby_led/data
root@opi:~# echo 0 > /sys/class/gpio_sw/standby_led/data
root@opi:~# gpio -g write 16 1
pin number error
root@opi:~# gpio -g write 21 1
pin number error
root@opi:~# gpio -g write IO16PG07 1
pin number error
root@opi:~# gpio -g write PG7 1
pin number error
root@opi:~# gpio -g write 0 1
pin number error
root@opi:~# 

もう少し、手入れが必要ですね。sysfs に直接書くと以下のように光ります。gpio のマッピングがうまく機能していないようですね。

gpio_stanby_led

OPIでFedora22のメモ

loborisさんがリリースしている、Fedora22 のMinimal がどんなものテスト。

以下、備忘録です。Cで、GPIO ピンで光らせる部分まで確認。

 

・Fedora22_Minimal.img をsdcard に dd。要注意で。

$ sudo dd bs=1m if=./Fedora22_Minimal.img of=/dev/rdisk3

・BOOT パーティションの中は、orange pi pc の用途にあったものにリネーム。

[junkhack@OrangePi ~]$ ll /media/boot/
合計 10695
-rwxr-xr-x 1 root root    35724 10月 13 14:08 script.bin
-rwxr-xr-x 1 root root 10915616 10月 13 14:08 uImage

 

・SDCard 挿入、起動

・DHCP で起動するので、IP を固定に。以下のようになじみのあるeth0 に名前変更。

[root@opi 13:35:56 network-scripts]# ll ifcfg-*
-rw-r--r-- 1 root root 364 Jan  1  1970 ifcfg-LoBoInternet
-rw-r--r-- 1 root root 389 Dec 19 13:15 ifcfg-eth0
-rw-r--r-- 1 root root 254 Apr  9  2015 ifcfg-lo
[root@opi 13:36:06 network-scripts]# 

 

・中を変更

[root@opi 13:36:07 network-scripts]# cat ifcfg-eth0 
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=c0a09f2a-3229-4901-9689-7deb7e356848
DEVICE=eth0
ONBOOT=yes
DOMAIN=junkhack
IPADDR=192.168.1.42
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.17
DNS2=192.168.1.1
[root@opi 13:36:23 network-scripts]# 

 

・root のプロンプトを変更。好みで。

[root@opi 13:35:08 ~]# tail -n 3 .bash_profile 
PS1="[\u@opi \t \W]# "
export LANG=C

[root@opi 13:35:16 ~]# 

 

・タイムゾーン設定

[root@opi 13:34:18 ~]# timedatectl set-timezone Asia/Tokyo

・後方の空きパーティション拡大。スクリプトが同梱されているので。ない場合は、git にあるので参照。

[root@opi 13:37:46 ~]# find / -name fs_resize
/usr/local/bin/fs_resize
[root@opi 13:37:59 ~]# 

[root@opi 13:39:25 ~]# fs_resize

 

リブート

・cpu周波数のツールを入れ、ポリシーを見てみる。interactiveのようです。

[root@opi 13:43:15 ~]# dnf install cpufrequtils

[root@opi 13:51:19 ~]# cpupower frequency-info
analyzing CPU 0:
  driver: cpufreq-sunxi
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 2.00 ms.
  hardware limits: 480 MHz - 1.54 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, interactive, performance
  current policy: frequency should be within 480 MHz and 1.54 GHz.
                  The governor "interactive"★ may decide which speed to use
                  within this range.
  current CPU frequency is 480 MHz (asserted by call to hardware).
  cpufreq stats: 60.0 MHz:0.00%, 120 MHz:0.00%, 240 MHz:0.00%, 312 MHz:0.00%, 408 MHz:0.00%, 480 MHz:96.37%, 504 MHz:0.00%, 600 MHz:0.00%, 648 MHz:0.00%, 720 MHz:0.00%, 816 MHz:0.01%, 912 MHz:0.00%, 1.01 GHz:0.95%, 1.10 GHz:0.06%, 1.20 GHz:0.21%, 1.34 GHz:0.17%, 1.44 GHz:0.01%, 1.54 GHz:2.21%  (173)
[root@opi 13:51:22 ~]# 

 

参考

http://oneofis05users.seesaa.net/article/288446337.html

    ■ Interactive

    より速いondemandを、ということで考案された。CPUがアイドル状態から

    抜けるとサンプリングを増やして追従を上げる。反応はondemandより良いが、

    最大クロックに上げるまでには間を取る。マルチタスクで忙しい仕事とゆっくり

    した仕事が交互にあっても、最大最小に切り替え時に一気に上下せず少し間を取って、

    中間のクロックを取る。パフォーマンス的にはondemandより良い。

    画面オンで早くトップスピードに上げるので、画面オンの時間が短く、それを

    繰り返すような使用法ではバッテリー消費が多くなる。

 

・kernel をあげてみる。上げる前は以下。

[root@opi 13:55:50 src]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2 ext4       15G  1.1G   13G   8% /
udev           devtmpfs   10M     0   10M   0% /dev
tmpfs          tmpfs     201M  420K  201M   1% /run
tmpfs          tmpfs     502M     0  502M   0% /dev/shm
tmpfs          tmpfs     502M     0  502M   0% /sys/fs/cgroup
/dev/mmcblk0p1 vfat       63M   11M   53M  17% /media/boot
tmpfs          tmpfs     101M     0  101M   0% /run/user/0
tmpfs          tmpfs     101M     0  101M   0% /run/user/1001
[root@opi 13:55:57 src]# 
[root@opi 13:55:57 src]# ll /boot/
total 12632
-rwxr-xr-x 1 root root    32768 Oct 13 23:08 boot0_OPI.fex
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_1080p50
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_480p
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_720p50
-rw-r--r-- 1 root root    35724 Oct 13 23:08 script.bin.OPI-PC_720p60
-rw-r--r-- 1 root root   901120 Oct 13 23:08 u-boot_OPI-emmc.fex
-rw-r--r-- 1 root root   901120 Oct 13 23:08 u-boot_OPI.fex
-rw-r--r-- 1 root root 10915616 Oct 13 23:08 uImage
[root@opi 13:56:16 src]# 
[root@opi 13:56:38 src]# ll /media/boot/
total 10695
-rwxr-xr-x 1 root root    35724 Oct 13 14:08 script.bin
-rwxr-xr-x 1 root root 10915616 Oct 13 14:08 uImage
[root@opi 13:56:46 src]# 

[root@opi 13:57:30 src]# uname -a
Linux OrangePi 3.4.39 #1 SMP PREEMPT Mon Oct 12 12:02:29 CEST 2015 armv7l armv7l armv7l GNU/Linux
[root@opi 13:57:34 src]# lsmod
Module                  Size  Used by
8189es                887631  0
[root@opi 13:57:41 src]# 

 

・消してしまってスクリプト上でチェックしているようで、ダミーを作成

[root@opi 14:21:02 src]# echo > /boot/uImage_OPI-2

・tar も入ってなかったのでいれておく。

[root@opi 14:25:05 src]# dnf install tar

・スクリプト実行

[root@opi 13:57:45 src]# ./update_kernel.sh 
Sat Dec 19 13:57:54 JST 2015
*********************************************************
Updating kernel, script.bin and /lib/modules for OrangePI
*********************************************************

Do you want to download script&kernel package from server, (y/N)?  y.


Unpacking ...
Files unpacked.
==============================================
Select the OrangePI board you want to upgrade:
  1   OrangePI 2
  2   OrangePI PLUS
  3   OrangePI PC
?  3
Updating OrangePI PC

===============================
Select hdmi display resolution:
  1   1080p 60Hz
  2   1080p 50Hz
  3    720p 60Hz
  4    720p 50Hz
?  1

Selected 1080p 60Hz

=====================================
Do you have HDMI->DVI adapter, (y/N)?  N
HDMI interface selected

================
CONTINUE, (y/N)?  y

kernel, script.bin and /lib/modules updated, please REBOOT.
AFTER REBOOT RUN:  sudo depmod -a
===========================================================

[root@opi 14:29:35 src]# 

 

・video 関連が新規追加されたようです。

[root@opi 14:30:04 src]# ll /boot/
total 24220
-rwxr-xr-x 1 root root    32768 Dec 19 14:27 boot0_OPI.fex
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_1080p50_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_1080p50_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_1080p60_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_1080p60_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_480p_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_480p_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_720p50_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_720p50_hdmi
-rw-r--r-- 1 root root    35836 Dec 19 14:27 script.bin.OPI-2_720p60_dvi
-rw-r--r-- 1 root root    35792 Dec 19 14:27 script.bin.OPI-2_720p60_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_1080p50_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_1080p50_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_1080p60_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_1080p60_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_480p_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_480p_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_720p50_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_720p50_hdmi
-rw-r--r-- 1 root root    35856 Dec 19 14:27 script.bin.OPI-PC_720p60_dvi
-rw-r--r-- 1 root root    35812 Dec 19 14:27 script.bin.OPI-PC_720p60_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_1080p50_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_1080p50_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_1080p60_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_1080p60_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_480p_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_480p_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_720p50_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_720p50_hdmi
-rw-r--r-- 1 root root    36900 Dec 19 14:27 script.bin.OPI-PLUS_720p60_dvi
-rw-r--r-- 1 root root    36856 Dec 19 14:27 script.bin.OPI-PLUS_720p60_hdmi
-rw-r--r-- 1 root root   901120 Dec 19 14:27 u-boot_OPI-emmc.fex
-rw-r--r-- 1 root root   901120 Dec 19 14:27 u-boot_OPI.fex
-rw-r--r-- 1 root root 10917600 Dec 19 14:27 uImage_OPI-2
-rw-r--r-- 1 root root 10917592 Dec 19 14:27 uImage_OPI-PLUS
[root@opi 14:30:08 src]# 
[root@opi 14:30:09 src]# ll /media/boot/
total 21392
-rwxr-xr-x 1 root root    35812 Dec 19 14:29 script.bin
-rwxr-xr-x 1 root root    35724 Dec 19 14:29 script.bin.bak
-rwxr-xr-x 1 root root 10917600 Dec 19 14:29 uImage
-rwxr-xr-x 1 root root 10915616 Dec 19 14:29 uImage.bak
[root@opi 14:30:14 src]# 

[root@opi 15:35:40 modules]# diff -qr 3.4.39/ 3.4.39-01-lobo/ | grep gpio
diff: 3.4.39/build: No such file or directory
diff: 3.4.39-01-lobo/build: No such file or directory
Files 3.4.39/kernel/drivers/gpio/gpio-sunxi.ko and 3.4.39-01-lobo/kernel/drivers/gpio/gpio-sunxi.ko differ
Files 3.4.39/kernel/drivers/w1/masters/w1-gpio.ko and 3.4.39-01-lobo/kernel/drivers/w1/masters/w1-gpio.ko differ
diff: 3.4.39/source: No such file or directory
diff: 3.4.39-01-lobo/source: No such file or directory
[root@opi 15:35:45 modules]# 

[root@opi 15:31:41 modules]# diff -qr 3.4.39/ 3.4.39-01-lobo/ | wc -l
diff: 3.4.39/build: No such file or directory
diff: 3.4.39-01-lobo/build: No such file or directory
diff: 3.4.39/source: No such file or directory
diff: 3.4.39-01-lobo/source: No such file or directory
197
[root@opi 15:31:54 modules]# 


[root@opi 15:45:18 modules]# diff -qr 3.4.39/ 3.4.39-01-lobo/ | grep 'Only in'
::
Only in 3.4.39-01-lobo/kernel/drivers/input: serio
Only in 3.4.39-01-lobo/kernel/drivers/input: touchscreen
Only in 3.4.39-01-lobo/kernel/drivers/media: dvb
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gl860
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_benq.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_conex.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_cpia1.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_etoms.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_finepix.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_jeilinj.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_jl2005bcd.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_kinect.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_konica.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_mars.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_mr97310a.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_nw80x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_ov519.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_ov534.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_ov534_9.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_pac207.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_pac7302.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_pac7311.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_se401.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sn9c2028.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sn9c20x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sonixb.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sonixj.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca1528.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca500.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca501.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca505.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca506.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca508.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_spca561.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sq905.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sq905c.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sq930x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_stk014.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_stv0680.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_sunplus.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_t613.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_topro.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_tv8532.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_vc032x.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_vicam.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_xirlink_cit.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: gspca_zc3xx.ko
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: m5602
Only in 3.4.39-01-lobo/kernel/drivers/media/video/gspca: stv06xx
diff: 3.4.39/sourceOnly in 3.4.39-01-lobo/kernel/drivers/media/video: tveeprom.ko
: No such file or directory
Only in 3.4.39-01-lobo/kernel/drivers: misc
diff: Only in 3.4.39-01-lobo/kernel/drivers/net/wireless: rtl818x
3.4.39-01-lobo/sourceOnly in 3.4.39-01-lobo/kernel/drivers/net/wireless: zd1201.ko
: No such file or directory
Only in 3.4.39-01-lobo/kernel/drivers/net/wireless: zd1211rw
Only in 3.4.39-01-lobo/kernel/net: 802
Only in 3.4.39-01-lobo/kernel/net: bridge
Only in 3.4.39-01-lobo/kernel/net: llc
[root@opi 15:45:24 modules]# 

 

・gpio_sunxi がロード

[root@opi 14:32:15 ~]# sudo depmod -a

[root@opi 14:36:36 ~]# uname -a
Linux OrangePi 3.4.39-01-lobo #1 SMP PREEMPT Sun Oct 25 14:46:41 CET 2015 armv7l armv7l armv7l GNU/Linux

[root@opi 14:33:14 ~]# ls /sys/class/gpio_sw/
ls: cannot access /sys/class/gpio_sw/: No such file or directory
[root@opi 14:33:16 ~]# 

[root@opi 14:33:17 ~]# modprobe gpio_sunxi
[root@opi 14:33:34 ~]# 
[root@opi 14:33:35 ~]# lsmod
Module                  Size  Used by
gpio_sunxi              8233  0
8189es                901572  0
[root@opi 14:33:43 ~]# 
[root@opi 14:34:04 ~]# ls /sys/class/gpio_sw/
PA10  PA13  PA14  PA15  PA21  PA3  PA6  PA7  PA8  PA9  PC3  PC4  PC7  PD14  PG6  PG7  PG8  PG9  PL10  normal_led  standby_led
[root@opi 14:34:05 ~]# 

・基板上の電源LED の隣の緑LED が点灯、消灯

[root@opi 14:34:58 ~]# echo 1 > /sys/class/gpio_sw/standby_led/data
[root@opi 14:35:13 ~]# echo 0 > /sys/class/gpio_sw/standby_led/data

・WiringOP を入れる準備。c関連を面倒なのでグループインストール

[root@opi 14:41:48 WiringOP]# dnf group list
Last metadata expiration check performed 1:47:22 ago on Sat Dec 19 12:56:05 2015.
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Available groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Books and Guides
   C Development Tools and Libraries★
   Cloud Infrastructure
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Design Suite
   Development Tools
   Domain Membership
   Fedora Eclipse
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   FreeIPA Server
   Games and Entertainment
   Headless Management
   LibreOffice
   MATE Applications
   MATE Compiz
   Medical Applications
   Milkymist
   Network Servers
   Office/Productivity
   Robotics
   RPM Development Tools
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers
[root@opi 14:43:30 WiringOP]# dnf group install "C Development Tools and Libraries"

 

・WiringOP ビルド

[root@opi 14:50:36 WiringOP]# ./build 
wiringPi Build script
=====================


WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
[Compile] softTone.c
[Compile] softServo.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
gpio.c:801:13: warning: 'doPadDrive' defined but not used [-Wunused-function]
 static void doPadDrive (int argc, char *argv [])
             ^
gpio.c:889:13: warning: 'doGbw' defined but not used [-Wunused-function]
 static void doGbw (int argc, char *argv [])
             ^
gpio.c:931:13: warning: 'doGbr' defined but not used [-Wunused-function]
 static void doGbr (int argc, char *argv [])
             ^
[Compile] extensions.c
[Compile] readall.c
[Compile] pins.c
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringBP v2, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

[root@opi 14:50:59 WiringOP]# 

 

・テストソース

[root@opi 14:54:54 gpio]# cat blink.c 
#include <wiringPi.h>

// Define GPIO Pin number wPi
#define LED 16
// delay 1 = 2msec
#define MSEC 500
// blink count 100 = 1sec
#define LOOP 100

// Main function
int main(void) {
        int i;

        // Initialize WiringPi
        wiringPiSetup ();

        // Set GPIO pin to output mode
        pinMode(LED, OUTPUT);

        // Repeat LED blinking 10 times
        for(i=0; i<LOOP; i++){
                digitalWrite(LED, LOW);
                delay(MSEC);
                digitalWrite(LED, HIGH);
                delay(MSEC);
        }

        // Turn off LED
        digitalWrite(LED, LOW);

        return 0;
}

 

・ビルド、実行

[root@opi 14:55:01 gpio]# gcc -o blink blink.c -lwiringPi -lpthread
[root@opi 14:55:26 gpio]# 
[root@opi 14:55:27 gpio]# ll
total 12
-rwxr-xr-x 1 root root 6592 Dec 19 14:55 blink
-rw-r--r-- 1 root root  624 Dec 19 14:54 blink.c
[root@opi 14:55:30 gpio]# ./blink 
^C
[root@opi 14:55:53 gpio]# 

[root@opi 14:56:19 gpio]# gpio readall
 +-----+-----+----------+------+---+--OrangePiPC--+---+------+---------+-----+--+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
 |   2 |  -1 |    SDA.0 |      |   |  3 || 4  |   |      | 5V       |     |     |
 |   3 |  -1 |    SCL.0 |      |   |  5 || 6  |   |      | 0v       |     |     |
 |   4 |   6 | IO6 PA06 |  OUT | 0 |  7 || 8  |   |      | TxD3     |     |     |
 |     |     |       0v |      |   |  9 || 10 |   |      | RxD3     |     |     |
 |  17 |  -1 |     RxD2 |      |   | 11 || 12 | 0 | OUT  | IO1 PD14 | 1   | 18  |
 |  27 |  -1 |     TxD2 |      |   | 13 || 14 |   |      | 0v       |     |     |
 |  22 |  -1 |     CTS2 |      |   | 15 || 16 | 0 | OUT  | IO4 PC04 | 4   | 23  |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | OUT  | IO5 PC07 | 5   | 24  |
 |  10 |  -1 |     MOSI |      |   | 19 || 20 |   |      | 0v       |     |     |
 |   9 |  -1 |     MISO |      |   | 21 || 22 |   |      | RTS2     |     |     |
 |  11 |  -1 |     SCLK |      |   | 23 || 24 |   |      | SPI-CE0  |     |     |
 |     |     |       0v |      |   | 25 || 26 |   |      | CE1      |     |     |
 |   0 |  -1 |    SDA.1 |      |   | 27 || 28 |   |      | SCL.1    |     |     |
 |   5 |   7 |  IO7 PA7 |  OUT | 0 | 29 || 30 |   |      | 0v       |     |     |
 |   6 |   8 |  IO8 PA8 |  OUT | 0 | 31 || 32 | 0 | OUT  | IO9 PG08 | 9   | 12  |
 |  13 |  10 | IO10 PA9 |  OUT | 0 | 33 || 34 |   |      | 0v       |     |     |
 |  19 |  12 | IO12PA10 |  OUT | 0 | 35 || 36 | 0 | OUT  | IO13PG09 | 13  | 16  |
 |  26 |  14 | IO14PA20 | ALT3 | 0 | 37 || 38 | 0 | OUT  | IO15PG06 | 15  | 20  |
 |     |     |       0v |      |   | 39 || 40 | 0 | OUT  | IO16PG07 | 16  | 21  |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+--OrangePIPC--+------+----------+-----+-----+
[root@opi 14:56:27 gpio]#