{"id":4357,"date":"2018-11-09T15:25:12","date_gmt":"2018-11-09T23:25:12","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=4357"},"modified":"2020-05-20T10:37:18","modified_gmt":"2020-05-20T17:37:18","slug":"creating-advanced-mbed-projects-with-visualgdb","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/mbed\/mbed-cli\/","title":{"rendered":"Creating Advanced Mbed Projects with VisualGDB"},"content":{"rendered":"<p>This tutorial shows how to use the Advanced Mbed Project Subsystem to\u00a0develop mbed-based projects using the latest\u00a0version of mbed without converting them to Visual C++ projects. Before you begin, install VisualGDB 5.4 or later.<\/p>\n<ol>\n<li>Start Visual Studio and open the Advanced Mbed\u00a0Project Wizard:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/01-newprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4358\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/01-newprj.png\" alt=\"01-newprj\" width=\"866\" height=\"595\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/01-newprj.png 866w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/01-newprj-300x206.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/01-newprj-130x90.png 130w\" sizes=\"(max-width: 866px) 100vw, 866px\" \/><\/a><\/li>\n<li>Select &#8220;Create a new &#8216;Blinking LED&#8217; project&#8221;.\u00a0Mbed projects are built using the Python-based mbed-cli tools. If your system does not have a\u00a0Python\u00a0environment, or the environment doesn&#8217;t have the mbed-cli tools installed, VisualGDB\u00a0can automatically download the necessary tools for you (we recommend using Python 3.x):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/python.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6147\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/python.png\" alt=\"\" width=\"856\" height=\"693\" \/><\/a>If VisualGDB prompts for the location of the Git binary, please download and install one from <a href=\"https:\/\/git-scm.com\/download\/win\">the official Git distribution<\/a>.<\/li>\n<li>Once all tools have been installed, click &#8220;Next&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/03-next.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4360\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/03-next.png\" alt=\"03-next\" width=\"910\" height=\"693\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/03-next.png 910w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/03-next-300x228.png 300w\" sizes=\"(max-width: 910px) 100vw, 910px\" \/><\/a>VisualGDB will clone the <a href=\"https:\/\/github.com\/ARMmbed\/mbed-os-example-blinky\">blinky example<\/a> from github using the mbed tools. As each mbed project must include a copy of the mbed framework itself, checking it out may take a few minutes.<\/li>\n<li>Mbed projects require the GNU ARM toolchain maintained by ARM itself. Install the <a href=\"https:\/\/developer.arm.com\/open-source\/gnu-toolchain\/gnu-rm\/downloads\">latest version of the toolchain<\/a> and select it\u00a0on the Toolchain page. Then pick your mbed target from the list:<br \/>\n<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/04-board.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4361\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/04-board.png\" alt=\"04-board\" width=\"910\" height=\"693\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/04-board.png 910w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/04-board-300x228.png 300w\" sizes=\"(max-width: 910px) 100vw, 910px\" \/><\/a>If the mbed tools report Python-related errors, please try resetting your Python environment as shown on <a href=\"https:\/\/visualgdb.com\/support\/mbedpython\/\">this page<\/a>.<\/li>\n<li>Connect your board to\u00a0your computer via USB and let VisualGDB automatically detect the settings. If\u00a0the device name cannot be automatically detected from the board name, simply select it in the &#8220;Debugged device&#8221; field manually:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/05-debug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4362\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/05-debug.png\" alt=\"05-debug\" width=\"856\" height=\"693\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/05-debug.png 856w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/05-debug-300x243.png 300w\" sizes=\"(max-width: 856px) 100vw, 856px\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to create the project.\u00a0VisualGDB will query the detailed project structure from the mbed-cli tools and will show it in\u00a0Solution Explorer. Unlike the regular mbed projects that\u00a0reuse the VC++ project subsystem to build the project, the advanced mbed projects are built directly using the mbed tools and any changes you make in\u00a0Solution Explorer will be\u00a0automatically be recognized by\u00a0those tools. Build the project by pressing Ctrl-Shift-B:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/06-built.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4363\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/06-built.png\" alt=\"06-built\" width=\"1209\" height=\"769\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/06-built.png 1209w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/06-built-300x191.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/06-built-1024x651.png 1024w\" sizes=\"(max-width: 1209px) 100vw, 1209px\" \/><\/a><\/li>\n<li>Set a breakpoint in main() and start debugging the project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/07-debug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4364\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/07-debug.png\" alt=\"07-debug\" width=\"1209\" height=\"769\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/07-debug.png 1209w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/07-debug-300x191.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/07-debug-1024x651.png 1024w\" sizes=\"(max-width: 1209px) 100vw, 1209px\" \/><\/a><\/li>\n<li>Right-click on the project in Solution Explorer and select &#8220;VisualGDB Project Properties&#8221;. You can use the Mbed Project page to\u00a0change the toolchain, configure source directories and preprocessor macros, or to edit the advanced mbed configuration variables:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/08-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4365\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/08-settings.png\" alt=\"08-settings\" width=\"1049\" height=\"632\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/08-settings.png 1049w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/08-settings-300x181.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2018\/11\/08-settings-1024x617.png 1024w\" sizes=\"(max-width: 1049px) 100vw, 1049px\" \/><\/a>VisualGDB will automatically create or edit the mbed configuration files for you and the mbed build tools will pick up the changes even if you build the project outside VisualGDB<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to use the Advanced Mbed Project Subsystem to\u00a0develop mbed-based projects using the latest\u00a0version of mbed without<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[53,115],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/4357"}],"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=4357"}],"version-history":[{"count":4,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/4357\/revisions"}],"predecessor-version":[{"id":6148,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/4357\/revisions\/6148"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=4357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=4357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=4357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}