Mercurial > hg > beaglert
comparison scripts/build_project.sh @ 60:ad6b2767beaf newapi
Command-line argument support for BeagleRT program in scripts, plus a simple script for halting the BBB
author | andrewm |
---|---|
date | Wed, 15 Jul 2015 18:53:10 +0100 |
parents | 3ffafa57302c |
children | afc593f7469e |
comparison
equal
deleted
inserted
replaced
59:5bdf6efbd0ed | 60:ad6b2767beaf |
---|---|
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_PATH="~/BeagleRT" | 8 BBB_PATH="~/BeagleRT" |
9 RUN_PROJECT=1 | 9 RUN_PROJECT=1 |
10 COMMAND_ARGS= | |
10 | 11 |
11 function usage | 12 function usage |
12 { | 13 { |
13 THIS_SCRIPT=`basename "$0"` | 14 THIS_SCRIPT=`basename "$0"` |
14 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-n] <directory-with-source-files>" | 15 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-n] <directory-with-source-files>" |
15 echo " | 16 echo " |
16 This script copies a directory of source files to the BeagleBone, compiles | 17 This script copies a directory of source files to the BeagleBone, compiles |
17 and runs it. The BeagleRT core files should have first been copied over | 18 and runs it. The BeagleRT core files should have first been copied over |
18 using the setup_board.sh script supplied with BeagleRT. | 19 using the setup_board.sh script supplied with BeagleRT. |
19 | 20 |
20 The source directory should contain at least one .c, .cpp or .S file. | 21 The source directory should contain at least one .c, .cpp or .S file. |
21 If the argument -n is passed, the output will not be run after compiling. | 22 If the argument -n is passed, the output will not be run after compiling. |
22 The argument -b will change the local path on the BeagleBone where the | 23 The argument -b will change the local path on the BeagleBone where the |
23 BeagleRT files are found." | 24 BeagleRT files are found. The -c option passes command-line arguments to |
25 the BeagleRT program; enclose the argument string in quotes." | |
24 } | 26 } |
25 | 27 |
26 OPTIND=1 | 28 OPTIND=1 |
27 | 29 |
28 while getopts "b:nh" opt; do | 30 while getopts "b:c:nh" opt; do |
29 case $opt in | 31 case $opt in |
30 b) BBB_PATH=$OPTARG | 32 b) BBB_PATH=$OPTARG |
33 ;; | |
34 c) COMMAND_ARGS=$OPTARG | |
31 ;; | 35 ;; |
32 n) RUN_PROJECT=0 | 36 n) RUN_PROJECT=0 |
33 ;; | 37 ;; |
34 h|\?) usage | 38 h|\?) usage |
35 exit 1 | 39 exit 1 |
71 then | 75 then |
72 echo "Building project..." | 76 echo "Building project..." |
73 ssh $BBB_ADDRESS "make all -C $BBB_PATH" | 77 ssh $BBB_ADDRESS "make all -C $BBB_PATH" |
74 else | 78 else |
75 echo "Building and running project..." | 79 echo "Building and running project..." |
76 ssh $BBB_ADDRESS "make all -C $BBB_PATH ; screen -d -m $BBB_PATH/BeagleRT" | 80 ssh $BBB_ADDRESS "make all -C $BBB_PATH ; screen -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS" |
77 fi | 81 fi |