{"id":5575,"date":"2020-01-20T20:32:03","date_gmt":"2020-01-21T04:32:03","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=5575"},"modified":"2020-01-20T20:32:03","modified_gmt":"2020-01-21T04:32:03","slug":"developing-stm32l5-projects-with-visual-studio-and-visualgdb","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/stm32\/stm32l5\/","title":{"rendered":"Developing STM32L5 Projects with Visual Studio and VisualGDB"},"content":{"rendered":"<p>This tutorial shows how to create a basic project for the STM32L5-Nucleo board with Visual Studio and VisualGDB. We will clone the <strong>FreeRTOS_ThreadCreation<\/strong> sample from the STM32L5 SDK and will show how to debug it and use CodeJumps to explore the structure of the code included in it.<\/p>\n<ol>\n<li>Start Visual Studio and open the VisualGDB Embedded Project Wizard:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/01-newprj-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5576\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/01-newprj-1.png\" alt=\"\" width=\"1024\" height=\"680\" \/><\/a><\/li>\n<li>Pick a name and location for your project and press &#8220;Create&#8221; to proceed:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/02-name.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5577\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/02-name.png\" alt=\"\" width=\"1024\" height=\"680\" \/><\/a><\/li>\n<li>For most new projects we recommend choosing the MSBuild system, as it results in much faster builds compared to GNU Make:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/03-msbuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5578\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/03-msbuild.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Select the ARM toolchain and pick your STM32L5 device from the list. If the device does not appear, make sure you have installed the latest STM32 and OpenOCD packages via Tools-&gt;VisualGDB-&gt;Manage VisualGDB Packages:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/04-device-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5579\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/04-device-1.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>On the next page select &#8220;Show: STM32CubeMX Samples&#8221;. VisualGDB will display the sample projects included in the STM32L5 SDK. Each project is pre-parsed and will build out-of-the-box once you clone it. In this tutorial we will use the <strong>FreeRTOS_ThreadCreation<\/strong> sample:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/05-sample-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5580\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/05-sample-1.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>On the last page of the wizard select the debugger configuration that matches your setup. In most of the cases, VisualGDB can automatically detect the necessary settings and install the required drivers:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/06-stlink-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5581\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/06-stlink-1.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to create the project. Once it is loaded, build it via <strong>Build-&gt;Build Solution<\/strong>:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/07-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5582\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/07-build.png\" alt=\"\" width=\"1275\" height=\"918\" \/><\/a><\/li>\n<li>You can use the Embedded Memory Explorer window to get an overview of FLASH\/RAM utilization, or explore a detailed per-function report:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/08-memexp.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5583\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/08-memexp.png\" alt=\"\" width=\"1275\" height=\"918\" \/><\/a><\/li>\n<li>Set a breakpoint in the <strong>LED_Thread1()<\/strong> function and press F5. VisualGDB will automatically program the FLASH memory of the board and will launch the program on it. Once the breakpoint hits, you will be able to debug the program as usual:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/09-bkpt.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5584\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/09-bkpt.png\" alt=\"\" width=\"1275\" height=\"918\" \/><\/a><\/li>\n<li>You can use the CodeJumps links on top of various functions to explore relations between them. E.g. see how the <strong>osThreadResume()<\/strong> function is called by both <strong>LED_Thread1()<\/strong> and <strong>LED_Thread2()<\/strong>:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/10-jumps.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5585\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/01\/10-jumps.png\" alt=\"\" width=\"1275\" height=\"918\" \/><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to create a basic project for the STM32L5-Nucleo board with Visual Studio and VisualGDB. We will<\/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":[61,194],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5575"}],"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=5575"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5575\/revisions"}],"predecessor-version":[{"id":5586,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/5575\/revisions\/5586"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=5575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=5575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=5575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}