Skip to content
samthetechie edited this page Sep 13, 2010 · 10 revisions

Can we use msp430-gdbproxy with the MSP430F2417TPN? Yes we Can!!!!

Here is the sourceforge entry:

http://sourceforge.net/project/showfiles.php?group_id=42303&package_id=211507

Howto connect to MSP430 MCU with msp430-gdbproxy

1) First of all open notepad++ and make a file called .gdbinit
with the following contents:

set remoteaddresssize 64

set remotetimeout 999999

target remote localhost:3333

2) Save this file in the working source code directory where your source code and elf file is located.

3) We need to start the gdb proxy that creates a local port for gdb to connect to and handles the communication with the target hardware.

Run this in a second window, because it outputs debugging info to stdout while it is running (i.e. it prints it to the terminal screen):

$ msp430-gdbproxy —debug —port=3333 msp430 TIUSB

Remote proxy for GDB, v0.7.1, Copyright © 1999 Quality Quorum Inc.

MSP430 adaption Copyright © 2002 Chris Liechti and Steve Underwood

GDBproxy comes with ABSOLUTELY NO WARRANTY; for details

use `—warranty’ option. This is Open Source software. You are

welcome to redistribute it under certain conditions. Use the

‘—copying’ option for details.

debug: msp430: msp430_open()

debug: MSP430_Initialize()

debug: MSP430_Configure()

debug: MSP430_VCC(3000)

debug: MSP430_Identify()

info: msp430: Target device is a ‘MSP430F2418’ (type 70)

debug: MSP430_Configure()

notice: msp430-gdbproxy.exe: waiting on TCP port 3333

4) Once this is running (waiting for further instructions from the other terminal) open another terminal and use the change directory
command:

cd

to get to your working directory (where your .elf file is).

5) From this directory we can start debugging by using the msp430-gdb program and our latest firmware build:

msp430-gdb firmware.elf

where ‘firmware.elf’ is just the name of the target that you specified in your Makefile:

TARGET = firmware.elf

6) Having issued this command you will see the following in the terminal:

$ msp430-gdb firmware.elf

GNU gdb 6.8

Copyright © 2008 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. Type “show copying”

and “show warranty” for details.

This GDB was configured as “—host=i686-pc-mingw32 —target=msp430”…

0×00003100 in _reset_vector__ ()

(gdb)

7) Run until main() (i.e. set a breakpoint at main() ) by entering:

(gdb) break main

8) Then tell the program to continue the execution of the firmware on the device (which it will do until it reaches the breakpoint you set).

(gdb) c

9) Debug as you normally would. Here is an example session of me stepping through my wireless sensor network node firmware(also
using the MSP430):

$ msp430-gdb firmware.elf

GNU gdb 6.8

Copyright © 2008 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. Type “show copying”

and “show warranty” for details.

This GDB was configured as “—host=i686-pc-mingw32 —target=msp430”…

0×00003100 in _reset_vector__ ()

(gdb) break main

Breakpoint 1 at 0×313c: file main.c, line 18.

(gdb) c

Continuing.

Breakpoint 1, main () at main.c:18

18 boardInit();

(gdb) n

boardInit () at board.c:42

42 WDTCTL = WDTPW + WDTHOLD; // Stop WDT to prevent timeout reset

(gdb) n

53 P1SEL = 0×00; // All digital signal i/o: [0000|0000] = 0×00

(gdb) n

54 P1DIR = 0xF9; // Set P1.1 and 1.2 as input, others as output [1111|1001] = 0xF9

(gdb) n

56 P1IE = 0×06; //Enable interrupt for P1.1 and P1.2 [0000|0110] = 0×06

(gdb) n

57 P1IES = 0×06; //Edge Select is H2L [\] [0000|0110] = 0x

06

(gdb) n

69 P2SEL = 0×00; // All digital signal i/o: [0000|0000] = 0×00

(gdb) n

70 P2DIR = 0xFF; //All output: [1111|1111] = 0xFF

(gdb) n

85 P3SEL = 0×30; // P3.4 is USCI_A0TXD, P3.5 is USCI_A0RXD the rest are digital i/o: [0011|0000] = 0×30

(gdb) n

86 P3DIR = 0×02; // Specify P3.1 only as an output the rest are inputs [0000|0010] = 0×02

(gdb) n

99 P4SEL = 0×00; //This sets the pin to I/O Function

(gdb) n

100 P4DIR = 0xFF; // All P4.x outputs

(gdb) n

112 P5SEL = 0×0E; // 5.0, 5.1, 5.2 and 5.3 are SPI (Primary Function) the rest are digital signal i/o: [0000|1110] = 0×0F

(gdb) n

113 P5DIR = 0xFB; // Set 5.0, 5.1, 5.3 to Outputs (1). Set 5.2 to Input (0): [1111|1011] = 0xFB

(gdb) print WDTCTL

$1 = 27008

(gdb) print P2SEL

$2 = 0 ‘\0’

(gdb) print P2DIR

$3 = 255 ‘ ’

(gdb) print P5SEL

$4 = 14 ‘\016’

(gdb) print P5DIR

$5 = 0 ‘\0’

(gdb) n

125 P6SEL = 0×00; //This sets the pin to I/O Function

(gdb) print P6DIR

$6 = 0 ‘\0’

(gdb) n

126 P6DIR = 0xFF; // All P6.x outputs

(gdb) print P6DIR

$7 = 0 ‘\0’

(gdb) n

128 S_INT_CLEAR;

(gdb) print P6DIR

$8 = 255 ‘ ’

(gdb)

10) As you can see from the code, we can ‘break’ i.e. stop the code at any convenient point- this can be used to skip to where we want to
have a closer look more quickly (better that single stepping through 1000 lines of code!) with ‘break function_name’ for example.

11) We can print out the value held by any of the variables that are in scope at that point of execution (very useful!) with ‘print variable_name’

12) And we can step the execution line by line with ‘n’

13) What’s happening here is that the proxy is communicating with the JTAG adapter and opening up port 3333 to accept connections from
the gdb debugger. The debugger needs to know where to connect to, hence the creation of the .gdbinit file with the port number and timeout
in it. When you run msp430-gdb, it is making a TCP/IP connection to the JTAG proxy program, which is in turn communicating with the
target hardware if all is going well.

Clone this wiki locally