Developing firmware for MSP432 devices with Visual Studio

This tutorial shows how to create a basic “Blinking LED” program for the MSP432 LaunchPad evaluation board. Before you begin, please install VisualGDB 5.0 or later and update your OpenOCD package to the latest version using the Embedded Tools Manager.

  1. Start Visual Studio and open the VisualGDB Embedded Project Wizard:01-newprj
  2. Proceed with the default choice of creating a new binary:02-bin
  3. On the next page select the ARM toolchain and click “Download support for more devices”. Then select the MSP432 package from the list:03-msp432
  4. Once VisualGDB downloads and installs the MSP432 package, select your device from the list and press “Next”:04-device
  5. According to the MSP432 LaunchPad schematics, a red LED is connected to port PIO1.0 which is the default choice when creating a VisualGDB project. If you want to use a different port, you can change it here:05-blink
  6. If you have connected your MSP432 LaunchPad via USB and are using the latest OpenOCD package, VisualGDB will automatically detect and select the corresponding programming interface. You can also click “Detect” to detect it automatically or simply choose it from the list:06-dap
  7. Press “Test OpenOCD settings” to verify that the SWD connection to the board works:07-test
  8. Press Finish to complete creating your project. Then build it with Ctrl-Shift-B:08-build
  9. Press F5 to start debugging and observe the red LED on the MSP432 LaunchPad board:board
  10. Set a breakpoint on the call to GPIO_toggleOutputOnPin() and wait until it is hit: 09-breakpoint
  11. You can debug your code just like any other Visual Studio project. If you are using the Clang IntelliSense, you can also use the Code Map to explore the relations between various functions and variables in your code:10-codemap
  12. As the CMSIS-DAP on the MSP432 LaunchPad board is very slow compared to other debuggers, we recommend using an external SWD debugger instead of it. In this example we will connect Segger J-Link to the external debugging port and switch the JTAG Switch to the Ext-Debug position:segger
  13. Then go to VisualGDB Project Properties and select the external debugger type in OpenOCD settings. Select the SWD interface explicitly and lower the speed to 1000 KHz, as the default setting of 3000KHz results in unstable behavior:11-seggerDo not forget to test the OpenOCD settings from this dialog. OpenOCD requires the WinUSB driver for Segger J-Link and won’t work with the default driver. Testing the settings will install the required driver automatically.
  14. Now you should experience much faster debugging experience than with the on-board CMSIS DAP. You can always use the Timing Mode in the GDB Session window to see how much time was spent running each individual command and compare the timings of various different settings:12-load