Mercurial > hg > beaglert
comparison scripts/build_pd.sh @ 160:5bcf04234f80 heavy-updated
- added -std=c99 to Makefile for user-supplied C files (required for heavy files)
- changed heavy core render.cpp file to use latest API and removed all redundant functions (e.g. foleyDesigner/touchkey stuff)
- use build_pd.sh to compile and run pd files (-h for usage instructions)
author | chnrx <chris.heinrichs@gmail.com> |
---|---|
date | Thu, 05 Nov 2015 18:58:26 +0000 |
parents | |
children | 07735c9d95c8 |
comparison
equal
deleted
inserted
replaced
159:1e7db6610600 | 160:5bcf04234f80 |
---|---|
1 #!/bin/bash | |
2 | |
3 # shell script for automatic uploading/compiling of pd patch onto bbb | |
4 # Christian Heinrichs 2015 | |
5 # | |
6 # example usage: sh upload-and-compile.sh -f bwg-tests -q -e | |
7 | |
8 workingdir=".." | |
9 verbose="0" | |
10 render="0" | |
11 pdpath="" | |
12 projectpath="../projects/heavy/hvtemp" | |
13 BBB_PATH="~/BeagleRT" | |
14 BBB_ADDRESS="root@192.168.7.2" | |
15 COMMAND_ARGS= | |
16 RUN_PROJECT=1 | |
17 RUN_IN_FOREGROUND=0 | |
18 RUN_WITHOUT_SCREEN=1 | |
19 | |
20 function usage | |
21 { | |
22 echo " | |
23 USAGE: build_pd.sh [[-i input folder containing _main.pd file ] [-o output folder for new heavy project .c files (default ../projects/heavy/hvtemp)] [-b bbb path to copy to (default ~/BeagleRT)] | [-h]] | |
24 " | |
25 echo "example: build_pd.sh -i ../projects/heavy/pd/hello-world -o ../projects/heavy/hello-world" | |
26 } | |
27 | |
28 while [ "$1" != "" ]; do | |
29 case $1 in | |
30 -b | --bbb ) shift | |
31 BBB_PATH=$1 | |
32 ;; | |
33 -i | --input ) shift | |
34 pdpath=$1 | |
35 ;; | |
36 -o | --output ) shift | |
37 projectpath=$1 | |
38 ;; | |
39 -v | --verbose ) shift | |
40 verbose=1 | |
41 ;; | |
42 -r | --render ) shift | |
43 render=1 | |
44 ;; | |
45 -h | --help ) usage | |
46 exit | |
47 ;; | |
48 * ) usage | |
49 exit 1 | |
50 esac | |
51 shift | |
52 done | |
53 | |
54 /usr/bin/python hvresources/uploader.py "$pdpath"/ -n bbb -g c -o "$projectpath"/; | |
55 if [ $? -ne 0 ]; then | |
56 /usr/local/bin/python hvresources/uploader.py "$pdpath"/ -n bbb -g c -o "$projectpath"/; | |
57 if [ $? -ne 0 ]; then | |
58 #echo "ERROR: an error occurred while executing the uploader.py script" | |
59 echo "error" | |
60 exit 1 | |
61 fi; | |
62 fi; | |
63 echo ""; | |
64 #echo "*|*|* Successfully uploaded and converted pd patch into super-fast optimized C code. Brought to you by Heavy! *|*|*"; | |
65 echo ""; | |
66 | |
67 # check how to copy/sync render.cpp file... | |
68 if [ $render -eq 0 ]; then | |
69 cp "hvresources/render.cpp" $projectpath/; | |
70 fi; | |
71 | |
72 rsync -c -r "$projectpath"/ "$BBB_ADDRESS":"$BBB_PATH"/source; | |
73 | |
74 if [ $? -ne 0 ]; then | |
75 echo ""; | |
76 echo ":( :( :( ERROR: while synchronizing files with the BBB. Is the board connected and the correct SD card inserted? :( :( :("; | |
77 echo ""; | |
78 exit 1; | |
79 fi; | |
80 | |
81 # Make new BeagleRT executable and run | |
82 if [ $RUN_PROJECT -eq 0 ] | |
83 then | |
84 echo "Building project..." | |
85 ssh $BBB_ADDRESS "make all -C $BBB_PATH" | |
86 else | |
87 echo "Building and running project..." | |
88 | |
89 if [ $RUN_WITHOUT_SCREEN -ne 0 ] | |
90 then | |
91 ssh -t $BBB_ADDRESS "make all -C $BBB_PATH && $BBB_PATH/BeagleRT $COMMAND_ARGS" | |
92 elif [ $RUN_IN_FOREGROUND -eq 0 ] | |
93 then | |
94 ssh $BBB_ADDRESS "make all -C $BBB_PATH && screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS" | |
95 else | |
96 ssh -t $BBB_ADDRESS "make all -C $BBB_PATH && screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS" | |
97 fi | |
98 fi | |
99 | |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | |
107 #ssh -t root@192.168.7.2 "kill -s 2 \`pidof heavy_template\` 2>/dev/null; sleep 0.5; rm -f ~/$filename_bbb/Release/source/heavy/HvContext_bbb.? ~/$filename_bbb/Release/heavy_template && make all -C ~/$filename_bbb/Release" &>/dev/null |