This article complies to the Typographic Conventions for Torizon Documentation.
Torizon offers a Microsoft Environment for developers familiar with Visual Studio. This article will show how to install, configure and use it to build a "hello world" application and deploy it to a target device.
Access the Visual Studio Market Place and click on the Get Started button:
This will download the Visual Studio extension TorizonVSExtension.vsix file.
Warning: Before installing, make sure there are no instances of Visual Studio open.
Double click on TorizonVSExtension.vsix to start the installation. The following window below will be shown:
Select your Visual Studio version and click the Install button. Wait until the installation process is complete.
After installation, open Visual Studio for a first configuration of the work environment for Torizon. After opening Visual Studio click on Continue without code:
Visual Studio Extension For Torizon uses Docker container images that have all the toolchain and SDK for C/C++ development for Toradex Boards. It is recommended to download these container images before starting development. Select menu Tools -> Download update base and sdk containers :
Downloading and updating container images may take a few minutes. Wait until you have the following message in the output:
Visual Studio Extension For Torizon needs to be connected to a target device, which will be the context for deploying the developed applications. To connect to Toradex devices with Visual Studio Extension For Torizon use the Torizon Devices Explorer. Select the menu View -> Other Windows -> Torizon devices:
On the Torizon Devices Explorer click on the Detect device on the network:
The window below will be shown:
Enter the IP address of the Toradex board, which will be the target device, and the Torizon user credentials then click the
Note: These credentials are the same that were added during the first Torizon boot.
This detection process will perform an exchange of credentials between Visual Studio and the Toradex board to pair the board with the Torizon Visual Studio Extension.
After detection we should have in Torizon Devices Explorer a new entry for the target device. Click on
Refresh to download information... button to list the information about the Docker Images, Containers and Proccess running on the target device:
Another feature that must be enabled before we create our first project is the Torizon Toolbar. Right click on the Visual Studio toolbar and select Torizon Toolbar:
After this first environment setup we are ready to create our projects.
To create a new Torizon C/C++ project select File -> New -> Project ...:
Create a new project window search for
torizon templates and double click the
Torizon C/C++ Application template:
Configure your new project window:
Locationfor the project files or leave the pre-defined location;
On the create task Visual Studio will ask for
Select supported platforms. Select the platform that matches with the architecture of the target device. For this guide we are using the Apalis iMX8QM that contains a hexa-core arm64v8 processor, so we select the option
debian buster-slim:arm64v8 - 1.0:
This will create a blank Torizon C/C++ Application template.
After the development of your application, in the case of this guide a simple message to be written, it is time to run the application to test and debug it on the target device.
To debug your application you can enable breakpoints selecting the lines of code that you want debug:
After selecting any breakpoint in your source code, run the application to debug it. For this, click on the
Deploy and debug torizon Application, the "play" button, from Torizon Toolbar:
As shown in the GIF above, when clicking on
Deploy and debug torizon Application a window will be displayed warning that the application is not up to date, click on
yes button to build and update the application container. This will start the build, deploy and debug process.
The first time the application containers are built takes some time:
You will get the following messages in the output tab when the application container build has completed successfully:
When the build of the application container finishes Visual Studio will start the deployment onto the target device. A window to
Select device... will be shown. Select your target device to deploy from the list and click
The deployment of the container application to the target device can take some time during the first deployment. Wait until the deployment finishes successfully. After this the application will wait until the deployment finishes successfully. After that the application will be running on the target device and the breakpoint will be reached. Click on the
Continue button, or press the F5 key, to continue to the next instructions of the program:
After the first time, future deployments with the
Deploy and debug torizon Application command will become faster, because the container will only have to be updated on the target device, a much faster process than deploying the container as a whole:
When the application is ready, debugged and tested, it can be deployed and released. To do this switch the
Debug_debian_buster-slim_<your_arch> option to
Release_debian_buster-slim_<your_arch> in the Visual Studio toolbar
Next step is to put the extension in release mode. To do this, select Project -> Properties -> Torizon C/C++ Application -> Configuration -> HelloWorld Properties and change the combo box
For the Release configuration you will need to add two new properties. Click on the
New Property... button. In the
Name: field enter
targetcommands and in the
Value: field enter
CMD [ "/bin/HelloWorld.out" ], click
OK to apply it. For the second property click on the
New Property... button again. In the
Name: field enter
targetfiles and in the
Value: field enter
COPY work/bin/ /bin/, click
OK to apply it:
targetcommands property is the same as adding
CMD to a Dockerfile. Here we are adding the output generated by the compiler as
CMD. In order to place the executable file we created in to the path referenced by
CMD we must copy that file to the container image. The
targetfiles property allows us to
COPY to the Dockerfile. Here we are adding the output files,
bin folder, to be copied to Docker image.
Save button to apply the changes and close the
Property Pages window. Now in release mode build the application clicking on the
Build Torizon Application from the
Wait until the build is completed. After that it is necessary to build the application container, so click on the
Deploy Torizon application and container from the
After the deploy, refresh the list of images and containers on Torizon Devices Explorer:
You can see that now there are two images and two containers. One of these containers and image is for the debug, it will no longer be needed and can be deleted to free up space. First remove the debug container and then the image. Still using Torizon Devices Explorer click on the names listed in
Containers. The one that contains debug in your name, right click and select
After that the same can be done for the debug image. Using Torizon Devices Explorer click on the names listed in
Images. The one that contains debug in your name, right click and select
This section collects known issues and, if available, workarounds that are related to the Visual Studio Extension for Torizon:
Now that you have the extension set up and deployed your first hello world application, how about continuing with something more advanced? See these other articles using that use the Visual Studio Extension For Torizon: