So, you just got your Jetson Nano and you're wondering how to get started? In this blog post you'll learn how to setup a remote development environment from your Windows 10 machine to a Jetson device.

Device Setup

First, let's start with the device initial setup. To prepare my device, I followed the official getting started guide from Nvidia. I used a 128 GB microSD and a power adapter to power up my device, along with the required jumper. I connected a Dell P2415Q monitor using an HDMI cable and my USB receiver for my Logitech Triathlon keyboard and mouse. My development laptop is a Windows 10 machine.

Desktop Sharing

The desktop sharing app is broken. Follow this article to fix it. You can also find instructions there on how to use Microsoft's Remote Desktop.

Development Environment

The latest trend of development experience in the software development industry is developing using CLIs and code editors. I generally enjoy having all moving parts together when I'm coding, or at least in proximity.

Visual Studio Code succeeded in combining together a cross-platform code editor, community driven plugins and decent UI/UX for development. But what I really like with Visual Studio Code is the recent Remote Development capability that allows you to keep a local UI/UX experience, while working on a remote host or container.

The other thing I like having in my development environment is idempotency: not having to deal with the dependencies of the host. Containers allow me to have multiple dependency configurations on the same host, and moreover, to share code between different hosts. For this reason, in every code sample I present in this blog, I make sure to include the corresponding container.

Step 1: Remote Development on a Jetson Nano

Because the ARM64 architecture is not officially supported yet, to install Visual Studio Code on your Jetson Nano, for now you'll have to use the community binaries.

Installing Visual Studio Code on a Jetson Nano

# Start an elevated session
sudo -s

# Install the community repo key
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0CC3FD642696BFC8

# Run the installation script
. <( wget -O - https://code.headmelted.com/installers/apt.sh )

If all goes well, you should get this output:

Installation complete!

You can start code at any time by calling "code-oss" within a terminal.

A shortcut should also now be available in your desktop menus (depending on your distribution).

Next, you'll need to install the Visual Studio Code Insiders on your host and install the Remote Development extension.

As a final step, you'll need to setup a passwordless SSH between your host and the Nano. To do this, you'll need to create an SSH public-private key pair and configure your device to trust your public key.

To setup your local SSH key in Windows run:

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
ssh-keygen -t rsa -b 4096 

The keys will be created here: %USERPROFILE%\.ssh

To copy your public key to the device:

SET REMOTEHOST=user@device
scp %USERPROFILE%\.ssh\id_rsa.pub %REMOTEHOST%:~/tmp.pub
ssh %REMOTEHOST% "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat ~/tmp.pub >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && rm -f ~/tmp.pub"

You'll need to replace the value user@device

In you host VSCode, hit F1 and type Remote-SSH: Open Configuration File..

Add your configuration:

Host Nano
    User user
    HostName device
    IdentityFile ~/.ssh/id_rsa

Replace the values user and device

Connect to your Nano clicking the low left corner green icon:

Congrats! Once connected, you can open a remote folder and open remote terminals directly in VSCode.

Step 2: X forwarding

What about applications that have a GUI? No worries, you can setup an X forwarding from Nano to your host. To do this, I'm using the X410 server for Windows. After installing and running the server, make sure you allow public access.

All is left to do is to configure the X Forwarding on your Nano device.

Open a terminal in VSCode (Ctrl+Shift+` on Windows) and run:

export DISPLAY=10.135.62.79:0.0

Make sure you replace the above IP with your host IP

To verify everything works, from the terminal run:

eog

If all goes well, you should see this window:

To automatically set the remote variable when debugging your app, you can modify your launch.json and set the variable there:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal", 
            "env":
            {
            "DISPLAY": "10.135.62.79:0.0" 
            }
        }
    ]
}

To test all this, create a new python file containing the following code:

import subprocess
subprocess.run(["eog"])

Now you can hit F5 and you'll get the same development experience, as with your local host, but running on a remote ARM machine!

Starting a remote debugging session on Jetson Nano

What we have achieved: We can now do remote development from a Windows host to a Jetson Nano, using VSCode.

Next, we'll setup the same remote environment, but on a Docker container running on the Jetson device.