2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

FPGA+SoC+Linux+Device Tree Overlay+FPGA Manager(DE0-Nano-SoC-Examples)

Last updated at Posted at 2016-05-12

注意(2017年9月20日追記)

この記事は Linux Kernel 4.4 時点に投稿したものであり、古い内容が含まれています。Linux Kernel 4.10 以降、FPGA 関連は大きく進歩しました。詳しくは「Linux Kernel 4.10 でのFPGAのサポート事情」を参照してください。

はじめに

「FPGA+SoC+Linux+Device Tree Overlay+FPGA Manager(ブートイメージの提供) @Qiita」で、DE0-Nano-SoC 用の Device Tree Overay と FPGA Manager に対応した Linux Kernel と Debian8 RootFS を紹介しました。

ここでは、そのシステム上で動作する実例をいくつか紹介します。
いずれの実例もかつて Qiita に投稿したものです。実例の詳細は記事を参照してください。

ダウンロード

github から次のようにダウンロードしてください。
現時点の最新バージョンは v0.3.3 です。チェックアウトしてください。
なお、いくつかのイメージファイルはかなり大きいので、Git LFS(Large File Storage)を使っています。
お使いの環境に git-lfs がインストールされている必要があります。

shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
shell$ cd FPGA-SoC-Linux
shell$ git checkout v0.3.3
shell$ git lfs pull

インストール

target/de0-nano-soc/examples-001.tgz にアーカイブされているので、ターゲットシステムのどこかに展開してください。
ここでは、/home/fpga/examples に展開しているものとします。

なお、こちらの記事「FPGA+SoC+Linux+Device Tree Overlay+FPGA Manager(ZYBO-Examples)」を投稿した時に比べて、FPGA Device Drives のバージョンが上がっています。
具体的には、Altera-SoC 用の HPS-FPGA Bridge のデバイスドライバが追加されています。
fpga-soc-linux-drivers-4.4.7-armv7-fpga_0.0.2-1_armhf.deb をインストールしてください。
すでに fpga-soc-linux-drivers-4.4.7-armv7-fpga_0.0.1-1_armhf.deb がインストールされている場合は、アップグレードしてください。

fpga@debian-fpga:~$ sudo dpkg -r fpga-soc-linux-drivers-4.4.7-armv7-fpga
(Reading database ... 17846 files and directories currently installed.)
Removing fpga-soc-linux-drivers-4.4.7-armv7-fpga (0.0.1-1) ...
[  157.092376] fpgacfg soc:fpgacfg0: driver unloaded
Removed symlink /etc/systemd/system/multi-user.target.wants/zptty.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/udmabuf.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/fpga-manager.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/device-tree-overlay.service.
fpga@debian-fpga:~$ sudo dpkg -i fpga-soc-linux-drivers-4.4.7-armv7-fpga_0.0.2-1_armhf.deb
Selecting previously unselected package fpga-soc-linux-drivers-4.4.7-armv7-fpga.
(Reading database ... 17830 files and directories currently installed.)
Preparing to unpack fpga-soc-linux-drivers-4.4.7-armv7-fpga_0.0.2-1_armhf.deb ...
Unpacking fpga-soc-linux-drivers-4.4.7-armv7-fpga (0.0.2-1) ...
Setting up fpga-soc-linux-drivers-4.4.7-armv7-fpga (0.0.2-1) ...
Created symlink from /etc/systemd/system/multi-user.target.wants/device-tree-overlay.service to /etc/systemd/system/device-tree-overlay.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/fpga-manager.service to /etc/systemd/system/fpga-manager.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/udmabuf.service to /etc/systemd/system/udmabuf.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zptty.service to /etc/systemd/system/zptty.service.
[  196.891617] fpgacfg soc:fpgacfg0: driver probe start.
[  196.896907] fpgacfg soc:fpgacfg0: driver installed.
[  196.901849] fpgacfg soc:fpgacfg0: device name  : fpgacfg0
[  196.907234] fpgacfg soc:fpgacfg0: fpga manager : Altera SOCFPGA FPGA Manager

