{"id":73,"date":"2014-02-04T17:39:31","date_gmt":"2014-02-04T17:39:31","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=73"},"modified":"2015-07-19T08:54:50","modified_gmt":"2015-07-19T15:54:50","slug":"digi","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/digi\/","title":{"rendered":"Using Visual Studio to debug applications on Digi Connect ME9210"},"content":{"rendered":"<p>This quickstart guide shows how to build and debug a simple application on a Digi Connect module using VisualGDB.<\/p>\n<p>Before you begin, please download and install the following:<\/p>\n<ul>\n<li><a href=\"\/trial\">VisualGDB<\/a><\/li>\n<li>Digi development kit on a Linux virtual machine<\/li>\n<li>Make sure the GPIOs are set up and the GPIO kernel module included<\/li>\n<li>Set up the board to load the root filesystem from the default NFS directory<\/li>\n<\/ul>\n<p>1. First create a sample project in Digi ESP, select File-&gt;New-&gt;Digi EL Application\/Library C Project<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/01-wizard.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/01-wizard.png\" alt=\"01-wizard\" width=\"602\" height=\"540\" \/><br \/>\n<\/a><\/p>\n<p>2. Then select the sample GPIO project and press &#8220;Finish&#8221;.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/02-sample.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/02-sample.png\" alt=\"02-sample\" width=\"602\" height=\"540\" \/><br \/>\n<\/a><\/p>\n<p>3. Next build the project Debug version and ensure that it runs.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/03-built.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/03-built.png\" alt=\"03-built\" width=\"858\" height=\"526\" \/><br \/>\n<\/a><\/p>\n<p>4. Run the debug version.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04a-eclipse.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04a-eclipse.png\" alt=\"04a-eclipse\" width=\"908\" height=\"688\" \/><br \/>\n<\/a><\/p>\n<p>5. Go to Debug Configurations and make the debugger output verbose.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04b-verbose.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04b-verbose.png\" alt=\"04b-verbose\" width=\"802\" height=\"556\" \/><br \/>\n<\/a><\/p>\n<p>6. Run the debug version again and observe the flags Digi ESP uses for gdb. We will need these flags later to manually set up gdb.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04c-console.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04c-console.png\" alt=\"04c-console\" width=\"796\" height=\"331\" \/><br \/>\n<\/a><\/p>\n<p>7. Now we are ready to make a VisualGDB project.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04-wizard.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/04-wizard.png\" alt=\"04-wizard\" width=\"871\" height=\"501\" \/><br \/>\n<\/a><\/p>\n<p>8. Choose a full custom project.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/05-wizard1.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/05-wizard1.png\" alt=\"05-wizard1\" width=\"836\" height=\"648\" \/><br \/>\n<\/a><\/p>\n<p>9. Choose the vm as the build server.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/06-wizard2.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/06-wizard2.png\" alt=\"06-wizard2\" width=\"836\" height=\"649\" \/><br \/>\n<\/a><\/p>\n<p>10. Add copying the files as a build command.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/07-wizard3.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/07-wizard3.png\" alt=\"07-wizard3\" width=\"627\" height=\"300\" \/><br \/>\n<\/a><\/p>\n<p>11. Add a make all build command.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/08-wizard4.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-11\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/08-wizard4.png\" alt=\"08-wizard4\" width=\"627\" height=\"300\" \/><br \/>\n<\/a><\/p>\n<p>12. Add a make all build command.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/09-wizard5.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/09-wizard5.png\" alt=\"09-wizard5\" width=\"627\" height=\"300\" \/><br \/>\n<\/a><\/p>\n<p>13. Add a make clean command.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/10-wizard6.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-13\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/10-wizard6.png\" alt=\"10-wizard6\" width=\"627\" height=\"300\" \/><br \/>\n<\/a><\/p>\n<p>14. The build and clean commands look now like this.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/11-wizard7.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/11-wizard7.png\" alt=\"11-wizard7\" width=\"836\" height=\"648\" \/><br \/>\n<\/a><\/p>\n<p>15. Now we set up path mapping.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/12-wizard8.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/12-wizard8.png\" alt=\"12-wizard8\" width=\"836\" height=\"648\" \/><br \/>\n<\/a><\/p>\n<p>16. We use a script to start the gdbserver on the device and load the gpio kernel module before starting GDB.<\/p>\n<pre>#!\/usr\/bin\/expect\r\nspawn telnet 192.168.0.77\r\nexpect {\/ # }\r\nsend \"modprobe gpio &amp;\\r\"\r\nexpect {\/ # }\r\nsend \"gdbserver 192.168.0.78:8086 \/bin\/GPIOTest &amp;\\r\"\r\nexpect {\/ # }<\/pre>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/13-wizard9.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-16\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/13-wizard9.png\" alt=\"13-wizard9\" width=\"627\" height=\"300\" \/><br \/>\n<\/a><\/p>\n<p>17. We use the arm-linux-gdb provided by Digi.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/14-wizard10.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-17\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/14-wizard10.png\" alt=\"14-wizard10\" width=\"610\" height=\"259\" \/><br \/>\n<\/a><\/p>\n<p>18. We use another script to kill the gdbserver after debugging.<\/p>\n<pre>#!\/usr\/bin\/expect\r\nspawn telnet 192.168.0.77\r\nexpect {\/ # }\r\nsend \"killall gdbserver\\r\"\r\nexpect {\/ # }<\/pre>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/15-wizard11.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/15-wizard11.png\" alt=\"15-wizard11\" width=\"627\" height=\"300\" \/><br \/>\n<\/a><\/p>\n<p>19. We need to specify the flags for gdb.<\/p>\n<pre>target remote 192.168.0.77:8086\r\n-gdb-set architecture armv4\r\n-gdb-set solib-absolute-prefix \/home\/user\/DigiEL-5.2\/<\/pre>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/17-wizard13.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-19\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/17-wizard13.png\" alt=\"17-wizard13\" width=\"600\" height=\"425\" \/><br \/>\n<\/a><\/p>\n<p>20. Now our debugging settings look as follows. Press &#8220;Finish&#8221;.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/16-wizard12.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/16-wizard12.png\" alt=\"16-wizard12\" width=\"836\" height=\"648\" \/><br \/>\n<\/a><\/p>\n<p>21. Let&#8217;s go to Project-&gt;VisualGDB Project Properties and then method of breaking.<\/p>\n<pre>#!\/usr\/bin\/expect\r\nspawn telnet 192.168.0.77\r\nexpect {\/ # }\r\nsend \"killall -s INT GPIOTest\\r\"\r\nexpect {\/ # }<\/pre>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/18-interrupt.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/18-interrupt.png\" alt=\"18-interrupt\" width=\"610\" height=\"259\" \/><br \/>\n<\/a><\/p>\n<p>22. Now everything has been set up and we are ready to debug. Set a breakpoint just inside the main function and go to Debug-&gt;Start Debugging with GDB<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/19-debug.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-22\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/19-debug.png\" alt=\"19-debug\" width=\"826\" height=\"632\" \/><br \/>\n<\/a><\/p>\n<p>23. Set a breakpoint as shown, then press the user button 2 on the development board. Observer how the breakpoint is reached.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/20-debug2.png\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-23\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/20-debug2.png\" alt=\"20-debug2\" width=\"826\" height=\"633\" \/><br \/>\n<\/a><\/p>\n<p>24. Press the button more times, observe how the Led 3 turns on and off.<\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/21-board_on.jpg\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-24\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/21-board_on.jpg\" alt=\"21-board_on\" width=\"3328\" height=\"2651\" \/><br \/>\n<\/a><\/p>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/21-board_off.jpg\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-25\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/digi\/21-board_off.jpg\" alt=\"21-board_off\" width=\"3031\" height=\"2475\" \/><br \/>\n<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This quickstart guide shows how to build and debug a simple application on a Digi Connect module using VisualGDB. Before<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[38,33],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/73"}],"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=73"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/73\/revisions\/207"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}