{"id":2064,"date":"2016-10-14T17:41:17","date_gmt":"2016-10-15T00:41:17","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=2064"},"modified":"2016-10-14T17:43:51","modified_gmt":"2016-10-15T00:43:51","slug":"developing-projects-for-atmel-arm-cortex-devices-with-visual-studio","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/samd21\/","title":{"rendered":"Developing projects for Atmel ARM Cortex devices with Visual Studio"},"content":{"rendered":"<p>This tutorial shows how to create a basic &#8220;Blinking LED&#8221; project for the Atmel SAMD21-Xplained-Pro board. If you are using a different Atmel board with an ARM Cortex-based MCU, simply choose a different MCU name and\u00a0 specify where your LED is connected. You can find the full listing of supported Atmel devices here: <a href=\"http:\/\/visualgdb.com\/hwsupport\/\">http:\/\/visualgdb.com\/hwsupport\/<\/a><\/p>\n<p>Before you begin, install Visual Studio and VisualGDB 5.1 or later.<\/p>\n<ol>\n<li>Start Visual Studio and launch the VisualGDB Embedded Project Wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/01-newprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2065\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/01-newprj.png\" alt=\"01-newprj\" width=\"941\" height=\"653\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/01-newprj.png 941w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/01-newprj-300x208.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/01-newprj-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/01-newprj-130x90.png 130w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><\/a><\/li>\n<li>Proceed with the default settings on the first page of the wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/02-msbuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2066\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/02-msbuild.png\" alt=\"02-msbuild\" width=\"738\" height=\"565\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/02-msbuild.png 738w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/02-msbuild-300x230.png 300w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/a><\/li>\n<li>On the next page select the ARM toolchain and select your Atmel device. VisualGDB will automatically download the latest Atmel BSP with all the necessary files:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/03-device.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2067\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/03-device.png\" alt=\"03-device\" width=\"738\" height=\"565\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/03-device.png 738w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/03-device-300x230.png 300w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/a><\/li>\n<li>On the Sample Selection page choose the GPIO port where your LED is connected. On the Amel SAMD21-xplained-pro the orange LED is connected to port PB30:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/04-sample.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2068\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/04-sample.png\" alt=\"04-sample\" width=\"738\" height=\"565\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/04-sample.png 738w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/04-sample-300x230.png 300w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/a>The checkboxes below the LED parameters allow automatically including various libraries provided by Atmel into your project. Note that not all libraries are compatible with all devices.<\/li>\n<li>Finally select the OpenOCD debug method. Plug in your board and press &#8220;Detect&#8221;. VisualGDB will automatically detect the necessary settings:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/05-cmsisdap.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2069\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/05-cmsisdap.png\" alt=\"05-cmsisdap\" width=\"738\" height=\"565\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/05-cmsisdap.png 738w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/05-cmsisdap-300x230.png 300w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/a>If the device does not get auto-detected, update your OpenOCD package via Tools-&gt;Embedded Tools Manager.<\/li>\n<li>Press &#8220;Finish&#8221; to generate the project. Build it with Ctrl-Shift-B:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/06-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2070\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/06-build.png\" alt=\"06-build\" width=\"924\" height=\"646\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/06-build.png 924w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/06-build-300x210.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/06-build-130x90.png 130w\" sizes=\"(max-width: 924px) 100vw, 924px\" \/><\/a><\/li>\n<li>Press F5 to start debugging. Note how the orange LED on the board begins to blink:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/board1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2073\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/board1.jpg\" alt=\"board\" width=\"700\" height=\"455\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/board1.jpg 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/board1-300x195.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>Now we will try out the Live Variables feature to see what is happening in the program without stopping it. Modify the loop inside main() to modify a global variable declared as follows:\n<pre class=\"\">int g_Counter;<\/pre>\n<p>Then start debugging and add g_Counter to the Live Variables window. Enable plotting to see how the variable is incremeneted with each step:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/07-counter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2071\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/07-counter.png\" alt=\"07-counter\" width=\"924\" height=\"646\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/07-counter.png 924w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/07-counter-300x210.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/07-counter-130x90.png 130w\" sizes=\"(max-width: 924px) 100vw, 924px\" \/><\/a><\/li>\n<li>You can set a breakpoint in your code to stop the program and check its state. Note how VisualGDB automatically expands the values of preprocessor macros based on the current location:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/08-step.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2072\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/08-step.png\" alt=\"08-step\" width=\"924\" height=\"646\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/08-step.png 924w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/08-step-300x210.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/08-step-130x90.png 130w\" sizes=\"(max-width: 924px) 100vw, 924px\" \/><\/a><\/li>\n<li>You can include other Atmel frameworks (e.g. drivers for various peripherals) into your project by opening the VisualGDB Project Properties dialog and enabling them on the Embedded Frameworks page:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/frameworks.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2074\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/frameworks.png\" alt=\"frameworks\" width=\"813\" height=\"621\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/frameworks.png 813w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/10\/frameworks-300x229.png 300w\" sizes=\"(max-width: 813px) 100vw, 813px\" \/><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to create a basic &#8220;Blinking LED&#8221; project for the Atmel SAMD21-Xplained-Pro board. If you are using<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[53,132,59],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/2064"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=2064"}],"version-history":[{"count":3,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/2064\/revisions"}],"predecessor-version":[{"id":2077,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/2064\/revisions\/2077"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=2064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=2064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=2064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}