udmabuf_test

以下の記事で紹介した実例です。

udmabuf_test は FPGA 部は使わないので、FPGA Manager は使いません。

スクリプトには ruby の rake を使っています。ここでは Rakefile の説明はしませんので、詳細を知りたい方は Rakefile を見てください。

fpga@debian-fpga:~/examples/udmabuf_test$ rake -T
rake test[buffer_size]             # udmabuf test
rake test_all                      # udmabuf test all (buffer_size_list = [...
rake udmabuf:install[buffer_size]  # Install udmabuf
rake udmabuf:uninstall             # Uninstall udmabuf

device tree overlay を使うためには super user 権限が必要です。sudo を使って実行してください。

fpga@debian-fpga:~/examples/udmabuf_test$ sudo rake test_all
[  294.295987] udmabuf soc:udmabuf0: driver probe start.
[  294.304637] udmabuf udmabuf0: driver installed
[  294.310349] udmabuf udmabuf0: major number   = 241
[  294.315127] udmabuf udmabuf0: minor number   = 0
[  294.320748] udmabuf udmabuf0: phys address   = 0x3f100000
[  294.326131] udmabuf udmabuf0: buffer size    = 1048576
[  294.332211] udmabuf soc:udmabuf0: driver installed.
./udmabuf_test
phys_addr=0x3f100000
size=1048576
check_buf()
sync_mode=0, O_SYNC=0, time = 0.346007 sec
sync_mode=0, O_SYNC=1, time = 0.345906 sec
sync_mode=1, O_SYNC=0, time = 0.346029 sec
sync_mode=1, O_SYNC=1, time = 1.961720 sec
sync_mode=2, O_SYNC=0, time = 0.345875 sec
sync_mode=2, O_SYNC=1, time = 1.385162 sec
sync_mode=3, O_SYNC=0, time = 0.345877 sec
sync_mode=3, O_SYNC=1, time = 1.384824 sec
sync_mode=4, O_SYNC=0, time = 0.346086 sec
sync_mode=4, O_SYNC=1, time = 0.345775 sec
sync_mode=5, O_SYNC=0, time = 1.961395 sec
sync_mode=5, O_SYNC=1, time = 1.961555 sec
sync_mode=6, O_SYNC=0, time = 1.384710 sec
sync_mode=6, O_SYNC=1, time = 1.384663 sec
sync_mode=7, O_SYNC=0, time = 1.384574 sec
sync_mode=7, O_SYNC=1, time = 1.384642 sec
clear_buf()
sync_mode=0, O_SYNC=0, time = 0.050501 sec
sync_mode=0, O_SYNC=1, time = 0.050018 sec
sync_mode=1, O_SYNC=0, time = 0.050040 sec
sync_mode=1, O_SYNC=1, time = 0.813359 sec
sync_mode=2, O_SYNC=0, time = 0.049870 sec
sync_mode=2, O_SYNC=1, time = 0.058018 sec
sync_mode=3, O_SYNC=0, time = 0.049918 sec
sync_mode=3, O_SYNC=1, time = 0.057873 sec
sync_mode=4, O_SYNC=0, time = 0.050252 sec
sync_mode=4, O_SYNC=1, time = 0.050203 sec
sync_mode=5, O_SYNC=0, time = 0.813939 sec
sync_mode=5, O_SYNC=1, time = 0.814002 sec
sync_mode=6, O_SYNC=0, time = 0.057765 sec
sync_mode=6, O_SYNC=1, time = 0.057842 sec
sync_mode=7, O_SYNC=0, time = 0.057779 sec
sync_mode=7, O_SYNC=1, time = 0.057747 sec
dtbocfg.rb --remove udmabuf0
[  314.400197] udmabuf udmabuf0: driver uninstalled
[  314.405171] udmabuf soc:udmabuf0: driver unloaded
[  314.707901] udmabuf soc:udmabuf0: driver probe start.
[  314.719421] udmabuf udmabuf0: driver installed
[  314.723855] udmabuf udmabuf0: major number   = 241
[  314.729663] udmabuf udmabuf0: minor number   = 0
[  314.734266] udmabuf udmabuf0: phys address   = 0x3f100000
[  314.740563] udmabuf udmabuf0: buffer size    = 2097152
[  314.745686] udmabuf soc:udmabuf0: driver installed.
./udmabuf_test
phys_addr=0x3f100000
size=2097152
check_buf()
sync_mode=0, O_SYNC=0, time = 0.693020 sec
sync_mode=0, O_SYNC=1, time = 0.693056 sec
sync_mode=1, O_SYNC=0, time = 0.692592 sec
sync_mode=1, O_SYNC=1, time = 3.925222 sec
sync_mode=2, O_SYNC=0, time = 0.692521 sec
sync_mode=2, O_SYNC=1, time = 2.769838 sec
sync_mode=3, O_SYNC=0, time = 0.692142 sec
sync_mode=3, O_SYNC=1, time = 2.769865 sec
sync_mode=4, O_SYNC=0, time = 0.692700 sec
sync_mode=4, O_SYNC=1, time = 0.692532 sec
sync_mode=5, O_SYNC=0, time = 3.923159 sec
sync_mode=5, O_SYNC=1, time = 3.923061 sec
sync_mode=6, O_SYNC=0, time = 2.769504 sec
sync_mode=6, O_SYNC=1, time = 2.769548 sec
sync_mode=7, O_SYNC=0, time = 2.769462 sec
sync_mode=7, O_SYNC=1, time = 2.769446 sec
clear_buf()
sync_mode=0, O_SYNC=0, time = 0.111365 sec
sync_mode=0, O_SYNC=1, time = 0.111643 sec
sync_mode=1, O_SYNC=0, time = 0.112314 sec
sync_mode=1, O_SYNC=1, time = 1.627081 sec
sync_mode=2, O_SYNC=0, time = 0.112390 sec
sync_mode=2, O_SYNC=1, time = 0.116042 sec
sync_mode=3, O_SYNC=0, time = 0.112048 sec
sync_mode=3, O_SYNC=1, time = 0.116031 sec
sync_mode=4, O_SYNC=0, time = 0.111098 sec
sync_mode=4, O_SYNC=1, time = 0.111397 sec
sync_mode=5, O_SYNC=0, time = 1.627157 sec
sync_mode=5, O_SYNC=1, time = 1.626896 sec
sync_mode=6, O_SYNC=0, time = 0.116049 sec
sync_mode=6, O_SYNC=1, time = 0.115929 sec
sync_mode=7, O_SYNC=0, time = 0.115969 sec
sync_mode=7, O_SYNC=1, time = 0.115942 sec
dtbocfg.rb --remove udmabuf0
[  354.657740] udmabuf udmabuf0: driver uninstalled
[  354.662957] udmabuf soc:udmabuf0: driver unloaded
[  354.965090] udmabuf soc:udmabuf0: driver probe start.
[  354.981039] udmabuf udmabuf0: driver installed
[  354.985474] udmabuf udmabuf0: major number   = 241
[  354.990302] udmabuf udmabuf0: minor number   = 0
[  354.994912] udmabuf udmabuf0: phys address   = 0x3f100000
[  355.000326] udmabuf udmabuf0: buffer size    = 4194304
[  355.005447] udmabuf soc:udmabuf0: driver installed.
./udmabuf_test
phys_addr=0x3f100000
size=4194304
check_buf()
sync_mode=0, O_SYNC=0, time = 1.385041 sec
sync_mode=0, O_SYNC=1, time = 1.383999 sec
sync_mode=1, O_SYNC=0, time = 1.384259 sec
sync_mode=1, O_SYNC=1, time = 7.845203 sec
sync_mode=2, O_SYNC=0, time = 1.383909 sec
sync_mode=2, O_SYNC=1, time = 5.538720 sec
sync_mode=3, O_SYNC=0, time = 1.384139 sec
sync_mode=3, O_SYNC=1, time = 5.538637 sec
sync_mode=4, O_SYNC=0, time = 1.383614 sec
sync_mode=4, O_SYNC=1, time = 1.383825 sec
sync_mode=5, O_SYNC=0, time = 7.845041 sec
sync_mode=5, O_SYNC=1, time = 7.844723 sec
sync_mode=6, O_SYNC=0, time = 5.538549 sec
sync_mode=6, O_SYNC=1, time = 5.538392 sec
sync_mode=7, O_SYNC=0, time = 5.538395 sec
sync_mode=7, O_SYNC=1, time = 5.538444 sec
clear_buf()
sync_mode=0, O_SYNC=0, time = 0.229383 sec
sync_mode=0, O_SYNC=1, time = 0.228743 sec
sync_mode=1, O_SYNC=0, time = 0.228579 sec
sync_mode=1, O_SYNC=1, time = 3.253492 sec
sync_mode=2, O_SYNC=0, time = 0.228052 sec
sync_mode=2, O_SYNC=1, time = 0.230986 sec
sync_mode=3, O_SYNC=0, time = 0.227550 sec
sync_mode=3, O_SYNC=1, time = 0.231026 sec
sync_mode=4, O_SYNC=0, time = 0.228220 sec
sync_mode=4, O_SYNC=1, time = 0.229280 sec
sync_mode=5, O_SYNC=0, time = 3.253519 sec
sync_mode=5, O_SYNC=1, time = 3.253310 sec
sync_mode=6, O_SYNC=0, time = 0.230866 sec
sync_mode=6, O_SYNC=1, time = 0.230875 sec
sync_mode=7, O_SYNC=0, time = 0.230993 sec
sync_mode=7, O_SYNC=1, time = 0.230881 sec
dtbocfg.rb --remove udmabuf0
[  434.526596] udmabuf udmabuf0: driver uninstalled
[  434.532111] udmabuf soc:udmabuf0: driver unloaded

