blob: b2d6b1744def9c8deb5ee2fa2848bf8d521b946e [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001#! /bin/sh
2
3set -e
4
5# Expect the script to run in argument
6if [ $# != 1 ]; then
7 echo "ERROR: No script provided"
Sandrine Bailleux47ab4f42019-05-10 13:23:41 +02008 echo "usage: $(basename $0) <armds_script_to_run>"
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02009 exit 1
10fi
11
12# Is DS-5 command-line debugger found?
Sandrine Bailleux47ab4f42019-05-10 13:23:41 +020013if [ ! $(which armdbg) ]; then
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020014 echo 'ERROR: Failed to find DS-5 command-line debugger.'
Sandrine Bailleux47ab4f42019-05-10 13:23:41 +020015 echo 'Please add the path to the armdbg program in your PATH.'
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020016 echo 'E.g.: export PATH=<DS-5 install dir>/bin:$PATH'
17 exit 1
18fi
19
20# DS-5 configuration database entry for Juno r0
Sandrine Bailleux47ab4f42019-05-10 13:23:41 +020021juno_cdb_entry='Arm::Juno Arm Development Platform (r0)::Bare Metal Debug::Bare Metal Debug::Debug Cortex-A53_0::DSTREAM'
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020022
23# Browse for available DSTREAM connections and lists targets that match the
24# connection type specified in the configuration database entry
25echo "Trying to detect your DSTREAM unit..."
26connections_list=available_connections
Sandrine Bailleux47ab4f42019-05-10 13:23:41 +020027armdbg --cdb-entry "$juno_cdb_entry" --browse \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020028 | tee $connections_list
29
30# Remove first line in the file (i.e. "Available connections:")
31tail -n +2 $connections_list > ${connections_list}_stripped
32mv ${connections_list}_stripped ${connections_list}
33
34# Use first available connection
35read connection < $connections_list || true
36rm $connections_list
37
38if [ -z "$connection" ] ; then
39 echo "ERROR: Found no connection"
40 exit 1
41fi
42
43# Run DS-5 script
44echo "Connecting to $connection..."
Sandrine Bailleux47ab4f42019-05-10 13:23:41 +020045armdbg \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020046 --cdb-entry "$juno_cdb_entry" \
47 --cdb-entry-param "Connection=$connection" \
48 --stop_on_connect=false \
49 --script=$1