Attaching a debugger to mspdebug

The cool thing we get with the msp430 and the Launchpad is on chip debugging. This goes a long way to pave over the warts of writing straight C for the 430. We will load up the blink program from last time, run it with the debugger and pause execution.

Start up mspdebug as before, this time we pass a command for mspdebug to run directly. The "gdb" command will cause mspdebug to listen on port 2000, gdb can then connect and control the debugger.

$ mspdebug rf2500 "gdb"

Next we are going to start up msp430-gdb, load the program from before and start it running.

$ msp430-gdb
(gdb) target remote localhost:2000
(gdb) file led.elf
(gdb) load led.elf
(gdb) continue
^C
(gdb) break main.c:14
(gdb) c                 #We can shorthand commands
Now between each continue we will see the LED's toggle, red then green.
(gdb) continue

From gdb we can send mspdebug directly with the monitor command.