Correct GDB setup for MSP430

Hi,

I am using msp430-gdbproxy and msp430-gdb to debug code on a msp430f1611 device. I am able to successfully load and run code compiled with debug flags. Setting breakpoints via gdb also works as expected as I am able to inspect registers, stack, etc.

However, if I halt execution using Ctrl-C, the Program Counter (R0) always seems to revert back to the base interrupt vector (0x00004000) and the stack appears to be blank.

I have tried this with both a parallel (MSP-JTAG) and USB (MSP-JTAG-ISO) FET - as I get the same results with both I am assuming it is a configuration or incompatibility issue.

I have included output from a sample GDB session below - a breakpoint is set and hit successfully. The second interrupt is caused by a Ctrl-C press and results in the behaviour described above.

Anyone seen this type of issue before or have any ideas?

$ msp430-gdb main.exe

GNU gdb 6.0

Copyright 2003 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type “show copying” to see the conditions.

There is absolutely no warranty for GDB. Type “show warranty” for details.

This GDB was configured as “–host=i686-pc-cygwin --target=msp430”…

0x0000ffff in ?? ()

(gdb) monitor erase all

Erasing target flash - all… Erased OK

(gdb) load main.exe

Loading section .text, size 0x5800 lma 0x4800

Loading section .data, size 0x14 lma 0xa000

Loading section .vectors, size 0x20 lma 0xffe0

Start address 0x4800, load size 22580

Transfer rate: 25805 bits/sec, 49 bytes/write.

(gdb) break ‘LedsC$Leds$init’

Breakpoint 1 at 0x4e7c: file c:/tinyos-1.x/tos/system/LedsC.nc, line 58.

(gdb) c

Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.

LedsC$Leds$init ()

at c:/tinyos-1.x/tos/system/LedsC.nc

:58

58 async command result_t Leds.init() {

(gdb) info reg

pc/r0: 4e7c sp/r1: 38f6 sr/r2: 0003 r3: 0000

fp/r4: 0000 r5: 0166 r6: 94f5 r7: 0003

r8: 0000 r9: fffc r10: 000f r11: 0000

r12: 0000 r13: 1452 r14: 0030 r15: 1481

(gdb) info stack

#0 LedsC$Leds$init ()

at c:/tinyos-1.x/tos/system/LedsC.nc:58

#1 0x00004e7c in TestI2CMemoryM$Leds$init ()

at c:/tinyos-1.x/tos/interfaces/Leds.nc:56

#2 0x00004e7c in TestI2CMemoryM$Leds$init ()

at c:/tinyos-1.x/tos/interfaces/Leds.nc:56

(gdb) c

Continuing.

Program received signal SIGINT, Interrupt.

0x00004000 in ?? ()

(gdb) info reg

pc/r0: 4000 sp/r1: fffd sr/r2: 0000 r3: 0000

fp/r4: 0000 r5: 0166 r6: 94f5 r7: 0003

r8: 0001 r9: fffc r10: 00a7 r11: 0001

r12: 0000 r13: 14d6 r14: fffd r15: 0000

(gdb) info stack

#0 0x00004000 in ?? ()

(gdb)