forked from micro-ROS/micro_ros_setup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.sh
More file actions
executable file
·74 lines (52 loc) · 1.8 KB
/
Copy pathreset.sh
File metadata and controls
executable file
·74 lines (52 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
pushd $FW_TARGETDIR > /dev/null
ZEPHYR_BUILD_DIR="$FW_TARGETDIR/build/zephyr"
# Host platform (=native_posix) is special, as resetting is stopping and re-executing the binary
if [ "$PLATFORM" = "host" ]; then
# TODO: stop the previous process
$ZEPHYR_BUILD_DIR/zephyr.exe
else
# These boards need special openocd rules
RESET_OPENOCD=false
if [ "$PLATFORM" = "olimex-stm32-e407" ]; then
RESET_OPENOCD=true
OPENOCD_TARGET="stm32f4x.cfg"
if lsusb -d 15BA:002a; then
OPENOCD_PROGRAMMER=interface/ftdi/olimex-arm-usb-tiny-h.cfg
elif lsusb -d 15BA:0003;then
OPENOCD_PROGRAMMER=interface/ftdi/olimex-arm-usb-ocd.cfg
elif lsusb -d 15BA:002b;then
OPENOCD_PROGRAMMER=interface/ftdi/olimex-arm-usb-ocd-h.cfg
else
echo "Error: Unsuported OpenOCD USB programmer"
exit 1
fi
elif [ "$PLATFORM" = "nucleo_f446re" ]; then
RESET_OPENOCD=true
OPENOCD_TARGET="stm32f4x.cfg"
if lsusb -d 0483:374b;then
OPENOCD_PROGRAMMER=interface/stlink-v2-1.cfg
else
echo "Error: Unsupported OpenOCD programmer"
exit 1
fi
elif [ "$PLATFORM" = "nucleo_h743zi" ]; then
RESET_OPENOCD=true
OPENOCD_TARGET="stm32h7x.cfg"
if lsusb -d 0483:374e;then
OPENOCD_PROGRAMMER=interface/stlink.cfg
else
echo "Error: Unsupported OpenOCD programmer"
exit 1
fi
fi
if [ "$RESET_OPENOCD" = true ]; then
openocd -f $OPENOCD_PROGRAMMER -f target/$OPENOCD_TARGET \
-c init \
-c "reset halt" \
-c "reset run; exit"
else
echo "Error: Resetting device is only supported with OpenOCD"
exit 1
fi
fi
popd > /dev/null