Files
timely-reference/firmware/jlink.sh
Max Regan 573504547c Add button tests
This is implemented by connecting the DTR pin of the serial device to the BTN_UP pin of the watch.

Also, make it possible to flash different applications with the Makefile.

Resolves #4
2020-06-11 16:39:51 +00:00

42 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Copyright (C) 2020 Max Regan
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
set -e
DEVICE_TYPE=$1
APP_BIN="$2"
ADDR=0x8000000
FLASH_SCRIPT="\
exitonerror 1
h
r
loadbin ${APP_BIN} ${ADDR}
g
q"
flash_script="$(mktemp)"
echo "$FLASH_SCRIPT" > "$flash_script"
JLinkExe -device "$DEVICE_TYPE" -if SWD \
-speed auto -autoconnect 1 -CommanderScript "$flash_script"
rm "$flash_script"