diff 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
line wrap: on
line diff
--- a/scripts/build_project.sh	Wed Jul 15 17:50:09 2015 +0100
+++ b/scripts/build_project.sh	Wed Jul 15 18:53:10 2015 +0100
@@ -7,11 +7,12 @@
 BBB_ADDRESS="root@192.168.7.2"
 BBB_PATH="~/BeagleRT"
 RUN_PROJECT=1
+COMMAND_ARGS=
 
 function usage
 {
     THIS_SCRIPT=`basename "$0"`
-    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-n] <directory-with-source-files>"
+    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-n] <directory-with-source-files>"
     echo "
     This script copies a directory of source files to the BeagleBone, compiles
     and runs it. The BeagleRT core files should have first been copied over
@@ -20,15 +21,18 @@
     The source directory should contain at least one .c, .cpp or .S file.
     If the argument -n is passed, the output will not be run after compiling.
     The argument -b will change the local path on the BeagleBone where the
-    BeagleRT files are found."
+    BeagleRT files are found. The -c option passes command-line arguments to
+    the BeagleRT program; enclose the argument string in quotes."
 }
 
 OPTIND=1
 
-while getopts "b:nh" opt; do
+while getopts "b:c:nh" opt; do
     case $opt in
         b)            BBB_PATH=$OPTARG
                       ;;
+        c)            COMMAND_ARGS=$OPTARG
+                      ;;
         n)    	      RUN_PROJECT=0
                       ;;
         h|\?)         usage
@@ -73,5 +77,5 @@
     ssh $BBB_ADDRESS "make all -C $BBB_PATH"
 else
     echo "Building and running project..."
-    ssh $BBB_ADDRESS "make all -C $BBB_PATH ; screen -d -m $BBB_PATH/BeagleRT"
+    ssh $BBB_ADDRESS "make all -C $BBB_PATH ; screen -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS"
 fi
\ No newline at end of file