uio_irq_sample

以下の記事で紹介した実例です。

スクリプトには ruby の rake を使っています。ここでは Rakefile の説明はしませんので、詳細を知りたい方は Rakefile を見てください。

fpga@debian-fpga:~/examples/uio_irq_sample$ rake -T
rake devicetree:install    # Install device tree
rake devicetree:uninstall  # Uninstall device tree
rake fpga:install          # Install fpga
rake install               # Install fpga and devicetrees
rake uninstall             # Uninstall fpga and devicetrees

rake install で、FPGA と Device Tree をインストールします。
インストールには super user 権限が必要です。sudo を使って実行してください。

fpga@debian-fpga:~/examples/uio_irq_sample$ sudo rake install
dd if=DE0_NANO_SOC.rbf of=/dev/fpgacfg0 bs=1M
1+1 records in
1+1 records out
1365784 bytes (1.4 MB) copied, 0.202703 s, 6.7 MB/s
dtbocfg.rb --install uio_irq_sample --dts devicetree.dts
[  561.659154] udmabuf soc:amba:pump-udmabuf4: driver probe start.
[  561.676785] udmabuf udmabuf4: driver installed
[  561.681221] udmabuf udmabuf4: major number   = 241
[  561.687117] udmabuf udmabuf4: minor number   = 0
[  561.691721] udmabuf udmabuf4: phys address   = 0x3f100000
[  561.698038] udmabuf udmabuf4: buffer size    = 4194304
[  561.703728] udmabuf soc:amba:pump-udmabuf4: driver installed.
[  561.709867] udmabuf soc:amba:pump-udmabuf5: driver probe start.
[  561.727397] udmabuf udmabuf5: driver installed
[  561.731833] udmabuf udmabuf5: major number   = 241
[  561.737816] udmabuf udmabuf5: minor number   = 1
[  561.742420] udmabuf udmabuf5: phys address   = 0x3f500000
[  561.748747] udmabuf udmabuf5: buffer size    = 4194304
[  561.754385] udmabuf soc:amba:pump-udmabuf5: driver installed.

サンプルプログラム(sample1,sample2)をコンパイル

fpga@debian-fpga:~/examples/uio_irq_sample$ rake
gcc  -o sample1 sample1.c
gcc  -o sample2 sample2.c
fpga@debian-fpga:~/examples/uio_irq_sample$ ./sample1
time = 0.014849 sec
time = 0.014748 sec
time = 0.014697 sec
time = 0.014699 sec
time = 0.014741 sec
time = 0.014745 sec
time = 0.014711 sec
time = 0.014774 sec
time = 0.014673 sec
time = 0.014717 sec
fpga@debian-fpga:~/examples/uio_irq_sample$ ./sample2
time = 0.014825 sec
time = 0.014743 sec
time = 0.014746 sec
time = 0.014738 sec
time = 0.014708 sec
time = 0.014785 sec
time = 0.014748 sec
time = 0.014720 sec
time = 0.014769 sec
time = 0.014893 sec

終わったら 必ず uninstall して device tree を削除してください。

fpga@debian-fpga:~/examples/uio_irq_sample$ sudo rake uninstall
dtbocfg.rb --remove uio_irq_sample
[  725.058330] udmabuf udmabuf5: driver uninstalled
[  725.063857] udmabuf soc:amba:pump-udmabuf5: driver unloaded
[  725.069677] udmabuf udmabuf4: driver uninstalled
[  725.076421] udmabuf soc:amba:pump-udmabuf4: driver unloaded

accumulator

以下の記事で紹介した実例です。

スクリプトには ruby の rake を使っています。ここでは Rakefile の説明はしませんので、詳細を知りたい方は Rakefile を見てください。

fpga@debian-fpga:~/examples/accumulator$ rake -T
rake fpga:install     # Install fpga
rake install          # Install fpga and devicetrees
rake run              # run
rake uninstall        # Uninstall fpga and devicetrees
rake zptty:install    # Install zptty device driver
rake zptty:uninstall  # Unnstall zptty device driver

rake install で、FPGA と Device Tree をインストールします。
インストールには super user 権限が必要です。sudo を使って実行してください。

fpga@debian-fpga:~/examples-de0-nano-soc/accumulator$ sudo rake install
dd if=DE0_NANO_SOC.rbf of=/dev/fpgacfg0 bs=1M
1+1 records in
1+1 records out
1312432 bytes (1.3 MB) copied, 0.185027 s, 7.1 MB/s
dtbocfg.rb --install zptty0 --dts zptty0-de0-nano-soc.dts
[  896.483534] zptty ff202000.zptty: ZPTTY Driver probe start
[  896.489281] zptty ff202000.zptty: driver installed
[  896.494062] zptty ff202000.zptty: device name    = zptty0
[  896.499496] zptty ff202000.zptty: private record = eebbc400 (332bytes)
[  896.506001] zptty ff202000.zptty: major number   = 240
[  896.511161] zptty ff202000.zptty: minor number   = 0
[  896.516112] zptty ff202000.zptty: regs resource  = [mem 0xff202000-0xff202fff flags 0x200]
[  896.524390] zptty ff202000.zptty: regs address   = f203a000
[  896.529985] zptty ff202000.zptty: irq resource   = [irq 67 flags 0x404]
[  896.536574] zptty ff202000.zptty: tx buf size    = 128
[  896.541718] zptty ff202000.zptty: rx buf size    = 128
fpga@debian-fpga:~/examples/accumulator$ ruby test.rb
OK : reg = 1; add(6625) => 6626; reg = 6626
OK : reg = 6626; add(9833) => 16459; reg = 16459
OK : reg = 16459; add(7280) => 23739; reg = 23739
OK : reg = 23739; add(3535) => 27274; reg = 27274
OK : reg = 27274; add(5848) => 33122; reg = 33122
OK : reg = 33122; add(9770) => 42892; reg = 42892
OK : reg = 42892; add(2771) => 45663; reg = 45663
      :
    (中略)
      :
OK : reg = -4997637; add(-9940) => -5007577; reg = -5007577
OK : reg = -5007577; add(-3887) => -5011464; reg = -5011464
NoMethodError
ArgumentError
ArgumentError

最後の3行のエラーは、メソッド名や引数を間違えたときにエラーになることを検査しているので気にしないでください。

終わったら 必ず uninstall して device tree を削除してください。

fpga@debian-fpga:~/examples/accumulator$ sudo rake uninstall
dtbocfg.rb --remove zptty0
[  997.960336] zptty ff202000.zptty: driver removed

fibonacci

以下の記事で紹介した実例です。

スクリプトには ruby の rake を使っています。ここでは Rakefile の説明はしませんので、詳細を知りたい方は Rakefile を見てください。

fpga@debian-fpga:~/examples/fibonacci$ rake -T
rake fpga:install     # Install fpga
rake install          # Install fpga and devicetrees
rake run              # run
rake uninstall        # Uninstall fpga and devicetrees
rake zptty:install    # Install zptty device driver
rake zptty:uninstall  # Unnstall zptty device driver

rake install で、FPGA と Device Tree をインストールします。
インストールには super user 権限が必要です。sudo を使って実行してください。

fpga@debian-fpga:~/examples/fibonacci$ sudo rake install
dd if=DE0_NANO_SOC.rbf of=/dev/fpgacfg0 bs=1M
1+1 records in
1+1 records out
1290712 bytes (1.3 MB) copied, 0.186531 s, 6.9 MB/s
dtbocfg.rb --install zptty0 --dts zptty0-de0-nano-soc.dts
[ 1124.141145] zptty ff202000.zptty: ZPTTY Driver probe start
[ 1124.146987] zptty ff202000.zptty: driver installed
[ 1124.151768] zptty ff202000.zptty: device name    = zptty0
[ 1124.158807] zptty ff202000.zptty: private record = ee9e3200 (332bytes)
[ 1124.165893] zptty ff202000.zptty: major number   = 240
[ 1124.171015] zptty ff202000.zptty: minor number   = 0
[ 1124.177007] zptty ff202000.zptty: regs resource  = [mem 0xff202000-0xff202fff flags 0x200]
[ 1124.185780] zptty ff202000.zptty: regs address   = f217e000
[ 1124.191336] zptty ff202000.zptty: irq resource   = [irq 67 flags 0x404]
[ 1124.198906] zptty ff202000.zptty: tx buf size    = 128
[ 1124.204554] zptty ff202000.zptty: rx buf size    = 128
fpga@debian-fpga:~/examples/fibonacci$ ruby test.rb
0 => 0
1 => 1
2 => 1
3 => 2
4 => 3
5 => 5
6 => 8
7 => 13
8 => 21
9 => 34
10 => 55
11 => 89
12 => 144
13 => 233
14 => 377
15 => 610
16 => 987
17 => 1597
18 => 2584
19 => 4181
20 => 6765
21 => 10946
22 => 17711
23 => 28657
24 => 46368
25 => 75025
26 => 121393
27 => 196418
28 => 317811
29 => 514229
30 => 832040
31 => 1346269
32 => 2178309
33 => 3524578
34 => 5702887
35 => 9227465
36 => 14930352
37 => 24157817
38 => 39088169
39 => 63245986
40 => 102334155
41 => 165580141
42 => 267914296
43 => 433494437
44 => 701408733
45 => 1134903170
46 => 1836311903
47 => 2971215073
48 => 4807526976
49 => 7778742049
50 => 12586269025
51 => 20365011074
52 => 32951280099
53 => 53316291173
54 => 86267571272
55 => 139583862445
56 => 225851433717
57 => 365435296162
58 => 591286729879
59 => 956722026041
60 => 1548008755920
61 => 2504730781961
62 => 4052739537881
63 => 6557470319842
64 => 10610209857723
65 => 17167680177565
66 => 27777890035288
67 => 44945570212853
68 => 72723460248141
69 => 117669030460994
70 => 190392490709135
71 => 308061521170129
72 => 498454011879264
73 => 806515533049393
74 => 1304969544928657
75 => 2111485077978050
76 => 3416454622906707
77 => 5527939700884757
78 => 8944394323791464
79 => 14472334024676221
80 => 23416728348467685
81 => 37889062373143906
82 => 61305790721611591
83 => 99194853094755497
84 => 160500643816367088
85 => 259695496911122585
86 => 420196140727489673
87 => 679891637638612258
88 => 1100087778366101931
89 => 1779979416004714189
90 => 2880067194370816120

終わったら 必ず uninstall して device tree を削除してください。

fpga@debian-fpga:~/examples/fibonacci$ sudo rake uninstall
dtbocfg.rb --remove zptty0
[ 1254.109991] zptty ff202000.zptty: driver removed

zundoko

以下の記事で紹介した実例です。

スクリプトには ruby の rake を使っています。ここでは Rakefile の説明はしませんので、詳細を知りたい方は Rakefile を見てください。

fpga@debian-fpga:~/examples/zundoko$ rake -T
rake fpga:install     # Install fpga
rake install          # Install fpga and devicetrees
rake run              # run
rake uninstall        # Uninstall fpga and devicetrees
rake zptty:install    # Install zptty device driver
rake zptty:uninstall  # Unnstall zptty device driver

rake install で、FPGA と Device Tree をインストールします。
インストールには super user 権限が必要です。sudo を使って実行してください。

fpga@debian-fpga:~/examples/zundoko$ ruby zundoko.rb
["ZUN", "ZUN", "DOKO", "ZUN", "ZUN", "ZUN", "ZUN", "DOKO", "KI.YO.SHI!"]
fpga@debian-fpga:~/examples/zundoko$ ruby zundoko.rb
["ZUN", "ZUN", "DOKO", "DOKO", "DOKO", "DOKO", "ZUN", "ZUN", "ZUN", "ZUN", "ZUN", "ZUN", "DOKO", "KI.YO.SHI!"]
fpga@debian-fpga:~/examples/zundoko$ ruby zundoko.rb
["ZUN", "ZUN", "DOKO", "ZUN", "ZUN", "ZUN", "DOKO", "ZUN", "ZUN", "DOKO", "DOKO", "DOKO", "DOKO", "DOKO", "ZUN", "ZUN", "ZUN", "DOKO", "DOKO", "DOKO", "ZUN", "DOKO", "DOKO", "DOKO", "DOKO", "ZUN", "DOKO", "ZUN", "DOKO", "ZUN", "ZUN", "ZUN", "ZUN", "DOKO", "KI.YO.SHI!"]
fpga@debian-fpga:~/examples/zundoko$ ruby zundoko.rb
["DOKO", "ZUN", "ZUN", "DOKO", "DOKO", "DOKO", "ZUN", "DOKO", "DOKO", "ZUN", "DOKO", "ZUN", "ZUN", "ZUN", "DOKO", "DOKO", "DOKO", "ZUN", "ZUN", "ZUN", "DOKO", "ZUN", "DOKO", "ZUN", "ZUN", "ZUN", "ZUN", "DOKO", "KI.YO.SHI!"]

終わったら 必ず uninstall して device tree を削除してください。

fpga@debian-fpga:~/examples/zundoko$ sudo rake uninstall
dtbocfg.rb --remove zptty0
[ 1369.786291] zptty ff202000.zptty: driver removed
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?