{"id":7136,"date":"2021-03-08T20:42:51","date_gmt":"2021-03-09T04:42:51","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=7136"},"modified":"2021-03-08T20:42:51","modified_gmt":"2021-03-09T04:42:51","slug":"developing-xilinx-vitis-projects-with-visualgdb","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/xilinx\/vitis\/","title":{"rendered":"Developing Xilinx Vitis Projects with VisualGDB"},"content":{"rendered":"<p>This tutorial shows how to use VisualGDB to build, edit and debug projects based on the Xilinx Vitis platform. We will demonstrate how to import a basic Vitis workspace into VisualGDB, use the VisualGDB functionality to build and analyze the code, and also how to debug the project from Visual Studio.<\/p>\n<p>Before you begin, install VisualGDB 5.6 or later.<\/p>\n<ol>\n<li>Start Visual Studio and open the VisualGDB Xilinx Project Wizard:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/01-newprj-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7198\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/01-newprj-1.png\" alt=\"\" width=\"1024\" height=\"680\" \/><\/a><\/li>\n<li>Enter your project name and location, then click &#8220;Create&#8221; to launch the VisualGDB-specific part of the wizard:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/01\/02-prjname.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7137\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/01\/02-prjname.png\" alt=\"\" width=\"1024\" height=\"680\" \/><\/a><\/li>\n<li>The first page of the New Xilinx Project Wizard allows choosing between creating a new project and opening an existing Xilinx Vitis workspace. In this tutorial we will create a new project from scratch, so make sure the <strong>Xilinx Vitis directory<\/strong> is set correctly at the bottom of the page, and then select &#8220;Create a new Xilinx Vitis workspace&#8221;. If you are targeting one of the Xilinx evaluation boards, simply choose the corresponding hardware specification file from the list. Otherwise, point VisualGDB to the XSA file for your board exported from Vivado:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/03-zcu106.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7199\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/03-zcu106.png\" alt=\"\" width=\"856\" height=\"699\" \/><\/a><\/li>\n<li>The next page of the wizard allow customizing the initial domain that will be created for your application. A domain is a combination of an operating systems and drivers, that run on a specific CPU inside the Xilinx FPGA. In this tutorial, we proceed with the FreeRTOS OS running on the default processor:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/04-freertos.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7200\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/04-freertos.png\" alt=\"\" width=\"856\" height=\"699\" \/><\/a><\/li>\n<li>The &#8220;New App&#8221; page allows selecting a specific application template that will be used to create the first application. VisualGDB will automatically query the Xilinx Vitis tools for a list of applications compatible with the current hardware specification and OS. Choose &#8220;FreeRTOS lwIP Echo Server&#8221; and press &#8220;Next&#8221; to continue:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/05-echo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7201\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/05-echo.png\" alt=\"\" width=\"856\" height=\"699\" \/><\/a><\/li>\n<li>The last page of the wizard allows configuring the debug settings. VisualGDB uses the same low-level debug tools that the Xilinx Vitis IDE does, so all debug probes compatible with the original Vitis IDE will also work with VisualGDB, as long as you select the &#8220;Xilinx JTAG&#8221; debug method in the &#8220;Debug Methods&#8221; view. Plug in your debug probe and select the JTAG interface from the list (or proceed with the &#8220;any compatible JTAG probe&#8221;) setting:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/06-debug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7202\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/06-debug.png\" alt=\"\" width=\"856\" height=\"699\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to generate your project. VisualGDB will use the XSCT tool (the back-end used by the Vitis IDE) to create the platform, domain and application based on the selected settings:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/07-create.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7203\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/07-create.png\" alt=\"\" width=\"857\" height=\"699\" \/><\/a><\/li>\n<li>Once the project is created, the platforms, systems, domains and BSPs will appear in Solution Explorer. The IntelliSense will be automatically configured based on the settings extracted from these components:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/08-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7204\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/08-build.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><\/li>\n<li>Build the project by pressing Ctrl-Shift-B. VisualGDB will automatically invoke the Xilinx build process via the XSCT interface, so the build result will 100% match the output of the Vitis IDE: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/09-built.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7205\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/09-built.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><strong>If the build fails, make sure the same project is not open in Eclipse or another instance of Visual Studio.<\/strong><\/li>\n<li>Note how Solution Explorer shows Applications (1), Systems (2), Platforms (3), CPUs (4) and BSPs (5):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/10-struct.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7206\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/10-struct.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><\/li>\n<li>Locate the node for the main application, right-click on it and select &#8220;Properties&#8221;. VisualGDB will open a Properties window showing the common properties of the application:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/11-props.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7207\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/11-props.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a>Note that these properties are automatically synchronized with the Eclipse project via the XSCT interfaces. I.e. changing them in Visual Studio will affect Eclipse and vice versa.<\/li>\n<li>VisualGDB provides a graphical interface for editing various settings of the Vitis BSPs. Right-click on the app in Solution Explorer and select &#8220;Configure Vitis BSP(s)&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/12-config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7208\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/12-config.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><\/li>\n<li>The BSP configuration window allows enabling\/disabling drivers for various peripherals, as well as selecting a specific driver type or version:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/13-drivers.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7209\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/13-drivers.png\" alt=\"\" width=\"819\" height=\"581\" \/><\/a><\/li>\n<li>The &#8220;Libraries and Settings&#8221; view allows referencing and configuring various reusable libraries. The list of libraries and configuration parameters is automatically managed by the Vitis back-end: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/14-libraries.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7210\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/14-libraries.png\" alt=\"\" width=\"819\" height=\"726\" \/><\/a><\/li>\n<li>Now we will show how to debug the projects. Press F5 to begin debugging. VisualGDB will automatically load the first-stage bootloader, let it initialize the hardware, and will then launch the main application: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/15-bootldr.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7211\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/15-bootldr.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><\/li>\n<li>Once the main application is launched, your breakpoint will trigger:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/16-threads.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7212\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/16-threads.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a>Note that if you are using FreeRTOS, VisualGDB will automatically parse and display the list of FreeRTOS threads.<\/li>\n<li>The Xilinx debugger interface supports reading the target memory in the background. Hence you can use the <strong>Debug-&gt;Windows-&gt;Live Watch<\/strong> window to examine the values of various variables while the program is running. If you are using VisualGDB Custom or higher, you can use the FreeRTOS view in Live Watch to view FreeRTOS threads, heap and synchronization primitives:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/17-live.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7213\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/17-live.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><\/li>\n<li>VisualGDB provides context menu commands for common Vitis tasks. E.g. you can regenerate a Vitis platform by right-clicking on it in Solution Explorer and selecting &#8220;Regenerate Platform with XSCT&#8221; or load the FPGA bitstream file by selecting &#8220;Load Bitstream into FPGA&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/18-context.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7214\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/18-context.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><\/li>\n<li>You can also use the <strong>Debug-&gt;Windows-&gt;XSCT Session<\/strong> window to run <a href=\"https:\/\/www.xilinx.com\/html_docs\/xilinx2018_1\/SDK_Doc\/xsct\/intro\/xsct_commands.html\">XSCT commands<\/a> directly:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/01\/13-xsct.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7147\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/01\/13-xsct.png\" alt=\"\" width=\"1193\" height=\"873\" \/><\/a><\/li>\n<li>Use the <strong>Add-&gt;New Item<\/strong> command in Solution Explorer to add new platforms, domains or applications to the existing project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/19-add.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7215\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/19-add.png\" alt=\"\" width=\"1190\" height=\"841\" \/><\/a><\/li>\n<li>In order to change VisualGDB-level settings of the project, right-click on the project node in Solution Explorer and select &#8220;VisualGDB Project Properties&#8221;. Then you can use the <strong>Project Settings<\/strong> and <strong>Build Settings<\/strong> pages to fine-tune various aspects of project loading and building. E.g. VisualGDB can automatically patch the BSP Makefiles generated by the Vitis back-end to avoid unnecessary rebuilds:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/20-patch.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7216\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2021\/03\/20-patch.png\" alt=\"\" width=\"1053\" height=\"741\" \/><\/a>If this option is enabled, VisualGDB will make a snapshot of all source and header files inside the BSP, and will automatically skip the rebuild if none of these files have changed.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to use VisualGDB to build, edit and debug projects based on the Xilinx Vitis platform. We<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[229,228],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/7136"}],"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=7136"}],"version-history":[{"count":2,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/7136\/revisions"}],"predecessor-version":[{"id":7217,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/7136\/revisions\/7217"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=7136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=7136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=7136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}