diff options
author | flabbergast <s3+flabbergast@sdfeu.org> | 2016-04-14 23:14:19 +0100 |
---|---|---|
committer | flabbergast <s3+flabbergast@sdfeu.org> | 2016-04-14 23:14:19 +0100 |
commit | 6c535853fba87c39c16d5f8a5f3e6f3144e2bc73 (patch) | |
tree | 88b3618043457240f52b2792bef74b2e36e3a836 /demos/NRF51/OSHCHIP_V1.0/patch_hex.sh | |
parent | 8edccaaa967c34c0a0d5e8d36e461ba5cff19d88 (diff) | |
download | ChibiOS-Contrib-6c535853fba87c39c16d5f8a5f3e6f3144e2bc73.tar.gz ChibiOS-Contrib-6c535853fba87c39c16d5f8a5f3e6f3144e2bc73.tar.bz2 ChibiOS-Contrib-6c535853fba87c39c16d5f8a5f3e6f3144e2bc73.zip |
[NRF51] Add OSHChip demo.
Diffstat (limited to 'demos/NRF51/OSHCHIP_V1.0/patch_hex.sh')
-rwxr-xr-x | demos/NRF51/OSHCHIP_V1.0/patch_hex.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/demos/NRF51/OSHCHIP_V1.0/patch_hex.sh b/demos/NRF51/OSHCHIP_V1.0/patch_hex.sh new file mode 100755 index 0000000..81f7c32 --- /dev/null +++ b/demos/NRF51/OSHCHIP_V1.0/patch_hex.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# The official [OSHChip CMSIS-DAP programmer] provides also +# a MBED-type Mass Storage flashing mechanism - copying +# a hex file to the external "drive" flashes the firmware +# to the attached OSHChip. + +# However this MSD flasher expect the hex file to begin with the +# "Extended Linear Address" (e.g. ":020000040000FA"); this happens +# automatically if the firmware is >= 64kB, but MBED online compiler +# does this always. ARM GCC suite does not. Hence this script. + +# [OSHChip CMSIS-DAP programmer]: http://oshchip.org/products/OSHChip_CMSIS_DAP_V1.0_Product.html + +DIR=build +FILEBASE=ch +FILEEXT=hex +FILE="${FILEBASE}.${FILEEXT}" + +if [ ! -f "${DIR}/${FILE}" ]; then + echo "Build the firmware first." + exit 1 +fi + +if $(head "${DIR}/${FILE}" | grep -q ":02000004") ; then + echo "The format of ${DIR}/${FILE} is already good." + exit 2 +fi + +echo ":020000040000FA" > "${DIR}/${FILEBASE}_patched.hex" +cat "${DIR}/${FILE}" >> "${DIR}/${FILEBASE}_patched.hex" |