When it comes to Linux development, it is possible to choose several IDEs, workflows and programming languages for development. Aiming to simplify your development experience Toradex provides TorizonCore IDE integration with Visual Studio Code for Windows and Linux PCs, and Visual Studio for Windows PCs.
In this module you will:
Note: support for a more complex workflow on Visual Studio Code will be presented to you at the end of the quickstart guide, as well as support for other programming languages on Visual Studio. If you have a Windows PC for development, you can also try the quickstart guide for Torizon with Windows selected as Development PC OS.
For this Getting Started Guide:
For this lesson:
Note: Carefully read this module's cover page clicking on "Module 2: First Steps with Torizon" on the left menu bar before starting this lesson.
The latest version of the Toradex Torizon Support extension can be found on the Visual Studio Code marketplace:
Click on the extensions button in Visual Studio Code as shown in the image below and search for Toradex Torizon Support:
Verify that the extension has been enabled:
Click the Torizon logo on the left vertical menu, then click on Add Device:
Add a Network device:
Use the previously found hostname or IP address:
Leave the username as
Add the password you have previously set during the first login to the board:
Wait one or two minutes, as the board reboots.
Click on the Refresh button, on the Devices list where your device will be listed if successfully added:
You can see which container images are deployed to the device and which containers are instanced - either running or stopped - among other properties:
F1 on Visual Studio Code and then type
Torizon/Python: Create Python Application to create a new application:
Add an Application name. We will name it
quickstart as an example:
Select your platform. Ignore the Qt options for now:
Choose the version of the container and the architecture:
Make sure that the Username is
torizon when prompted:
Your project template will be displayed in the file explorer:
Pylint warning is not specific for Torizon, it will happen for any
.py file. Although not mandatory, a linter is really helpful and recommended during development.
Open the main.py file and slightly modify it to make our debug fun:
#!python if __name__ == "__main__": counter = 1 for i in range(5): counter = 2*counter print("Loop " + str(i) + " - var=" + str(counter))
Add a breakpoint on
line 7. You just have to click on the beginning of the line:
Warning: You may have to enable setting breakpoints anywhere in a file via File > Preferences > Settings > Debug: Allow Breakpoints Everywhere.
F5 to start the process of deploying your application and debugging. It takes a few minutes when executed for the first time. Shall we grab a coffee?
When the process finishes, the Visual Studio Code will automatically switch to the Debug option on the vertical menu on the left and your code will stop on
line 7 where you have inserted the breakpoint:
F5 or click the play button to run until the next breakpoint and so on. You can see that the values of variables change as you go, and the output of code is printed to the Debug Console:
Debugging the Sample Application
It is interesting to highlight that you are doing remote debugging, which means that the application is running on the board, not on your development PC!