aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/KINETIS/KL27Z/BLINK/flash_via_bldr.sh
diff options
context:
space:
mode:
authorflabbergast <s3+flabbergast@sdfeu.org>2016-03-22 18:49:34 +0000
committerflabbergast <s3+flabbergast@sdfeu.org>2016-03-22 18:49:34 +0000
commitad63d7978057b70eacff2fe8617198bf4aedc3b6 (patch)
tree4f41a0354f599ddcdcad0731b81c1934d13f6099 /testhal/KINETIS/KL27Z/BLINK/flash_via_bldr.sh
parent82ada2bb218fe2481050e7021d0c17dbbb154a6b (diff)
downloadChibiOS-Contrib-ad63d7978057b70eacff2fe8617198bf4aedc3b6.tar.gz
ChibiOS-Contrib-ad63d7978057b70eacff2fe8617198bf4aedc3b6.tar.bz2
ChibiOS-Contrib-ad63d7978057b70eacff2fe8617198bf4aedc3b6.zip
[KINETIS] Add a custom KL27Z breakout board demo.
Diffstat (limited to 'testhal/KINETIS/KL27Z/BLINK/flash_via_bldr.sh')
-rwxr-xr-xtesthal/KINETIS/KL27Z/BLINK/flash_via_bldr.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/testhal/KINETIS/KL27Z/BLINK/flash_via_bldr.sh b/testhal/KINETIS/KL27Z/BLINK/flash_via_bldr.sh
new file mode 100755
index 0000000..8b0f26f
--- /dev/null
+++ b/testhal/KINETIS/KL27Z/BLINK/flash_via_bldr.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+if [ -z `which blhost` ]; then
+ echo "You'll need to get the 'blhost' utility from Freescale."
+ echo 'http://www.freescale.com/products/arm-processors/kinetis-cortex-m/kinetis-symbols-footprints-and-models/kinetis-bootloader:KBOOT'
+ exit 1
+fi
+
+if [ ! -f build/ch.bin ]; then
+ echo "Perhaps you should compile the firmware first."
+ exit 2
+fi
+
+if [[ `blhost -u -- get-property 1` == *"cannot open USB HID device"* ]]; then
+ echo "Perhaps you should put the device in the bootloader mode first."
+ exit 3
+fi
+
+echo "-> Erasing flash..."
+blhost -u -- flash-erase-all
+
+echo "-> Flashing firmware..."
+blhost -u -- write-memory 0 build/ch.bin
+
+echo "-> Resetting MCU (allow 5 seconds for the firmware to start)..."
+blhost -u -- reset