Skip to content

Micro GDB server for panStamp NRG 1.0

Daniel Berenguer edited this page Dec 3, 2015 · 1 revision

Introduction

[http://kimballsoftware.com/](Rick Kimball) kindly ported his compact GDB server for MSP430 to the NRG platform some time ago. This GDB server is mainly acting as the serial bootloader for panStamp NRG but it also provides some other GDB instructions. Apart from its bootloading capabilities, this GDB server can be used to inspect memory regions without the need of any external programmer/debugger.

GDB step by step

First of all, we need to put the board in programming mode, according to this guide. Once your serial converted is connected to the target board and Pin 12 tied to ground, restart the board. At this moment panStamp NRG will enter in programming mode. We can then open a terminal and run msp430-gdb. If you didn't previously install msp430-gdb in your computer you can run it from arduino/hardware/tools/msp430/bin/.

msp430-gdb -b 38400 -ex 'set debug remote 0' -ex 'target remote your_serial_port'

Once GDB starts you will see something like this:

GNU gdb (GDB) 7.2
Copyright (C) 2010 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=x86_64-unknown-linux-gnu --target=msp430".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Remote debugging using /dev/ttyUSB0
0x00008000 in ?? ()
(gdb)

OK you are now "into" the MCU so you can query the value contained at any address with "x":

(gdb) x 0x1800
0x1800:    0xffffffff

Here we queried about the contents of address 0x1800, which is the start of the Info D region, one of four "pseudo EEPROM" spaces provided by the CC430 MCU. This page shows how the memory of the CC430F5137 MCU is organized.

On the other hand, we can also list the contents of a group of addresses. Below /10h means that we want 10 values, starting from 0x1800 to be displayed in 16-bit format:

(gdb) x /10h 0x1800
0x1800:    0xffff    0xffff    0xffff    0xffff    0xffff    0xffff    0xffff    0xffff
0x1810:    0xffff    0xffff

All the above 0xffff's mean that those memory locations remain erased. since we are working with Flash and not with EEPROM, before writing a single byte we need to erase the whole section. Don't worry too much about this since the panStamp library already does this for you.

OK now let's say that we want to write 0x1234 into a specific location with address 0x1885 (Info C memory space) which has previously been erased so that the current value is 0xFFFF:

(gdb) set {short}0x1885 = 0x1234

Anti Swap

API for Anti Swap

Clone this wiki locally