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:

  1. Start Visual Studio, select "File->New->Project". Then select "Visual C++->VisualGDB".Please avoid spaces in directory names, as GDB does not support it.
  2. In VisualGDB wizard select "Firmware for an embedded device" and press "next".

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

  4. 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.

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

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

  7. Once the toolchain has been installed, press the "Next" button on the toolchain selection page.
  8. 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.

  9. 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.

  10. On the debug settings page select "mspdebug Simulator".Press Finish when done.

  11. 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.

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

  13. 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:

  14. The Debug Server window will show the output from mspdebug. If you encounter any problems, refer to it for additional information.

  15. 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.

  16. Now we will debug a real device over JTAG. Right-click on the project in Solution Explorer and select "VisualGDB Project Properties".

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

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