Developing TMS570 Projects with Visual Studio

This tutorial shows how to create, build and debug a basic project for the TMS570LS1224 microcontroller using Visual Studio and VisualGDB. Before you begin, follow this tutorial to generate an SDK using TI HALCoGen and convert it into VisualGDB and install the latest ARM toolchain and the OpenOCD package.

WARNING: The TMS570LS1224 device shown in this tutorial is a Big-Endian device and requires an ARM toolchain with prebuilt Big Endian libraries. As of July 2020, the only toolchain build compatible with TMS570LS1224 is gcc-9.3.1-r2.

  1. Start Visual Studio and locate the VisualGDB Embedded Project Wizard:
  2. Pick the name and location of your project:
  3. Press “Create” to launch the VisualGDB-specific part of the wizard. Proceed with¬† the default “New -> Embedded Binary -> MSBuild” settings:
  4. On the next page select the TMS570LS1224PGE device. If it doesn’t appear, make sure you have generated an SDK with HALCoGen and imported it into VisualGDB per this tutorial:
  5. On the next page select a sample project you would like to use. In this tutorial we will demonstrate the FreeRTOS-based sample, so select it from the list. You can specify the port/pin of any on-board LED at the bottom of the page, or simply proceed with the default settings:
  6. Connect your board to the USB port. VisualGDB will automatically detect the XDS110 interface on the LAUNCHXL2-TMS57012 board and will locate the OpenOCD device script. Make sure you explicitly select the JTAG interface:
  7. Press the Test button to verify the debugger connection:
  8. Press “Finish” to generate the project. Build it by pressing Ctrl-Shift-B:
  9. OpenOCD does not support programming the TMS570 FLASH memory, so we will need to use the TI FLASH memory programming tool instead. Locate the DSLite executable in the CodeComposer directory and run it with the following arguments:

    A config file is automatically created by CodeComposer together with a new project. See the last steps of this tutorial for details.
  10. Once the memory is programmed, the on-board LED will begin blinking:
  11. Now we will show how to debug the board. Go to Visual Studio and press F5 to begin debugging. VisualGDB may warn that the stack location is not writable:
  12. This happens because the _estack symbol generated by HALCoGen does not point to the actual end of stack. To fix this, locate the linker script in the BSP directory:
  13. Then edit the _estack symbol to point at the end of the CPU_STACK region: 
  14. To make sure you can set breakpoints in the FLASH memory and debug the program from the very beginning, add the following lines to the Startup GDB Commands field in Debug Settings:

    The first command forces all breakpoints to be hardware breakpoints, and the second one forcibly jumps to the reset vector at the beginning of the debug session:
  15. Now you will be able to debug the program as usual:
  16. You can automate FLASH memory programming with DSLite by adding it as a custom pre-debug action:
  17. VisualGDB will then automatically launch it before the debug session. You can find the output from it in View->Output->VisualGDB Launcher Output: