Creating TWR-K60 module projects with Visual Studio

This tutorial shows how to create a basic project for the TWR-K60D100M module based on the MK60DN512VMD10 microcontroller using Visual Studio and VisualGDB.

Before you begin ensure that you have VisualGDB 4.1 or later installed.

  1. Launch Visual Studio. Open the New Project window and select VisualGDB Embedded Project Wizard:01-projectname
  2. In this tutorial we will create a simple stand-alone project. Select “embedded binary” and continue to the next page. 02-binary
  3. On the next page select the arm-eabi toolchain. If you don’t have it installed, VisualGDB will download it for you automatically:03-arm
  4. Click “download support for more devices” and select Freescale Kinetis in the list. VisualGDB will download headers and libraries for Kinetis devices:04-bspdownload
  5. Select MK60DN512xxx10 from the device list. In this tutorial we will create a project that will be placed in the SRAM memory, keeping the FLASH contents unchanged. Select “SRAM” in the list below: 05-device
  6. Click “Next”. VisualGDB will test the toolchain and ensure that it can compile and link binaries for your device:06-test
  7. The next page allows customizing the ‘Blinking LED ‘sample generated by VisualGDB. According to TWR-K60100M schematics, a green LED is connected to PA29:07-led-schSelect “PTA” and “29” as “LED Port group” and “LED Port Number” respectively: 08-led
  8. The module contains the OSBDM/OSJTAG interface that allows debugging the microcontroller without any external hardware. We will use the OpenOCD tool to connect to it. Select OpenOCD as the debug method on the next page. If it’s not available, click “Download support for more debug methods”. Select “OSBDM” as the interface:10-openocd
  9. Click “Test selected OpenOCD settings” to test their validity. VisualGDB will launch OpenOCD and ensure that it can connect to your board:14-test
  10. You can always switch to the manual mode to customize various OpenOCD settings:10a-manual
  11. Press “Finish” to have your project created. Build it by pressing Ctrl-Shift-B:15-build
  12. Press F5 to start debugging your project. Once you see the LED blinking, put a breakpoint on the line that turns on the LED:16-breakpoint
  13. Press F10 to step over the line. See how the LED turns on:17-green-led
  14. You can change between SRAM and FLASH modes and customize many other settings in the VisualGDB Project Properties dialog that can be opened by right-clicking on your project in Solution Explorer and selecting “VisualGDB Project Properties”:18-properties