Mercurial > hg > beaglert
comparison scripts/run_pd_libpd.sh @ 377:a430a16d2c02 prerelease
Updated scripts so that the Bela folder on the bbb is ~/Bela. Note: BeagleRT_startup.sh is still the same (because the reference to it needs to be changed in /etc/init.d/ ....
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 11 Jun 2016 01:54:43 +0100 |
parents | dca0ca81b685 |
children | 99de323c13b3 |
comparison
equal
deleted
inserted
replaced
376:9d2ed561aac5 | 377:a430a16d2c02 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # This script compiles a BeagleRT project on the BeagleBone Black and | 3 # This script compiles a Bela project on the BeagleBone Black and |
4 # optionally runs it. Pass a directory path in the first argument. | 4 # optionally runs it. Pass a directory path in the first argument. |
5 # The source files in this directory are copied to the board and compiled. | 5 # The source files in this directory are copied to the board and compiled. |
6 | 6 |
7 BBB_ADDRESS="root@192.168.7.2" | 7 BBB_ADDRESS="root@192.168.7.2" |
8 BBB_LIBPD_EXECUTABLE_PATH="~/libpd/BeagleRT" | 8 BBB_LIBPD_EXECUTABLE_PATH="~/libpd/Bela" |
9 BBB_LIBPD_PROJECT_PATH="~/libpd/source/" | 9 BBB_LIBPD_PROJECT_PATH="~/libpd/source/" |
10 RUN_PROJECT=1 | 10 RUN_PROJECT=1 |
11 COMMAND_ARGS= | 11 COMMAND_ARGS= |
12 RUN_IN_FOREGROUND=0 | 12 RUN_IN_FOREGROUND=0 |
13 RUN_WITHOUT_SCREEN=0 | 13 RUN_WITHOUT_SCREEN=0 |
16 { | 16 { |
17 THIS_SCRIPT=`basename "$0"` | 17 THIS_SCRIPT=`basename "$0"` |
18 echo "Usage: $THIS_SCRIPT [-c command-line-args] [-nfF] <directory-with-source-files>" | 18 echo "Usage: $THIS_SCRIPT [-c command-line-args] [-nfF] <directory-with-source-files>" |
19 echo " | 19 echo " |
20 This script copies a PureData project to the BeagleBone and runs it | 20 This script copies a PureData project to the BeagleBone and runs it |
21 using libpd. The BeagleRT-libpd executable should have first been copied | 21 using libpd. The Bela-libpd executable should have first been copied |
22 to the $BBB_LIBPD_EXECUTABLE_PATH folder on the Beaglebone. | 22 to the $BBB_LIBPD_EXECUTABLE_PATH folder on the Beaglebone. |
23 The source directory should contain a file called _main.pd, which is the | 23 The source directory should contain a file called _main.pd, which is the |
24 patch that will be loaded into Pd. All the content of the folder is | 24 patch that will be loaded into Pd. All the content of the folder is |
25 recursively copied and the folder structure is flattened. | 25 recursively copied and the folder structure is flattened. |
26 If the argument -n is passed, the output will not be run after compiling. | 26 If the argument -n is passed, the output will not be run after compiling. |
27 The -c option passes command-line arguments to the BeagleRT program; | 27 The -c option passes command-line arguments to the Bela program; |
28 enclose the argument string in quotes. | 28 enclose the argument string in quotes. |
29 | 29 |
30 The -f argument runs the project in the foreground of the current terminal, | 30 The -f argument runs the project in the foreground of the current terminal, |
31 within a screen session that can be detached later with ctrl-A ctrl-D. | 31 within a screen session that can be detached later with ctrl-A ctrl-D. |
32 The -F argument runs the project in the foreground of the current terminal, | 32 The -F argument runs the project in the foreground of the current terminal, |
70 echo "Please provide a directory containing the _main.pd file and additional abstractions" | 70 echo "Please provide a directory containing the _main.pd file and additional abstractions" |
71 usage | 71 usage |
72 exit | 72 exit |
73 fi | 73 fi |
74 | 74 |
75 # Stop BeagleRT and clean out old source files | 75 # Stop Bela and clean out old source files |
76 echo "Stopping BeagleRT and removing old source files..." | 76 echo "Stopping Bela and removing old source files..." |
77 ssh -t -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null;\ | 77 ssh -t -t $BBB_ADDRESS "screen -X -S Bela quit &>/dev/null;\ |
78 pkill BeagleRT ; rm -rf $BBB_LIBPD_PROJECT_PATH/; mkdir -p $BBB_LIBPD_PROJECT_PATH; " | 78 pkill Bela ; rm -rf $BBB_LIBPD_PROJECT_PATH/; mkdir -p $BBB_LIBPD_PROJECT_PATH; " |
79 | 79 |
80 # Copy new source files to the board | 80 # Copy new source files to the board |
81 echo "Copying new pd projects to BeagleBone..." | 81 echo "Copying new pd projects to BeagleBone..." |
82 scp $PROJECT_FILES "$BBB_ADDRESS:$BBB_LIBPD_PROJECT_PATH" | 82 scp $PROJECT_FILES "$BBB_ADDRESS:$BBB_LIBPD_PROJECT_PATH" |
83 | 83 |
85 then | 85 then |
86 echo "Error while copying files" | 86 echo "Error while copying files" |
87 exit | 87 exit |
88 fi | 88 fi |
89 | 89 |
90 # Make new BeagleRT executable and run | 90 # Make new Bela executable and run |
91 if [ $RUN_PROJECT -eq 0 ] | 91 if [ $RUN_PROJECT -eq 0 ] |
92 then | 92 then |
93 echo "Files copied. Run without \"-n\" to run the project" | 93 echo "Files copied. Run without \"-n\" to run the project" |
94 else | 94 else |
95 echo "Running project..." | 95 echo "Running project..." |
97 if [ $RUN_WITHOUT_SCREEN -ne 0 ] | 97 if [ $RUN_WITHOUT_SCREEN -ne 0 ] |
98 then | 98 then |
99 ssh -t $BBB_ADDRESS "cd $BBB_LIBPD_PROJECT_PATH && $BBB_LIBPD_EXECUTABLE_PATH $COMMAND_ARGS" | 99 ssh -t $BBB_ADDRESS "cd $BBB_LIBPD_PROJECT_PATH && $BBB_LIBPD_EXECUTABLE_PATH $COMMAND_ARGS" |
100 elif [ $RUN_IN_FOREGROUND -eq 0 ] | 100 elif [ $RUN_IN_FOREGROUND -eq 0 ] |
101 then | 101 then |
102 ssh $BBB_ADDRESS "cd $BBB_LIBPD_PROJECT_PATH && screen -S BeagleRT -d -m \ | 102 ssh $BBB_ADDRESS "cd $BBB_LIBPD_PROJECT_PATH && screen -S Bela -d -m \ |
103 $BBB_LIBPD_EXECUTABLE_PATH $COMMAND_ARGS" | 103 $BBB_LIBPD_EXECUTABLE_PATH $COMMAND_ARGS" |
104 else | 104 else |
105 ssh -t $BBB_ADDRESS "cd $BBB_LIBPD_PROJECT_PATH && screen -S BeagleRT $BBB_LIBPD_EXECUTABLE_PATH $COMMAND_ARGS" | 105 ssh -t $BBB_ADDRESS "cd $BBB_LIBPD_PROJECT_PATH && screen -S Bela $BBB_LIBPD_EXECUTABLE_PATH $COMMAND_ARGS" |
106 fi | 106 fi |
107 fi | 107 fi |