{"id":6271,"date":"2020-06-07T14:10:40","date_gmt":"2020-06-07T21:10:40","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=6271"},"modified":"2020-06-07T14:25:21","modified_gmt":"2020-06-07T21:25:21","slug":"toolchains","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/documentation\/toolchains\/","title":{"rendered":"VisualGDB Toolchains"},"content":{"rendered":"<p>Toolchains are collections of tools (such as GCC, GNU Assembler or GDB) that are used to build and debug projects for a specific target. This page outlines how VisualGDB manages the toolchains for different targets.<\/p>\n<h2>Contents<\/h2>\n<p><a href=\"#types\">Supported Toolchain Types<\/a><br \/>\n<a href=\"#installing\">Installing Toolchains<\/a><br \/>\n<a href=\"#importing\">Importing Existing Toolchains<\/a><br \/>\n<a href=\"#referencing\">Referencing Toolchains<\/a><br \/>\n<a href=\"#troubleshooting\">Troubleshooting Toolchains<\/a><br \/>\n<a href=\"#msbuild\">Integration with MSBuild<\/a><\/p>\n<h2><a id=\"types\"><\/a>Supported Toolchain Types<\/h2>\n<p>VisualGDB supports the following types of toolchains:<\/p>\n<ul>\n<li>GCC (GNU C\/C++ compiler):\n<ul>\n<li>MinGW\/Cygwin<\/li>\n<li>Cross-compilers for Embedded or Linux targets<\/li>\n<li>Native GCC running on Linux targets<\/li>\n<li>Cross-GCC for Linux targets running on another Linux system<\/li>\n<\/ul>\n<\/li>\n<li>ARMCC and ARMClang (running on Windows only)<\/li>\n<li>IAR (running on Windows only)<\/li>\n<\/ul>\n<p>We provide pre-built toolchains for many popular platforms that can be downloaded <a href=\"https:\/\/gnutoolchains.com\/\">here<\/a>.<\/p>\n<h2><a id=\"installing\"><\/a>Installing Toolchains<\/h2>\n<p>VisualGDB can install many GCC-based toolchains out-of-the-box. Simply select a download link in one of the VisualGDB Project Wizards and it will automatically download and install a toolchain:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/install.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6274\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/install.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a>If your firewall is preventing VisualGDB from downloading toolchains, you can always download and install them manually from the <a href=\"https:\/\/gnutoolchains.com\/\">GNUToolchains site<\/a>.<\/p>\n<h2><a id=\"importing\"><\/a>Importing Existing Toolchains<\/h2>\n<p>VisualGDB can automatically detect the following 3rd-party toolchains installed on your computer:<\/p>\n<ul>\n<li><a href=\"https:\/\/developer.arm.com\/tools-and-software\/open-source-software\/developer-tools\/gnu-toolchain\/gnu-rm\">GNU ARM Embedded Toolchain<\/a><\/li>\n<li><a href=\"https:\/\/www.keil.com\/\">Keil ARMCC and ARMClang<\/a><\/li>\n<li><a href=\"https:\/\/www.iar.com\/iar-embedded-workbench\/\">IAR for ARM<\/a><\/li>\n<\/ul>\n<p>You can also import the toolchains (from both Windows or Linux machines) to VisualGDB by using the import buttons at the bottom of the Toolchain Selector:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/import.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6275\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/import.png\" alt=\"\" width=\"693\" height=\"137\" \/><\/a>If the imported toolchain does not appear in the list, see the <a href=\"#troubleshooting\">troubleshooting<\/a> section that describes how VisualGDB stores the toolchains.<\/p>\n<h2><a id=\"referencing\"><\/a>Referencing Toolchains<\/h2>\n<p>VisualGDB-based projects do not include a copy of a toolchain definition. Instead, they contain the following fields to uniquely identify an existing toolchain:<\/p>\n<ul>\n<li>Toolchain ID<\/li>\n<li>Toolchain version (GCC\/GDB versions and a toolchain revision number)<\/li>\n<\/ul>\n<p>You can find out the toolchain version used by a specific project by looking into <strong>VisualGDB Project Properties -&gt; Build Settings<\/strong> (the exact page name depends on the project type) or by directly checking the VisualGDB settings file (<strong>*.vgdbsettings<\/strong>, <strong>*.vgdbcmake<\/strong> or <strong>*.vgdbproj<\/strong>) or the embedded profile file (e.g. <strong>stm32.xml<\/strong>):<\/p>\n<pre class=\"\">  &lt;ToolchainID&gt;com.visualgdb.arm-eabi&lt;\/ToolchainID&gt;\r\n  &lt;ToolchainVersion&gt;\r\n    &lt;GCC&gt;9.3.1&lt;\/GCC&gt;\r\n    &lt;GDB&gt;8.3.1&lt;\/GDB&gt;\r\n    &lt;Revision&gt;1&lt;\/Revision&gt;\r\n  &lt;\/ToolchainVersion&gt;<\/pre>\n<p>If you open a project that references an unknown toolchain, VisualGDB will automatically suggest downloading or locating it:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/resolve.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6276\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/resolve.png\" alt=\"\" width=\"786\" height=\"209\" \/><\/a>If you would like to have multiple flavors of the same toolchain, try manually changing the toolchain ID in <strong>&lt;Toolchain Directory&gt;\\Toolchain.xml <\/strong>file and re-importing it into VisualGDB.<\/p>\n<h2><a id=\"troubleshooting\"><\/a>Troubleshooting Toolchains<\/h2>\n<p>You can find a list of all toolchain known to VisualGDB via <strong>Tools-&gt;VisualGDB-&gt;Manage VisualGDB Packages-&gt;Installed-&gt;Toolchains<\/strong>:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/packages.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6277\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/packages.png\" alt=\"\" width=\"1186\" height=\"431\" \/><\/a>If the window doesn&#8217;t show the toolchain you imported, try enabling the <strong>View-&gt;Other Windows-&gt;VisualGDB Diagnostics Console<\/strong> before opening the VisualGDB Package Manager. It will contain a detailed diagnostic log on finding the toolchains.<\/p>\n<h3>How VisualGDB Locates Toolchains<\/h3>\n<p>VisualGDB uses the following logic to find installed toolchains:<\/p>\n<ol>\n<li>First, it checks the <strong>%LOCALAPPDATA%\\VisualGDB\\ToolchainProfiles\\&lt;host name&gt;<\/strong> directory. Each directory there can contain one of the following:\n<ol style=\"list-style-type: lower-alpha;\">\n<li>A <strong>CustomToolchain.xml<\/strong> file that contains location of the toolchain, and also the names\/paths of various toolchain components.<\/li>\n<li>A <strong>ToolchainLink.txt<\/strong> file that contains the directory of the toolchain. The directory pointed by <strong>ToolchainLink.txt<\/strong> should contain either <strong>CustomToolchain.xml<\/strong> or <strong>Toolchain.xml<\/strong>. This only works for toolchains located on Windows.<\/li>\n<\/ol>\n<\/li>\n<li>Then, it checks the <strong>Software\\Sysprogs\\GNUToolchains<\/strong> registry keys (both <strong>HKEY_LOCAL_MACHINE<\/strong> and <strong>HKEY_CURRENT_USER<\/strong>) for toolchains installed from <a href=\"https:\/\/gnutoolchains.com\/\">GNUToolchains<\/a>.<\/li>\n<li>Finally, it searches the registry keys specified in <strong>%VISUALGDB_DIR%\\Rules\\KnownToolchains.xml<\/strong>. This imports GNU ARM toolchain, as well as KEIL\/IAR toolchains.<\/li>\n<\/ol>\n<h3>How VisualGDB Remembers Imported Toolchains<\/h3>\n<p>When you import a toolchain via the VisualGDB Project Wizard, it will try to create a <strong>Toolchain.xml<\/strong> or <strong>CustomToolchain.xml<\/strong> file in the toolchain directory, and the link to the toolchain by creating the <strong>ToolchainLink.txt <\/strong>file under <strong>%LOCALAPPDATA%<\/strong>. This preserves the toolchain settings even if you reset the VisualGDB&#8217;s <strong>%LOCALAPPDATA%<\/strong> directory.<\/p>\n<p>If the toolchain directory is not writable, VisualGDB will create the <strong>Toolchain.xml<\/strong> or <strong>CustomToolchain.xml<\/strong> file directly under <strong>%LOCALAPPDATA%<\/strong>. It will have exactly the same effect as placing it to the toolchain directory and linking it with <strong>ToolchainLink.txt<\/strong>.<\/p>\n<h3>Toolchain.xml vs CustomToolchain.xml<\/h3>\n<p>Due to backward compatibility reasons, VisualGDB uses 2 different toolchain definition formats. The <strong>Toolchain.xml<\/strong> file is used for toolchains supplied by Sysprogs, while <strong>CustomToolchain.xml<\/strong> is used for toolchains that were imported manually. The <strong>CustomToolchain.xml<\/strong>-based toolchain definitions can be edited using the &#8220;Customize&#8221; button as shown below:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/imported-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6285\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/imported-1.png\" alt=\"\" width=\"948\" height=\"679\" \/><\/a><\/p>\n<h2><a id=\"msbuild\"><\/a>Integration with MSBuild<\/h2>\n<p>The MSBuild-based projects use a special mechanism for loading the toolchain descriptions. First of all, the project must specify the toolchain ID, version and build host in the MSBuild-level settings (it is updated automatically when using VisualGDB wizards and VisualGDB Project Properties GUI):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/msbuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6286\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/msbuild.png\" alt=\"\" width=\"825\" height=\"544\" \/><\/a>You can use the &#8220;<strong>Rebuild MSBuild &amp; IntelliSense files for this toolchain<\/strong>&#8221; link to automatically update the MSBuild-level properties based on VisualGDB-level properties:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/rebuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6287\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/06\/rebuild.png\" alt=\"\" width=\"1019\" height=\"151\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Toolchains are collections of tools (such as GCC, GNU Assembler or GDB) that are used to build and debug projects<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[199],"tags":[],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/6271"}],"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=6271"}],"version-history":[{"count":4,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/6271\/revisions"}],"predecessor-version":[{"id":6291,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/6271\/revisions\/6291"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=6271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=6271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=6271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}