From 6be2dd0b7da6c6cac3fc3deff6ab4b23e0fbcd0c Mon Sep 17 00:00:00 2001 From: AlexanderHD27 Date: Fri, 27 Sep 2024 23:19:39 +0200 Subject: [PATCH] Added Scripts to remotly debug pico --- .../firmware/scripts/remote/flash.exp | 22 +++++++++++++++++++ .../firmware/scripts/remote/flash.sh | 12 ++++++++++ .../firmware/scripts/remote/reset.exp | 13 +++++++++++ .../firmware/scripts/remote/run_openocd.sh | 3 +++ 4 files changed, 50 insertions(+) create mode 100755 motor-control/firmware/scripts/remote/flash.exp create mode 100755 motor-control/firmware/scripts/remote/flash.sh create mode 100755 motor-control/firmware/scripts/remote/reset.exp create mode 100644 motor-control/firmware/scripts/remote/run_openocd.sh diff --git a/motor-control/firmware/scripts/remote/flash.exp b/motor-control/firmware/scripts/remote/flash.exp new file mode 100755 index 0000000..13c4ea3 --- /dev/null +++ b/motor-control/firmware/scripts/remote/flash.exp @@ -0,0 +1,22 @@ +#!/usr/bin/expect + +set timeout 30 + +set input_file [lindex $argv 0] +set host [lindex $argv 1] + +spawn telnet $host 4444 +expect "> " +send "program $input_file verify\n" +expect "** Programming Finished **" + +send "reset halt\n" +expect "> " + +send "rp2040.core1 arp_reset assert 0\n" +expect "> " +send "rp2040.core0 arp_reset assert 0\n" +expect "> " + +send "exit\n" +exit \ No newline at end of file diff --git a/motor-control/firmware/scripts/remote/flash.sh b/motor-control/firmware/scripts/remote/flash.sh new file mode 100755 index 0000000..c059344 --- /dev/null +++ b/motor-control/firmware/scripts/remote/flash.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + + +in_file=$(basename "$1") + +echo "Input file: $1" +echo "Input file (base): $in_file" +echo "Host: $2" + +scp $1 $2:/tmp + +./scripts/remote/flash.exp "/tmp/$in_file" "$2" \ No newline at end of file diff --git a/motor-control/firmware/scripts/remote/reset.exp b/motor-control/firmware/scripts/remote/reset.exp new file mode 100755 index 0000000..e3bfa03 --- /dev/null +++ b/motor-control/firmware/scripts/remote/reset.exp @@ -0,0 +1,13 @@ +#!/usr/bin/expect + +set timeout 30 + +set host [lindex $argv 0] + +spawn telnet $host 4444 + +expect "> " +send "reset\n" +expect "> " +send "exit\n" +exit \ No newline at end of file diff --git a/motor-control/firmware/scripts/remote/run_openocd.sh b/motor-control/firmware/scripts/remote/run_openocd.sh new file mode 100644 index 0000000..6d97123 --- /dev/null +++ b/motor-control/firmware/scripts/remote/run_openocd.sh @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +sudo src/openocd -f interface/cmsis-dap.cfg -c "bindto 0.0.0.0" -c "adapter speed 5000" -f target/rp2040.cfg -s tcl \ No newline at end of file