aboutsummaryrefslogtreecommitdiffstats
path: root/support/scripts/openocd-wrapper.sh
blob: 73be92e4783a7ad7f2e6c7100b0d0c8d052cd52c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash

# Helper to decide which openocd script to use. We only support 0.3.x and 0.4.x.

if [ $# -ne 1 ]
then
  echo "Usage: `basename $0` {flash|debug}"
  exit 1
fi

OPENOCD_VERSION=`openocd -v 2>&1 | head -n1 | \
                 awk '{print $4}' | sed 's/\([0-9]*\.[0-9]*\)\.[0-9]*/\1/'`

CFG_FILE=$1_${OPENOCD_VERSION}.cfg

openocd -f support/openocd/$CFG_FILE