Getting Started with MSP430 GCC tools - compiling example
"leds.c"
---------------------------------------------------------------------------------------------
-------------------------------- Installation
--------------------------------------
Operating system - Windows XP
1. Installation - run:
mspgcc-20061126.exe
// install in default directory (no idea if this is critical or
not)
Hardware setup - MSP430F1232 - LED connected to P1.0
JTAG programmer from Olimex connected to Parallel port
------------------------------------------------------------------------------------
Note: using DOS console under windows
- to Copy text from console to windows program use: "Right Mouse click" ->
Mark
mark text with mouse
press Enter to copy to clipboard
- to Copy text from Windows to console -> "Right Mouse click" -> Paste
------------------------------------------------------------------------------------
---------------- Setup Connection --------------------
2. Open 2 console windows. To avoid any confusion here - set both to local
example directory:
cd \mspgcc\examples\leds
3. In console window 1 paste:
msp430-gdbproxy --debug --port=2000 msp430
// this makes connection to JTAG -> the unit you want to
test must be powered on
--------------- Fixing the provided example ---------
4. Modify Leds Example "main.c" file as follows:
// insert a global initialized variable
#include "hardware.h" // this line exists -> add the next
one
int s = 0; // 's' is a dummy variable ... does not have to
be dummy
// this is needed to fix a bug preventing GDB to run properly (data
section
initialization problem)
P1DIR = 0x01; // optional change -> I have only 1 LED connected to
P1.0
--------------- Compile Code -------------------------
5. Compile and Run Program
5.1 To just compile the program
// In console window 2 type:
make
// uses "makefile" from the mspgcc distibution. Make sure to set you
MSP430
device - in my case:
CPU = msp430x1232
// make sure -g option is specified in CFLAGS
CFLAGS = -mmcu=${CPU} -g -O2 -Wall
5.2 To compile and run program
make download-jtag
// you do not have to start msp430-gdbproxy in order to do that.
Starting
msp430-gdbproxy does not
// prevent you from doing this either. However, if msp430-gdbproxy
is
running, you will have
// to restart it in order to use GDB.
--------------- Debug with MSP430-GDB ----------------
6. Debugging
//gdb.ini does not exist -> create "gdb.ini" containing the following
lines:
set remoteaddresssize 64
set remotetimeout 999999
target remote localhost:2000
monitor erase all
// start the debugger
msp430-gdb leds.elf
// if any error is generated at this point - you have a problem ...
// in the debugger window type:
load leds.elf
c
// c = continue -> starts the program / continue execution
Ctrl-C
// stops the program -> should show current C code execution line
s
// step forward. Just press Enter after the first "s" command)
b 20
// set break point at line number 20 from the sorce file
// type "help breapoints" for more information
clear 20
// deletes break point
help
// obvious function
help xxxxx
// depends on what xxxx is
quit
// answer 'y' and you are done debugging
--------------- Debug with MSP430 Insight Debugger ---------------
7. Download and install
msp430-insight-win32-20021222.exe
// link:
http://prdownloads.sourceforge.net/mspgcc/msp430-insight-win32-20021222.exe?download
// install in default directory ... again - no idea if this is critical.
// From C:\msp430insight\bin -> start:
msp430-gdb.exe
File -> Open -> leds.elf
// ofcourse you must find it first
File-> Target Settings
// Opens Target Selection window
-> Target: Remote/TCP
-> Hostname: localhost
-> Port: 2000
// same as the specified by msp430-gdbproxy
-> More Options
-> Command to issue after attaching: monitor erase all
// default settings for the rest of the parameters are:
Set breakpoint at 'main'
Set breakpoint at 'exit'
//
Attach to Target
Download Program
Continue from Last Stop
// you can start debugging now ...
---------------------------------------------------------------------
--
View this message in context:
http://www.nabble.com/Getting-started-with-MSP430-GCC-GDB-Insight-tf2746720.html#a7663293
Sent from the MSP430 gcc - Users mailing list archive at Nabble.com.