This tutorial shows how to share Embedded VisualGDB projects between multiple users with different settings, such as toolchain paths. The relocation features shown here are available on VisualGDB 5.0+ on the Custom and Ultimate editions.
We will create a basic project for the STM32F4Discovery board and show how to access it from 2 different users.
- Start Visual Studio and open the Embedded Tool Manager from the Tools menu:If you don’t have your toolchain installed yet, you can download it or import an existing one by using the buttons to the right.
- By default, new VisualGDB projects will refer to the toolchain using the full path. As we want to support opening the projects on machines with different path, we will configure VisualGDB to refer to the toolchain using an environment variable that can be different for different users. Click “Configure toolchain relocation” and pick a variable name you would like to use to reference the toolchain:
- VisualGDB will update the environment, however Visual Studio caches it internally, so it will need to be restarted in order to pick up the changes:
- Start the VisualGDB Embedded Project Wizard:
- Continue with the default settings on the first page:
- On the next page select the toolchain and the device you want to target. When you select a relocatable toolchain, the button to the right of the toolchain selector will change the icon:You can use the button with the user icon to change the toolchain relocation settings from the wizard.
- Normally VisualGDB
would store the shared files (e.g. linker scripts) under
your local application data directory, however in this
example we will override this and store them under our
version control system. Click the “change” button to the
right of “shared files location” and select a directory near
the project directory:
- On the next page select a sample to use as a template for your project:
- Finally select a debug method:
- Build your project and open the <mcu>.mak file (e.g. stm32.mak). Notice how VisualGDB uses the variable name you specified to reference the toolchain directory and the relative path to reference the shared files:
- Now add the folder containing your project and your shared files to a source control system. In this example we will use TortoiseGit. It is recommended to add the following file masks to .gitignore:
Debug Release *.opensdf *.sdf *.suo *.old VisualGDBCache CodeDB
- Commit and push the changes to your git repo accessible by other users:
- On a different computer clone the git repository to a local directory:
- Before you can open the project, register the toolchain with VisualGDB by opening Tools->Embedded Tool Manager and clicking “Import a 3rd-party toolchain”:
- Then press “Configure toolchain relocation” and specify the same variable name as you specified on the first computer:Restart Visual Studio as instructed by VisualGDB.
- Now you can open your project. VisualGDB will ask whether you want to reuse the BSP from the shared folder:Confirm the BSP location so that VisualGDB can remember it for other projects.
- Build the project. Notice how VisualGDB uses the new toolchain path automatically:
- As the toolchain path is now referenced via the ARM_TOOLCHAIN_ROOT variable and the BSP files are referenced using relative paths, the project files remain the same for users with different paths. I.e. if the second user edits the source and builds the project, only the changed source file will be affected: