前回に引き続き、以下のチュートリアルの追試行を行う。
BeagleBone Black: Introduction to PRU-ICSS
Example 1 – PRU0 blinking LED
このExampleはpr1_pru0_pru_r30[14]/GPIO1[12]を制御してLEDを点滅させる。http://junkbox.wpblog.jp/2014/10/02/beagle-bone-black%e3%81%aepru%e3%82%92%e5%ad%a6%e3%81%b6%ef%bc%88%e3%81%9d%e3%81%ae%ef%bc%92%ef%bc%89/
pr1_pru0_pru_r30[14]はコネクタP8の12番ピンにアサインされていて、ここに1KΩの制限抵抗とLEDをシリーズに接続し、コネクタP8の2番ピンのDGNDに接地させる。
手順をなぞる。
PRUSSからコネクタP8の12番ピンをpr1_pru0_pru_r30[14]として制御できるようにする。
いきなりPinMuxUtilityなるものが出てくる。
これはTIが提供するAM335Xを含むSoCの多目的ポートの用途を指定するためのユーティリティであり、Windowsアプリケーションのようだ。
Windows8.1にインストールして実行することができている。
起動するとSelect one of the following device types.と聞いてくるのでAM335x Rev 2Xを選択してOKをクリックする。
引き続きPlease select your packege typeと聞いてくるのでZCZを選択する。
IO Power Connectionsでは全て3.3Vを選択しOKをクリックする。
Pin Mux Utilityが立ち上がる。
Mode 6の上から13番目のpr1_pru0_pru_r30[14]をクリックするとセルが緑に変わるとともに、Mode 7のgpio1[12]のシアンが白に変わる。
この状態で File->Save-> Source file ->Linuxを選択しファイルを保存する。
pinmux.hファイルを開き”MODE6″で検索すると以下がみつかる。
MUX_VAL(CONTROL_PADCONF_GPMC_AD12, (IDIS | PD | MODE6 )) /* pr1_pru0_pru_r30[14] */\
mux.hファイルを開き、”CONTROL_PADCONF_GPMC_AD12″で検索すると以下が見つかる。
#define CONTROL_PADCONF_GPMC_AD12 0x0830
0x0830はAM335X_CTRL_BASEに対するオフセット。
CONTROL_MODULE Registersのベースアドレスは0x44E1_0000。
conf_gpmc_ad0のオフセットは 0x800。
0x0830はconf_gpmc_ad12に該当する。
詳細は以下参照。
http://www.ti.com/lit/ug/spruh73l/spruh73l.pdf
Page 1420 9.3.1.50 conf__ Register (offset = 800h?A34h)
Table 9-57. conf__ Register Field Descriptions
bit 6: conf___slewctrl Type: R/W Description: X Select between faster or slower slew rate 0: Fast 1: Slow bit 5: conf___rxactive Tyoe: R/W Description: Input enable value for the PAD 0: Receiver disabled 1: Receiver enabled bit 4: conf___putypese Tyoe: R/W Description: Pad pullup/pulldown type selection 0: Pulldown selected 1: Pullup selected Reset value is pad-dependent. bit 3: conf___puden Tyoe: R/W Description: Pad pullup/pulldown enable 0: Pullup/pulldown enabled 1: Pullup/pulldown disabled Reset value is pad-dependent. bit 2-0: conf___mmode Tyoe: R/W Description: Pad functional signal mux select.
PRUSSからコネクタP8の12番ピンをpr1_pru0_pru_r30[14]として制御できるようにする為にはDevice Treeをoverlayする必要がある。
以下その手順。
debian@beaglebone:/mnt/hostnfs$ cd /lib/firmware/ debian@beaglebone:/lib/firmware$ sudo nano -w BB-BONE-PRU-00A0.dts debian@beaglebone:/lib/firmware$ cat ./BB-BONE-PRU-00A0.dts /* * pru dts file BB-BONE-PRU-00A0.dts */ /dts-v1/; /plugin/; / { compatible = "ti,beaglebone", "ti,beaglebone-black"; /* identification */ part-number = "BB-BONE-PRU"; version = "00A0"; exclusive-use = "P8.12"; fragment@0 { target = <&am33xx_pinmux>; __overlay__ { mygpio: pinmux_mygpio{ pinctrl-single,pins = < 0x30 0x06 >; }; }; }; fragment@1 { target = <&ocp>; __overlay__ { test_helper: helper { compatible = "bone-pinmux-helper"; pinctrl-names = "default"; pinctrl-0 = <&mygpio>; status = "okay"; }; }; }; fragment@2{ target = <&pruss>; __overlay__ { status = "okay"; }; }; };
このコードを書いたのはshabaz氏とのこと。
以下の部分の、0x30はconf_gpmc_ad12レジスタのオフセットであり0x06は設定値。
pinctrl-single,pins = < 0x30 0x06 >;
設定は以下となる。
slewctrl 0: Fast rxactive 0: Receiver disabled bit 4: putypese 0: Pulldown selected bit 3: puden 0: Pullup/pulldown enabled bit 2-0: mmode 6
内部プルダウンが許可になっている事が気になる。
“P8.12″がHighになった際に1KΩの制限抵抗とシリーズ接続されたLEDと並列に内部プルダウン抵抗が存在する事になる。
bit3は1にするべきと思われるが、消費電流が微増するだけであるのでここでは特に修正はしない。
、
dtcでBB-BONE-PRU-00A0.dtsをコンパイルしBB-BONE-PRU-00A0.dtboを生成する。
debian@beaglebone:/lib/firmware$ sudo dtc -@ -O dtb -o BB-BONE-PRU-00A0.dtbo BB-BONE-PRU-00A0.dts debian@beaglebone:/lib/firmware$ sudo reboot
BB-BONE-PRU-00A0.dtboを/sys/devices/bone_capemgrに食べさせると、仮想capeとしてBB-BONE-PRU登録されることになる。
念の為に事前の状態を確認。
debian@beaglebone:~$ sudo -s root@beaglebone:# dmesg | tail -n 10 [ 21.053333] hub 2-0:1.0: Single TT [ 21.053345] hub 2-0:1.0: TT requires at most 8 FS bit times (666 ns) [ 21.053357] hub 2-0:1.0: power on to power good time: 10ms [ 21.053382] hub 2-0:1.0: local power source is good [ 21.053457] hub 2-0:1.0: enabling power on all ports [ 21.153555] hub 2-0:1.0: state 7 ports 1 chg 0000 evt 0000 [ 21.153613] hub 2-0:1.0: hub_suspend [ 21.153641] usb usb2: bus auto-suspend, wakeup 1 [ 23.481895] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready [ 33.849871] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null) root@beaglebone:# export PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins root@beaglebone:# ls -la /sys/devices/bone_capemgr.*/slots -rw-r--r-- 1 root root 4096 May 15 03:01 /sys/devices/bone_capemgr.9/slots root@beaglebone:# export SLOTS=/sys/devices/bone_capemgr.9/slots root@beaglebone:# cat $SLOTS 0: 54:PF--- 1: 55:PF--- 2: 56:PF--- 3: 57:PF--- 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI root@beaglebone:# cat $PINS | grep 830 pin 12 (44e10830) 00000027 pinctrl-single root@beaglebone:# cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pins | grep 44e10830 pin 12 (44e10830) 00000027 pinctrl-single
実行。
root@beaglebone:# echo BB-BONE-PRU > $SLOTS root@beaglebone:# dmesg | tail -n 10 [ 33.849871] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null) [ 241.434045] bone-capemgr bone_capemgr.9: part_number 'BB-BONE-PRU', version 'N/A' [ 241.434486] bone-capemgr bone_capemgr.9: slot #7: generic override [ 241.434543] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 7 [ 241.434598] bone-capemgr bone_capemgr.9: slot #7: 'Override Board Name,00A0,Override Manuf,BB-BONE-PRU' [ 241.434876] bone-capemgr bone_capemgr.9: slot #7: Requesting part number/version based 'BB-BONE-PRU-00A0.dtbo [ 241.434934] bone-capemgr bone_capemgr.9: slot #7: Requesting firmware 'BB-BONE-PRU-00A0.dtbo' for board-name 'Override Board Name', version '00A0' [ 241.438644] bone-capemgr bone_capemgr.9: slot #7: dtbo 'BB-BONE-PRU-00A0.dtbo' loaded; converting to live tree [ 241.439342] bone-capemgr bone_capemgr.9: slot #7: #3 overlays [ 241.444300] bone-capemgr bone_capemgr.9: slot #7: Applied #3 overlays. root@beaglebone:# cat $SLOTS 0: 54:PF--- 1: 55:PF--- 2: 56:PF--- 3: 57:PF--- 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI 7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-PRU root@beaglebone:# cat $PINS | grep 830 pin 12 (44e10830) 00000006 pinctrl-single root@beaglebone:# cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pins | grep 44e10830 pin 12 (44e10830) 00000006 pinctrl-single root@beaglebone:# exit exit debian@beaglebone:~$
capemgrにBB-BONE-PRUが登録されると共にconf_gpmc_ad12のステータスが意図通りに変更されている事がわかる。
ここまでで参照元のSTEP2までが完了。
STEP3では既存のPRUアプリケーションの環境を流用して新規のPRUアプリケーション環境を作成する方法を紹介している。
既存のプロジェクトをディレクトリコピーしてリネームする方法だ。
debian@beaglebone:~$ cd ~/pru/am335x_pru_package/pru_sw/example_apps debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ cp -r PRU_memAccess_DDR_PRUsharedRAM mytest debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ cd mytest/ debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$ make clean rm -rf obj/ *~ ../../app_loader/include/*~ ../bin/PRU_memAcc_DDR_sharedRAM debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$ ls -la total 44 drwxr-xr-x 3 debian debian 4096 Oct 19 13:23 . drwxr-xr-x 7 debian debian 4096 Oct 19 13:23 .. -rw-r--r-- 1 debian debian 292 Oct 19 13:23 log.txt -rw-r--r-- 1 debian debian 696 Oct 19 13:23 Makefile drwxr-xr-x 2 debian debian 4096 Oct 19 13:23 obj -rw-r--r-- 1 debian debian 8665 Oct 19 13:23 PRU_memAcc_DDR_sharedRAM.c -rw-r--r-- 1 debian debian 4217 Oct 19 13:23 PRU_memAcc_DDR_sharedRAM.hp -rw-r--r-- 1 debian debian 3666 Oct 19 13:23 PRU_memAcc_DDR_sharedRAM.p debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$ mv PRU_memAcc_DDR_sharedRAM.c mytest.c debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$ mv PRU_memAcc_DDR_sharedRAM.hp mytest.hp debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$ mv PRU_memAcc_DDR_sharedRAM.p mytest.p debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$ ls -la total 40 drwxr-xr-x 2 debian debian 4096 Oct 19 13:29 . drwxr-xr-x 7 debian debian 4096 Oct 19 13:23 .. -rw-r--r-- 1 debian debian 292 Oct 19 13:23 log.txt -rw-r--r-- 1 debian debian 696 Oct 19 13:23 Makefile -rw-r--r-- 1 debian debian 8665 Oct 19 13:23 mytest.c -rw-r--r-- 1 debian debian 4217 Oct 19 13:23 mytest.hp -rw-r--r-- 1 debian debian 3666 Oct 19 13:23 mytest.p debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$
ここまで実行して、サンプルコードがダウンロードできる事に気付いた。
debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/mytest$ cd .. debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ wget http://analogdigitallab.org/sites/default/files/example_apps.zip --2014-10-19 14:11:48-- http://analogdigitallab.org/sites/default/files/example_apps.zip Resolving analogdigitallab.org (analogdigitallab.org)... 188.93.153.77 Connecting to analogdigitallab.org (analogdigitallab.org)|188.93.153.77|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 100454 (98K) [application/zip] Saving to: `example_apps.zip' 100%[======================================>] 100,454 48.3K/s in 2.0s 2014-10-19 14:11:51 (48.3 KB/s) - `example_apps.zip' saved [100454/100454]
unzipが無いのでインストールする。
debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ sudo apt-get install unzip Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: zip The following NEW packages will be installed: unzip 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 185 kB of archives. After this operation, 317 kB of additional disk space will be used. Get:1 http://ftp.us.debian.org/debian/ wheezy/main unzip armhf 6.0-8 [185 kB] Fetched 185 kB in 2s (64.7 kB/s) Selecting previously unselected package unzip. (Reading database ... 61889 files and directories currently installed.) Unpacking unzip (from .../archives/unzip_6.0-8_armhf.deb) ... Processing triggers for man-db ... Processing triggers for mime-support ... Setting up unzip (6.0-8) ... debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ cd example_apps
Example 1 のサンプルコードはmytestディレクトリ配下ではなくledディレクトリ配下。
debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/example_apps$ cp -r ./led ../ debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/example_apps$ cd .. debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ cd led/ debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led$ ls -la total 36 drwxr-xr-x 3 debian debian 4096 Oct 21 13:40 . drwxr-xr-x 9 debian debian 4096 Oct 21 13:40 .. -rw-r--r-- 1 debian debian 5074 Oct 21 13:40 led.c -rw-r--r-- 1 debian debian 1741 Oct 21 13:40 led.hp -rw-r--r-- 1 debian debian 1026 Oct 21 13:40 led.p -rw-r--r-- 1 debian debian 299 Oct 21 13:40 log.txt -rw-r--r-- 1 debian debian 666 Oct 21 13:40 Makefile drwxr-xr-x 2 debian debian 4096 Oct 21 13:40 obj debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led$
DIRSを書き換える。
debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led$ cd .. debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ nano -w DIRS debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ cat DIRS APP_DIRS := APP_DIRS += PRU_memAccess_DDR_PRUsharedRAM APP_DIRS += PRU_memAccessPRUDataRam APP_DIRS += PRU_PRUtoPRU_Interrupt APP_DIRS += led ASSEM_FILES := ASSEM_FILES += PRU_memAccess_DDR_PRUsharedRAM/PRU_memAcc_DDR_sharedRAM.p ASSEM_FILES += PRU_memAccessPRUDataRam/PRU_memAccessPRUDataRam.p ASSEM_FILES += PRU_PRUtoPRU_Interrupt/PRU_PRU0toPRU1_Interrupt.p ASSEM_FILES += PRU_PRUtoPRU_Interrupt/PRU_PRU1toPRU0_Interrupt.p ASSEM_FILES += led/led.p BIN_FILES := BIN_FILES += PRU_memAcc_DDR_sharedRAM.bin BIN_FILES += PRU_memAccessPRUDataRam.bin BIN_FILES += PRU_PRU0toPRU1_Interrupt.bin BIN_FILES += PRU_PRU1toPRU0_Interrupt.bin BIN_FILES += led.bin debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$
prussdrv_pru_clear_event()の仕様が変わっているのでled.cを修正する。
debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ cd led/ debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led$ nano -w led.c debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led$ diff -u ./led.c ../example_apps/led/led.c --- ./led.c 2014-10-21 13:44:26.672875381 +0000 +++ ../example_apps/led/led.c 2013-10-08 21:50:34.000000000 +0000 @@ -120,7 +120,7 @@ printf("\tINFO: Waiting for HALT command.\r\n"); prussdrv_pru_wait_event (PRU_EVTOUT_0); printf("\tINFO: PRU completed transfer.\r\n"); - prussdrv_pru_clear_event (PRU_EVTOUT_0,PRU0_ARM_INTERRUPT); + prussdrv_pru_clear_event (PRU0_ARM_INTERRUPT); debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led$
makeを行う。
debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led$ cd .. debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ export CROSS_COMPILE= debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ make clean for dir in PRU_memAccess_DDR_PRUsharedRAM PRU_memAccessPRUDataRam PRU_PRUtoPRU_Interrupt led; do make -C $dir clean LIBDIR_APP_LOADER="../../app_loader/lib" LIBDIR_EDMA_DRIVER="" INCDIR_APP_LOADER="../../app_loader/include" INCDIR_EDMA_DRIVER="" BINDIR="../bin"; done make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM' rm -rf obj/ *~ ../../app_loader/include/*~ ../bin/PRU_memAcc_DDR_sharedRAM make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM' make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccessPRUDataRam' rm -rf obj/ *~ ../../app_loader/include/*~ ../bin/PRU_memAccessPRUDataRam make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccessPRUDataRam' make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt' rm -rf obj/ *~ ../../app_loader/include/*~ ../bin/PRU_PRUtoPRU_Interrupt make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt' make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/led' rm -rf obj/ *~ ../../app_loader/include/*~ ../bin/led make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/led' for bin_file in PRU_memAcc_DDR_sharedRAM.bin PRU_memAccessPRUDataRam.bin PRU_PRU0toPRU1_Interrupt.bin PRU_PRU1toPRU0_Interrupt.bin led.bin; do rm -fr bin/$bin_file; done debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ make mkdir -p bin for dir in PRU_memAccess_DDR_PRUsharedRAM PRU_memAccessPRUDataRam PRU_PRUtoPRU_Interrupt led; do make -C $dir CROSS_COMPILE="" LIBDIR_APP_LOADER="../../app_loader/lib" LIBDIR_EDMA_DRIVER="" INCDIR_APP_LOADER="../../app_loader/include" INCDIR_EDMA_DRIVER="" BINDIR="../bin"; done make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM' gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/PRU_memAcc_DDR_sharedRAM.o PRU_memAcc_DDR_sharedRAM.c gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/PRU_memAcc_DDR_sharedRAM obj/PRU_memAcc_DDR_sharedRAM.o -L../../app_loader/lib -lprussdrv make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM' make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccessPRUDataRam' gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/PRU_memAccessPRUDataRam.o PRU_memAccessPRUDataRam.c gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/PRU_memAccessPRUDataRam obj/PRU_memAccessPRUDataRam.o -L../../app_loader/lib -lprussdrv make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_memAccessPRUDataRam' make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt' gcc -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/PRU_PRUtoPRU_Interrupt.o PRU_PRUtoPRU_Interrupt.c gcc -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/PRU_PRUtoPRU_Interrupt obj/PRU_PRUtoPRU_Interrupt.o -L../../app_loader/lib -lprussdrv make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt' make[1]: Entering directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/led' gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/led.o led.c gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/led obj/led.o -L../../app_loader/lib -lprussdrv -lpthread make[1]: Leaving directory `/home/debian/pru/am335x_pru_package/pru_sw/example_apps/led' for a_file in PRU_memAccess_DDR_PRUsharedRAM/PRU_memAcc_DDR_sharedRAM.p PRU_memAccessPRUDataRam/PRU_memAccessPRUDataRam.p PRU_PRUtoPRU_Interrupt/PRU_PRU0toPRU1_Interrupt.p PRU_PRUtoPRU_Interrupt/PRU_PRU1toPRU0_Interrupt.p led/led.p ; \ do \ ../utils/pasm_2 -V3 -b $a_file ; \ done ; \ mv *.bin bin PRU Assembler Version 0.86 Copyright (C) 2005-2013 by Texas Instruments Inc. Pass 2 : 0 Error(s), 0 Warning(s) Writing Code Image of 16 word(s) PRU Assembler Version 0.86 Copyright (C) 2005-2013 by Texas Instruments Inc. Pass 2 : 0 Error(s), 0 Warning(s) Writing Code Image of 14 word(s) PRU Assembler Version 0.86 Copyright (C) 2005-2013 by Texas Instruments Inc. Pass 2 : 0 Error(s), 0 Warning(s) Writing Code Image of 16 word(s) PRU Assembler Version 0.86 Copyright (C) 2005-2013 by Texas Instruments Inc. Pass 2 : 0 Error(s), 0 Warning(s) Writing Code Image of 14 word(s) PRU Assembler Version 0.86 Copyright (C) 2005-2013 by Texas Instruments Inc. Pass 2 : 0 Error(s), 0 Warning(s) Writing Code Image of 19 word(s) debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ led.outを生成させる。 debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps$ cd bin/ debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/bin$ cp ./led.bin ../led/obj/ debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/bin$ cd ../led/obj/ debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led/obj$ gcc led.o -L../../../app_loader/lib -lprussdrv -lpthread -o led.out debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led/obj$
make完了で実行バイナリled.outを得た。
実行するにはcapemgrにBB-BONE-PRUを食べさせている必要がある。
debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led/obj$ sudo ./led.out INFO: Starting led example. INFO: Executing example. INFO: Waiting for HALT command. INFO: PRU completed transfer. debian@beaglebone:~/pru/am335x_pru_package/pru_sw/example_apps/led/obj$
LEDが10回ほど点滅して消灯した。
成功。
次はExample 1の応用となるExample 2 – PRU0 PWMを試す。