MSP430 HOWTO - MSP430 Introduction

Getting started with the TI MSP430 using GNU GCC and GNU GDB

How to compile and download code using MSP430-JTAG device!

This introduction shows how to compile and run a simple LED application.

 

TI MSP430 JTAG Programming

Download msp430-gdb from http://mspgcc.sourceforge.net

Use a Makefile, e.g. Makefile of MSP430 led sample code.
Adjust target device in Makefile, here "CPU = msp430x148".

>make (or "make clean all)
msp430-gcc -mmcu=msp430x148 -O2 -Wall -g -c -o main.o main.c
msp430-gcc -mmcu=msp430x148 -o leds.elf main.o
msp430-objcopy -O ihex leds.elf leds.a43
msp430-objdump -dSt leds.elf >leds.lst

Load gdbproxy using first command prompt:
>msp430-gdbproxy.exe --port=3333 msp430

Connect to gdbproxy using a second command prompt:
>msp430-gdb
(gdb) target remote localhost:3333

First option via download-jtag:
>make download-jtag
msp430-jtag -e leds.elf
MSP430 parallel JTAG programmer Version: 2.0
Mass Erase...
Program...
238 bytes programmed.
Reset and release device...


Second option via msp-430 debugger:
> msp430-gdb leds.a43 
(gdb) ta re :3333


(gdb) erase all
Erasing all flash memory
Erasing target flash - all... Erased OK

(gdb) load leds.a43
Loading section .sec1, size 0xce lma 0x4000
Loading section .sec2, size 0x20 lma 0xffe0
Start address 0x4000, load size 238
Transfer rate: 380 bits/sec, 119 bytes/write.

Using option 1, "make download-jtag", resets the device and runs the code automatically.

Using option 2 (debugger) helds the MSP430 in reset state.

Program starts with:
(gdb) continue (or just 'c')

Type ^C (control-C) to interrupt the target processor, i.e. stop device.

 

 

 

[SIPHEC home]