summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Geiselbrecht <travisg@google.com>2012-06-26 18:37:43 -0700
committerTravis Geiselbrecht <travisg@google.com>2012-06-26 19:08:36 -0700
commit2c02c087d74cf944f2a70a83108df0e4f2c8d796 (patch)
tree41951b3b0c7b30b6dfa02fcc2369e807a84baf77
parent96e57b234d0c89ebc596c7e2b8146b3f3f421b1f (diff)
downloadadk2012_demo-2c02c087d74cf944f2a70a83108df0e4f2c8d796.tar.gz
[makefile build] add 3 helper scripts to grab necessary tools and automate some of the tasks
Change-Id: I23285a0e960fd65d196bf128a7e74c2739e12233
-rwxr-xr-xMakefileBasedBuild/build10
-rwxr-xr-xMakefileBasedBuild/flash28
-rwxr-xr-xMakefileBasedBuild/setup38
3 files changed, 76 insertions, 0 deletions
diff --git a/MakefileBasedBuild/build b/MakefileBasedBuild/build
new file mode 100755
index 0000000..7085365
--- /dev/null
+++ b/MakefileBasedBuild/build
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+export PATH=$PATH:`pwd`/g++_arm_none_eabi/bin
+
+echo building adk2tool
+make -C ../tools/adk2tool || exit 1
+
+echo building firmware
+make -C app $@ || exit 1
+
diff --git a/MakefileBasedBuild/flash b/MakefileBasedBuild/flash
new file mode 100755
index 0000000..564b661
--- /dev/null
+++ b/MakefileBasedBuild/flash
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# customize this to point to the uart the adk2012 is mapped as
+UART=/dev/ttyUSB0
+
+BINARY_SUFFIX=
+if [ "`uname -o 2>/dev/null`" == 'Cygwin' ]; then
+ BINARY_SUFFIX=.exe
+fi
+
+ADK2TOOL=../tools/adk2tool/build-adk2tool/adk2tool${BINARY_SUFFIX}
+BOSSAC=./bossac${BINARY_SUFFIX}
+
+if [ ! -x $BOSSAC ]; then
+ echo "please download and install the bossac binary in the current directory to continue"
+ exit 1
+fi
+
+echo erasing device on $UART
+$ADK2TOOL $UART erase || exit 1
+
+echo flashing the device
+$BOSSAC -b -w -v app/bin/test_sam3x_ek_sam3x8-flash.bin || exit 1
+
+echo resetting the device
+$ADK2TOOL $UART reset
+
+
diff --git a/MakefileBasedBuild/setup b/MakefileBasedBuild/setup
new file mode 100755
index 0000000..dc6845a
--- /dev/null
+++ b/MakefileBasedBuild/setup
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+TOOLCHAIN_EXTRACTED_PATH=g++_arm_none_eabi
+
+if [ `uname` == 'Linux' ]; then
+ TOOLCHAIN_FILE=gcc-arm-none-eabi-4.4.1-2010q1-188-linux32.tar.gz
+ BINARY_SUFFIX=
+elif [ `uname` == 'Darwin' ]; then
+ TOOLCHAIN_FILE=gcc-arm-none-eabi-4.4.1-2010q1-188-macos.tar.gz
+ BINARY_SUFFIX=
+elif [ `uname -o` == 'Cygwin' ]; then
+ TOOLCHAIN_FILE=gcc-arm-none-eabi-4.4.1-2010q1-188-win32.tar.gz
+ BINARY_SUFFIX=.exe
+fi
+
+TOOLCHAIN_URL=http://arduino.googlecode.com/files/${TOOLCHAIN_FILE}
+
+if [ ! -d "`pwd`/$TOOLCHAIN_EXTRACTED_PATH" ]; then
+ rm -f $TOOLCHAIN_FILE
+ echo Fetching toolchain from $TOOLCHAIN_URL
+ wget $TOOLCHAIN_URL || exit 1
+ echo Extracting toolchain
+ tar xzf $TOOLCHAIN_FILE || exit 1
+fi
+
+if [ "$1" != '-q' ]; then
+ echo "Toolchain download, please add to your path"
+ echo 'export PATH=$PATH:'\"`pwd`/$TOOLCHAIN_EXTRACTED_PATH/bin\"
+fi
+
+# check for bossac
+if [ ! -f bossac${BINARY_SUFFIX} ]; then
+ echo ""
+ echo "Please download the appropriate bossac binary from the bossa project page at "
+ echo "http://sourceforge.net/projects/b-o-s-s-a/"
+ echo "Place the bossac binary in the current directory"
+fi
+