VS Code Toradex Torizon Support Extension & Network Connectivity

I am trying to build a Hello World program, and deploy it to the iMX8 Colibri SOM board running TorizonCore (Linux colibri-imx8x-06800861 5.4.115-5.3.0+git.dbdbcabf0f98 #1-TorizonCore SMP PREEMPT Tue Jul 6 08:47:10 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux).

I am using a development laptop running Ubuntu 18.04 LTS, Docker (version 20.10.7), and VS Code (version 1.61.0). I have the following 3 extentions installed:
• Toradex Torizon Support v1.3.0
• Remote-Containers v0.202.5
• C/C++ v1.7.1

I have a direct (point-to-point) Ethernet connection between the development laptop and the board running TorizonCore. The board is successfully recognized by the Toradex extension (see device_recognized.png), and I can ssh to the board from VS Code (but only before attempting to create the HelloWorld program).

To create the HelloWorld program, I use the VS Code command palette, and I make the following selections:
“Torizon/C-C++: Create C/C++ application”
Makefile-based project
Target Platform: arm64v8-debian-no-ssh_bullseye
Debug configuration

My development laptop accesses the Internet using Wi-Fi, but can only do so when the Ethernet cable connecting the laptop to the target board is unplugged.

If there is no Internet connectivity when the Hello World program is created, I get the following error:

Local docker exception. :: Error (530) - Docker exception: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host
message:Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host
Step 1/4 : FROM torizon/debian-cross-toolchain-arm64:2-bullseye

If there is Internet connectivity when the Hello World program is created (achieved by temporarily unplugging the Ethernet cable from the target board), the above error does not occur, and some things appear to be downloaded from the Internet. If I then reconnect the Ethernet cable to the target board, VS Code appears to have trouble communicating with the target board. Specifically, I get SSH tunnel errors (see SSH_Tunnel_Errors.png). However, the connection is still established with no issues when I use ssh from a regular Ubuntu Linux terminal.

A couple of questions that come to mind right away:

  1. Is there a way to fix the SSH errors that only occur after the development container for Hello World is created?
  2. Is there a way to build a C++ program and deploy it to the target board without having any Internet connectivity?

Your help would be greatly appreciated.


Just whistling in the wind here, but

If your carrier board is much like the one for the Verdin, you should have a row of ports like this:

You can do development using USB-C connector (the one closest to the 9-pin ports). You don’t have to use network.

They are in a different spot on Dhalia.

Greetings @rubi0030,

First let me start out by outlining exactly for what and when does our extension require network connectivity.

When you create a C/C++ project the extension first must create an SDK container as a development environment. This typically requires network connection on the development host to create the SDK container. It will also require network connection whenever you modify the SDK container (i.e. you specify additional packages needed for compilation).

Beyond the SDK container the extension also requires internet connection to create the actual application container. This is to fetch any needed prerequisites for the container/application.

Finally the extension deploys the application container and other auxillary files to the target device via network. It should be noted that for building the SDK/application/deploying these steps are usually only done if they need to be. For example if something changed in the application then the application container needs to be rebuilt and re-deployed.

With all that said, you have a very interesting network setup so I’m not sure if our extension can quite work for you but here’s what I’d suggest:

  • When creating a new C/C++ project your development PC will need network connection for the SDK container. There’s no way around this.
  • Typically when you hit the debug button in VSCode it combines several steps together. It will build the application, deploy it to the device, and begin the debugging program.
  • However these steps can be done separately. In the command palette there should be something like Torizon: build application. Then you can swap your network setup to have connectivity between the device and your development PC. Then do the command Torizon: deploy application.

However even with this I’m not sure if the extension will cleanly work in such a setup. If possible I would suggest having your devices set up in way such that everything can be online with network connectivity at the same time. As this is what our extension expects.

Otherwise you can opt for developing outside of the extension via command line as shown here: How to do C/C++ Development on Torizon | Toradex Developer Center

Which affords a bit more flexibility compared to the extension, at the cost of automation and ease of use.

Best Regards,
Jeremias

Thank you Jeremias. I was able to modify my network setup so that my development laptop is
on the wired network (to connect to the SOM board) and the wireless network (to connect to the Internet) at the same time. This allowed me to create, build, and debug a HelloWorld application once. See the screen capture below.

However, when I tried to replicate this setup, I encountered the following strange behavior:

When I hit F5 to deploy and debug the application, the image seems to get deployed (it shows up in the list of images on the target), but the container does not start, and I see an informational box pop up saying “Syncing app folders”. See the screen capture below.

This message does not go away no matter how long I wait. Can you shed some light on what that message means, and how I can resolve this issue? Thank you.

For debugging purposes the extension uses rsync to send the application files to the /home/torizon folder on the target device. This is what occurs during the syncing app folders step. I’m not sure why this step never ends for you however. I assume it’s because the rsync process never exits for some reason therefore the extension thinks it’s still ongoing.

I would assume some kind of network issue that is making rsync hang. Can you reproduce this issue reliably?

Best Regards,
Jeremias

Yes, the issue occurs every time. As you can see from the previously attached screen capture, the image gets successfully deployed to the target over the network (point-to-point Ethernet connection). Plus I can manually ssh to the target while the “Syncing app folders” message is displayed. So, if it is a network issue, it is not obvious what it is. Is there anything special about how rsync uses the network? What steps would you suggest to determine the cause of this behavior? Is there a workaround? Thank you.

Is there any additional information/output from the TERMINAL view in VSCode?

I can’t seem to reproduce this issue, so any feedback/suggestions I can give is limited at best. The only other thing I might suggest would be to try the early access version of the extension instead. I know the early access version has various fixes and optimizations though I don’t recall if this was one of them. But it would be worth a try.

Best Regards,
Jeremias