Search by Tags

Build and Run your First Application - Visual Studio Code


Your progress



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:

  • Use Visual Studio Code as IDE.
  • Create your Python script to run on TorizonCore.
  • Deploy it to the target module and debug it remotely from your development PC.

Note: support for other programming languages and more complex workflows will be presented to you at the end of the quickstart guide. If you have a Windows PC for development, you can also try the quickstart guide for Torizon with Windows selected as Development PC OS.

Typographic Conventions


For this Getting Started Guide:

  • Development computer with Ubuntu 18.04 LTS.
    • Commands and instructions may vary slightly on other Ubuntu releases and Linux distributions.
  • Successfully completed the previous lessons from this guide.

For this lesson:

You need to have the following applications installed on your development machine. Please, visit the developers' website to get instructions about how to obtain it.

You will also need Toradex hardware and computer on the same network.

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.

Step 1

Download the Torizon support package for Visual Studio Code and Python project's Github repository.

  • Project's Github repository

    Project's Github repository

After the download, the file will be on Downloads folder, go to that directory and extract the archives to your home folder.

Open your terminal, and type the following commands:

$ cd Downloads
$ unzip -d /home/$USER
$ cd ~/python-container-master/

  • Extracting python container

    Extracting python container

Step 2

Create a new folder by copying the template directory:

$ cp -r template hello-world

Step 3

Open Visual Studio Code. Click on File-> Open Folder menu.

  • Open Folder

    Visual Studio Open Folder

Select the hello-world folder.

Step 4

On the project explorer window, open the .vscode folder and click on the file settings.json.

  • Folder structure

    Folder structure

Edit the toradexpython.targetDevice field with your board's IP or hostname.

Step 5

Press ctrl+p and type task deploydebugcontainer to start building.

  • Visual Studio command palette

    Visual Studio command palette

The Build process of the release container image will start. It should complete successfully.

  • Visual Studio command output

    Visual Studio command output

Warning: Please, be sure you have Arm emulation enabled on your PC. To enable it, please refer to the previous lessons.

Note: It is also recommended to configure your SSH Key to avoid the necessity of password every time, check more about it on the Passwordless SSH Configuration.

Step 6

Create a new file on VS Code:

  • Create file

    Create file
val = 1
print("Hello world")
val = val + 1

Step 7

Put some breakpoints on the :

  • VS Code Breakpoints

    VS Code Breakpoints

Step 8

Press F5 to debug the script on the board. This will deploy the script from your developer computer to the board and it will stop the execution on the breakpoints set on the previous step:

  • VS Code Debugging from Container

    VS Code Debugging from Container

Warning: Please note: By pressing a key on the terminal, the session will be closed. However, you still need the terminal for debugging. Hence, do not close the terminal while you are executing the debug session.

You can view variable values and use the debug tools of VS Code normally. You can see too the output generated by the script on the DEBUG CONSOLE tab:

  • "VS Code Output from Container"

    VS Code Output from Container