{"id":106,"date":"2014-03-25T20:13:08","date_gmt":"2014-03-25T20:13:08","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=106"},"modified":"2015-07-19T08:39:52","modified_gmt":"2015-07-19T15:39:52","slug":"arm-at91sam7","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/at91sam7\/","title":{"rendered":"Developing AT91SAM7 projects with Visual Studio"},"content":{"rendered":"<p>This tutorial shows how to develop and debug a simple firmware project for the AT91SAM7S256 microcontroller using OpenOCD and Visual Studio.<\/p>\n<p>Before proceeding with the tutorial please ensure that <a href=\"\/download\">VisualGDB 4.0<\/a> or later is installed.<\/p>\n<ol>\n<li>Start Visual Studio. Select File-&gt;New-&gt;Project in the menu. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/01-newproj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/01-newproj.png\" alt=\"01-newproj\" width=\"698\" height=\"612\" \/><\/a><\/li>\n<li>\u00a0Select VisualGDB -&gt; Embedded Project Wizard.<br \/>\nSpecify project directory and enter project name.<br \/>\n<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/02-embedded.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/02-embedded.png\" alt=\"02-embedded\" width=\"700\" height=\"356\" \/><\/a><\/li>\n<li>Select &#8220;Embedded binary&#8221;. If you want to program your firmware using a third-party FLASH programming tool, it is recommended to enable the &#8216;create additional .bin file&#8217; option. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/03-newbinary.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/03-newbinary.png\" alt=\"03-newbinary\" width=\"700\" height=\"543\" \/><\/a><\/li>\n<li>Select the &#8220;arm-abi&#8221; toolchain. If it is missing, VisualGDB will automatically download and install it:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/04-newdev.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/04-newdev.png\" alt=\"04-newdev\" width=\"700\" height=\"543\" \/><\/a><\/li>\n<li>If you don&#8217;t see AT91SAM7 devices in the device list, click &#8220;Download Support for more devices&#8221;, find &#8220;AT91SAM7S MCUs&#8221; and click &#8220;Install selected packages&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/05-sam7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/05-sam7.png\" alt=\"05-sam7\" width=\"500\" height=\"300\" \/><\/a><\/li>\n<li>Now select your device from the device list. In this tutorial we will use AT91SAM7S256:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/06-sam7s256.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/06-sam7s256.png\" alt=\"06-sam7s256\" width=\"700\" height=\"543\" \/><\/a><\/li>\n<li>On the next page select a sample to create. The LEDBlink is the simplest one. Alternatively VisualGDB can create projects for some samples provided by Atmel.<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/07-ledblink.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/07-ledblink.png\" alt=\"07-ledblink\" width=\"700\" height=\"543\" \/><\/a><\/li>\n<li>The last page allows selecting the debug method. We will use the <a href=\"http:\/\/gnutoolchains\/arm-eabi\/openocd\"> OpenOCD<\/a> tool to debug the board using the Olimex ARM-USB-OCD-H programmer. If you have not installed it yet, click &#8220;Install support for additional debug methods&#8221;, select &#8220;OpenOCD&#8221; and press OK:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/09-openocd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/09-openocd.png\" alt=\"09-openocd\" width=\"488\" height=\"307\" \/><\/a><\/li>\n<li>On the debug method configuration page press the &#8220;Detect&#8221; button to automatically detect your JTAG programmer or select it from the list:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/10a-olimex.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/10a-olimex.png\" alt=\"10a-olimex\" width=\"702\" height=\"653\" \/><\/a><\/li>\n<li>Connect your JTAG programmer to the board, turn it on and press &#8220;Test selected OpenOCD settings&#8221;. If you don&#8217;t have the FTDI driver installed, VisualGDB will install it for you. The successful test results should look the following way:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/20-test.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/20-test.png\" alt=\"20-test\" width=\"663\" height=\"542\" \/><\/a><\/li>\n<li>If you want to customize the OpenOCD scripts and tweak various settings, you can switch to manual setup mode:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/11a-advanced.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-11\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/11a-advanced.png\" alt=\"11a-advanced\" width=\"702\" height=\"653\" \/><\/a><\/li>\n<li>If you experience driver issues, you can install the FTDI driver manually by clicking on &#8220;Start driver tool&#8221; and finding your device (select interface 0) in it:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/12-drivertool.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/12-drivertool.png\" alt=\"12-drivertool\" width=\"609\" height=\"449\" \/><\/a><\/li>\n<li>Once the debugger connection is tested, close the test window and press &#8220;Finish&#8221; to end the wizard. VisualGDB will generate a Visual Studio project for your device. Build it by pressing Ctrl-Shift-B:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/21-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-13\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/21-build.png\" alt=\"21-build\" width=\"698\" height=\"614\" \/><\/a><\/li>\n<li>Set a breakpoint on the line turning on the LED and press F5 to start debugging:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/22-debug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/22-debug.png\" alt=\"22-debug\" width=\"698\" height=\"614\" \/><\/a><\/li>\n<li>Once the breakpoint is hit, press F10 to do a single step or F5 to run an iteration of the loop until the breakpoint hits again. Observe how the LED turns on and off:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/23-board.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/23-board.png\" alt=\"23-board\" width=\"700\" height=\"312\" \/><\/a><\/li>\n<li>Press Shift-F5 to stop debugging. Right-click on your project in Solution Explorer and select VisualGDB Project Properties:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/24-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-16\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/at91sam7\/24-settings.png\" alt=\"24-settings\" width=\"700\" height=\"614\" \/><\/a>You can use the Project Properties window to change a wide variety of settings related to building and debugging your project.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to develop and debug a simple firmware project for the AT91SAM7S256 microcontroller using OpenOCD and Visual<\/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,54],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/106"}],"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=106"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":194,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/106\/revisions\/194"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}