Move all Openocd-related files to separate folder; initial 'make flash' support for...
[bertos.git] / bertos / cpu / arm / scripts / flash.sh
1 #! /usr/bin/env bash
2 set -x
3
4 BASE_DIR=`dirname $0`
5 INT_FILE=${BASE_DIR}/openocd/${PROGRAMMER_TYPE}.tcl 
6 CPU_FILE=${BASE_DIR}/openocd/${PROGRAMMER_CPU}.tcl 
7
8 if [ ! -f ${INT_FILE} ]; then
9         printf "Interface ${PROGRAMMER_TYPE} not supported\n";
10         exit 1;
11 fi
12
13 if [ ! -f ${CPU_FILE} ]; then
14         printf "CPU ${PROGRAMMER_CPU} not supported\n";
15         exit 1;
16 fi
17
18 sed -e "s#PROGRAMMER_TYPE#${INT_FILE}#" ${BASE_DIR}/openocd/flash.cfg | sed -e "s#PROGRAMMER_CPU#${CPU_FILE}#" > openocd.tmp