Skip to content

Commit 46bd014

Browse files
committed
make sure BMP runner fails on errors
1 parent 3cbec51 commit 46bd014

File tree

4 files changed

+42
-33
lines changed

4 files changed

+42
-33
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2-
runner = "./blackmagic-run.sh flash logs"
2+
runner = "tools/blackmagic-runner.sh run"
33

44
[build]
55
target = "thumbv6m-none-eabi"

blackmagic-run.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

tools/blackmagic-flash.gdb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target extended-remote /dev/ttyBmpGdb
2+
monitor swdp_scan
3+
attach 1
4+
load
5+
compare-sections

tools/blackmagic-runner.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
usage () {
6+
echo "usage: $0 {flash | logs} binary"
7+
exit 1
8+
}
9+
10+
[ "$#" -ne 2 ] && usage
11+
12+
COMMAND=$1
13+
EXECUTABLE=$2
14+
THISDIR=$(dirname "$0")
15+
16+
flash () {
17+
arm-none-eabi-gdb -nx --batch -x "$THISDIR/blackmagic-flash.gdb" "$1"
18+
}
19+
20+
run () {
21+
echo "waiting for the logs..."
22+
socat /dev/ttyBmpTarg,rawer,b115200 STDOUT | defmt-print -e "$1"
23+
}
24+
25+
case $COMMAND in
26+
flash)
27+
flash "$EXECUTABLE" ;;
28+
logs)
29+
run "$EXECUTABLE" ;;
30+
run)
31+
flash "$EXECUTABLE"
32+
run "$EXECUTABLE"
33+
;;
34+
*)
35+
usage ;;
36+
esac

0 commit comments

Comments
 (0)