From: batt Date: Thu, 27 Aug 2009 14:46:12 +0000 (+0000) Subject: Refactor ARM flash script. X-Git-Tag: 2.2.0~169 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=2f4077bbbd49ca12443d38aba7a6f4411e43c026;p=bertos.git Refactor ARM flash script. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2799 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/arm/scripts/common.sh b/bertos/cpu/arm/scripts/common.sh new file mode 100644 index 00000000..72fa50ce --- /dev/null +++ b/bertos/cpu/arm/scripts/common.sh @@ -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 + diff --git a/bertos/cpu/arm/scripts/flash.sh b/bertos/cpu/arm/scripts/flash.sh index fb73865e..fd2e1348 100755 --- a/bertos/cpu/arm/scripts/flash.sh +++ b/bertos/cpu/arm/scripts/flash.sh @@ -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}