Refactor ARM flash script.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 27 Aug 2009 14:46:12 +0000 (14:46 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 27 Aug 2009 14:46:12 +0000 (14:46 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2799 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/cpu/arm/scripts/common.sh [new file with mode: 0644]
bertos/cpu/arm/scripts/flash.sh

diff --git a/bertos/cpu/arm/scripts/common.sh b/bertos/cpu/arm/scripts/common.sh
new file mode 100644 (file)
index 0000000..72fa50c
--- /dev/null
@@ -0,0 +1,14 @@
+BASE_DIR=`dirname $0`
+INT_FILE=${BASE_DIR}/openocd/${PROGRAMMER_TYPE}.cfg 
+CPU_FILE=${BASE_DIR}/openocd/${PROGRAMMER_CPU}.cfg 
+
+if [ ! -f ${INT_FILE} ]; then
+       printf "Interface ${PROGRAMMER_TYPE} not supported\n";
+       exit 1;
+fi
+
+if [ ! -f ${CPU_FILE} ]; then
+       printf "CPU ${PROGRAMMER_CPU} not supported\n";
+       exit 1;
+fi
+
index fb73865e2e0bc9cad351abf9d5cbfaaac78fadef..fd2e1348eab3d9a4f2ae86578449db99fc732475 100755 (executable)
@@ -2,19 +2,9 @@
 #set -x
 
 BASE_DIR=`dirname $0`
-INT_FILE=${BASE_DIR}/openocd/${PROGRAMMER_TYPE}.cfg 
-CPU_FILE=${BASE_DIR}/openocd/${PROGRAMMER_CPU}.cfg 
-OUT_FILE="openocd.tmp"
-
-if [ ! -f ${INT_FILE} ]; then
-       printf "Interface ${PROGRAMMER_TYPE} not supported\n";
-       exit 1;
-fi
+. ${BASE_DIR}/common.sh
 
-if [ ! -f ${CPU_FILE} ]; then
-       printf "CPU ${PROGRAMMER_CPU} not supported\n";
-       exit 1;
-fi
+OUT_FILE="openocd.tmp"
 
 sed -e "s#PROGRAMMER_TYPE#${INT_FILE}#" ${BASE_DIR}/openocd/flash.cfg | sed -e "s#PROGRAMMER_CPU#${CPU_FILE}#" \
        | sed -e "s#IMAGE_FILE#${IMAGE_FILE}#" > ${OUT_FILE}