Hi All,
gdb-proxy can be confusing and tedious to use, especially for a first timer.
Things such as having to remember to manually delete flash "before" doing a
download, etc.
Ive created a couple of scripts that make life a whole heck of a lot easier.
The first script launched gdb-proxy, then gdb/insight.
When gdb/insight exits, it automatically kills gdb-proxy.
The second and thirs I use for my projects, the "debug" shell script launches
gdb-proxy and gdb/insight via the other script, but tells it the file to debug
and forces it to execute a gdb script at startup.
the "debug.script" is a gdb script, the attached one is generic, but I usually
customise it per project. Adding things like macros to dump on-chip registers
symbolically, etc. The main thing it has in it are the pre-setup option to tell
gdb how to best talk to gdb-proxy. The other thing it has are pre and post
hooks on load. The pre hook resets the cpu, and erases the main flash. (If you
also want it to erase the info flash, just change "main" to "all") after the
pre-hook has executed, the load takes place. the post-hook then does a
cpu-reset to ensure the cpu is in a starting state, after the download has been
completed.
What this means is that from the insight interface, the user no longer has to
worry about deleting flash before downloading. You just select load, and the
script will automatically handle the peculiarities of msp430's.
Also, dont forget, you must have ppdev loaded for any of this to work. Just
because it isn't dont be fooled into thinking your kernel doesn;t have it. Log
on as root and type
insmod ppdev
then change the permissions of /dev/parport0 /dev/parport/0 to be ugo+rwx
Steven
export LD_LIBRARY_PATH=/opt/msp430-tools/bin:$LD_LIBRARY_PATH
/opt/msp430-tools/bin/msp430-gdbproxy msp430 &
/opt/msp430-tools/bin/msp430-gdb $*
kill -9 $!
/opt/msp430-tools/bin/msp430-run-gdb --command=debug.script bin/MyProgram
##########################################################
#
# The reason for performing set $reg=0x000 followed by
# set $reg=desired_value is because of GDBs forced register
# caching. It is a workaround for GDB.
#
##########################################################
define WRITE_LONG
set {unsigned int}$arg0=$arg1
end
define WRITE_WORD
set {unsigned short}$arg0=$arg1
end
define WRITE_BYTE
set {unsigned char}$arg0=$arg1
end
define READ_BYTE
set $arg0={unsigned char}$arg1
end
define READ_WORD
set $arg0={unsigned short}$arg1
end
define READ_LONG
set $arg0={unsigned int}$arg1
end
define MSP430_CONNECT
# stop GDB from pausing it's output, and waiting for enter.
set height 0
# Handle all Signals from Target, Stop and never pass a signal to the target.
handle all stop nopass
# Sets the maximum size of the address (in bits) in a memory packet
# dont know why the recomendatin is 64.
# I would have thought 16 would be more appropriate?
set remoteaddresssize 16
# Set timeout limit waiting for a target to respond
set remotetimeout 999999
# If not using insight, the following will automatically connect
# Insight doesn't like it very much so use at your own risk
# if using insight.
# You will need to change this if gdb-proxy is at another ip address or port.
# target remote localhost:2000
end
define MSP430_TARGET_RESET
# Send a command to BMD Server to Perform a Hard Reset of the Target. (Even
the comment gets sent to the target).
monitor reset
# Flush the cache here. We have reset the target, what GDB thinks is true is
bogus.
flushregs
end
define s
stepi
x/4i $pc
end
define hook-load
# Initialise the target so it is downloadable.
MSP430_TARGET_RESET
# Erase all of the main flash space
# (it would be nice if the gdb-proxy) did this automatically.
# depending on what was being downloaded.
monitor erase main
# set the packet size of download memory chunks.
# for efficiency, set to the size of a flash page (512 bytes)
set download-write-size 512
end
define hookpost-load
MSP430_TARGET_RESET
end
##########################################################################
# DEBUGGER STARTUP INITIALISATION BEGINS HERE.
##########################################################################
MPC860_CONNECT
#MPC860_TARGET_RESET
#PVR_TEST