forked from Oh-My-Mechanical-Keyboard/qmk_port_nrf52840
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flash.sh
23 lines (20 loc) · 836 Bytes
/
flash.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/zsh zsh
if [ ! ${openocd_path} ]; then
echo "command: initialize"
get_openocd && \
fi
erase=''
recover=''
arg=($@)
for var in $arg
do
if [ $var = "erase" ]; then
erase='-c "nrf5 mass_erase"'
echo "command: mass_erase"
elif [ $var = "recover" ]; then
recover='-c "nrf52_recover"'
echo "command: recover"
fi
done
openocd_ -f ${openocd_path}/tcl/interface/cmsis-dap.cfg -f ${openocd_path}/tcl/target/nrf52.cfg -c "adapter speed 4000" -c init ${recover} -c "reset init" -c halt ${erase} -c "program $(find . -name zephyr.hex) verify reset exit"
# openocd_ -f ${openocd_path}/tcl/interface/jlink.cfg -c "transport select swd" -f ${openocd_path}/tcl/target/nrf52.cfg -c "adapter speed 4000" -c init ${recover} -c "reset init" -c halt ${erase} -c "program $(find . -name zephyr.hex) verify reset exit"