2014-08-21 14:51:39 +02:00
|
|
|
#!/bin/sh
|
2014-07-30 15:00:48 +02:00
|
|
|
|
|
|
|
# This flash script dynamically generates a file with a set of commands which
|
2014-07-30 15:02:03 +02:00
|
|
|
# have to be handed to the flashing script of SEGGER (JLinkExe >4.84).
|
2014-07-30 15:00:48 +02:00
|
|
|
# After that, JLinkExe will be executed with that set of commands to flash the
|
|
|
|
# latest .bin file to the board.
|
|
|
|
|
|
|
|
# @author Timo Ziegler <timo.ziegler@fu-berlin.de>
|
2014-08-21 14:51:39 +02:00
|
|
|
# @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
2014-07-30 15:00:48 +02:00
|
|
|
|
|
|
|
BINDIR=$1
|
2014-08-21 14:51:39 +02:00
|
|
|
HEXFILE=$2
|
2014-07-30 15:00:48 +02:00
|
|
|
|
2014-08-21 14:51:39 +02:00
|
|
|
# setup JLink command file
|
|
|
|
echo "device nrf51822" > $BINDIR/burn.seg
|
2014-07-30 15:00:48 +02:00
|
|
|
echo "speed 1000" >> $BINDIR/burn.seg
|
|
|
|
echo "w4 4001e504 1" >> $BINDIR/burn.seg
|
2014-08-21 14:51:39 +02:00
|
|
|
echo "loadbin $HEXFILE 0" >> $BINDIR/burn.seg
|
2014-07-30 15:00:48 +02:00
|
|
|
echo "r" >> $BINDIR/burn.seg
|
|
|
|
echo "g" >> $BINDIR/burn.seg
|
|
|
|
echo "exit" >> $BINDIR/burn.seg
|
|
|
|
echo "" >> $BINDIR/burn.seg
|
2014-08-21 14:51:39 +02:00
|
|
|
|
|
|
|
# flash new binary to the board
|
2014-07-30 15:00:48 +02:00
|
|
|
JLinkExe < $BINDIR/burn.seg
|