Using Visual Studio to develop MSP430 firmware
In this tutorial we will show you how to develop and debug a simple "LED blinking" firmware for TI MSP430 microcontrollers using VisualGDB. We use the EZ430-RF2500 development board to demonstrate the integration with debugging tools; however, you can use any of those tools/programmers supported by the MSP430.DLL provided by TI.
The full list of the MSP430 devices supported by VisualGDB can be found here.
Step-by-step guide
Before you begin, please ensure that you installed the latest version of VisualGDB. Once it's installed, follow the steps below:
- Start Visual Studio, select "File->New->Project". Then
select "Visual C++->VisualGDB".
Please avoid spaces in directory names, as GDB does not support it. -
In VisualGDB wizard select "Firmware for an embedded device" and press "next".

-
As you are creating a default new project, you don't have to change anything on next wizard page.

-
Select "MSP430" from the toolchain list. If the MSP430 toolchain has not been installed before, VisualGDB will download and install it automatically. You can also download it yourself from http://gnutoolchains.com/msp430.

-
VisualGDB will show the toolchain versions available for download. Please select the latest one.

-
Select the installation directory and press "Install" to start toolchain installation.

- Once the toolchain has been installed, press the "Next"
button on the toolchain selection page.
-
Select the MCU type that you want to target. The EZ430-RF2500 kit has the msp430f2274 MCU. The LaunchPad board comes with msp430g2553. You can use the "Filter" textbox to simplify finding the right MCU.

-
On the next page enter the location of the LED. The EZ430-RF2500 and LaunchPad have a LED connected to P1.0, so the default settings will work.

-
On the debug settings page select "mspdebug Simulator".
Press
Finish when done. -
Congratulations! You have created a Visual Studio project for a simple MSP430 firmware. Press Ctrl+Shift+B or select Build->Build Solution to build the project.

-
To start debugging, put a breakpoint on the line assigning P1OUT and start the debug session via Debug->Start debugging with GDB command:

-
When the breakpoint is hit you can use the normal Visual Studio techniques to debug your program. Hover the mouse over the P1OUT register. Visual Studio will show the value:

-
The Debug Server window will show the output from mspdebug. If you encounter any problems, refer to it for additional information.
-
You can step through your program, modify variable values, change next statement, just like you are debugging a Windows application. When done, press Shift+F5 to stop debugging.
-
Now we will debug a real device over JTAG. Right-click on the project in Solution Explorer and select "VisualGDB Project Properties".

-
Change the debug method to JTAG (gdbproxy++) and accept default settings:

-
You can start debugging your firmware over JTAG by selecting Debug->Start debugging with GDB. The FLASH memory will be programmed automatically.
| Follow @sysprogs Tweet |
