Run leaf / VSCode in Windows environment without VM (Experimental)

I’ve been able to install and run leaf and VSCode in Windows 10 without a cumbersome virtual machine. Instead i relied on WLS (Windows Linux Subsystem)

Disclaimer:
This is not an official method and I don’t guaranty it will work for every scenario. However in my case, initial tests were conclusive.

In Windows 10:

  1. Make sure WLS (Windows Linux Subsystem) is activated
    – execute Turn Windows Feature on and off
    – check Windows Subsystem for Linux box
    – restart your PC

  2. Install Visual Studio Code for Windows 10 64 bits (Download Visual Studio Code - Mac, Linux, Windows)

  3. Install Ubuntu 18.04 LTS from Microsoft Store app in Windows

  4. Launch Ubuntu app in Windows (this is a command line only version)

In Ubuntu app:

  1. Update python

sudo apt-get install python3-dev

  1. Install Leaf:

wget https://downloads.sierrawireless.com/tools/leaf/leaf_latest.deb -O /tmp/leaf_latest.deb && sudo apt install /tmp/leaf_latest.deb

Back in Windows 10:

  1. Launch VS Code

  2. Install the following extensions:
    – legato
    – Remote - WSL

  3. With the Remote - WSL extension installed, you will see a new Status bar item at the far bottom left in green

remote-status-bar

  1. Click on it and select “Remote WSL – New Window” (as an alternative you can press Shift + CTRL + P to bring up the command list). It will open a new VS Code window running in the WLS environment.

  2. make sure to activate the legato extension in this new window and you should be good to go

From this point you can continue the procedure described here: Legato Plugin for VSCode - Legato Docs

Operation seems a bit slow but I’ve been able to:

  • create, build and load a HelloWorld
  • upgrade the module firmware

Note:
More details about VS Code with WSL on this page https://code.visualstudio.com/remote-tutorials/wsl/getting-started

Feel free to share your experience. I’m interested to know if it works for you as well or if you face any issue.

5 Likes

Hi @bbo.

This is very useful. Thanks for sharing!

I followed your instructions and was able to build/install a basic system.


Update:

I’ve since successfully built a more complex system comprised of: 13 user apps, 17 user components, 15 user api interfaces.

The only issue here is the Legato VS Code plugin’s inability to resolve user-defined types in non-framework.api files in the editor. This flags problems such as identifier "name_of_type" is undefined with lots of squiggly red lines.

The build process, however, seems solid and will pick up on any legitimate errors and display them in the build task terminal.


Performance seems fine to me. It’s an improvement over a sluggish VM.

I encountered some minor issues with Leaf package installations but they were specific to my PC (running low on storage, attempt to install leaf packages, process fails at toolchain configuration, free some space, further attempts failed because the toolchain “folder already exists”, manually delete folder in WSL terminal, try again, no issues).

Now, looking forward to more VS Code features.

Has anyone tried this with WSL 2.0 yet? We are about to test it in the coming weeks. We’ve had experimental success with WSL 1.0 but it takes a while to build Legato and it’s very sluggish.

Once we test this out I’ll provide an updated post but just curious if anyone else has feedback on it.

Was there an updated post on WSL2 ?

I faced a couple of issues with this process:

this didn’t work at first:

Err:5 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 linux-libc-dev amd64 4.15.0-112.113
  404  Not Found [IP: 91.189.88.142 80]

:

Err:8 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-dev amd64 3.6.9-1~18.04ubuntu1.1
  404  Not Found [IP: 91.189.88.142 80]

:

Err:11 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 python3.6-dev amd64 3.6.9-1~18.04ubuntu1.1
  404  Not Found [IP: 91.189.88.142 80]
Fetched 5315 kB in 1s (4552 kB/s)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-112.113_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.6/libpython3.6-dev_3.6.9-1~18.04ubuntu1.1_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.6/python3.6-dev_3.6.9-1~18.04ubuntu1.1_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

But running apt-get update did fix that.

Despite successfully installing Leaf at step 6, Installing the Legato extension at this point didn’t work:

image

I think this is where you should install the Legato extension?

Various places within the documentation and VSCode itself refer to the leaf icon:

image

But that’s not the icon (anymore?) - it is actually a leaf:

image

ADDENDUM

On WSL, the mangOH build failed - due to Windows stuff with spaces in the PATH environment variable.

See (includes solution):

https://forum.mangoh.io/t/mangoh-yellow-wp77-build-fails/9306/11?u=awneil

I have these two messages

can you help me to install Remote -WSL and Leaf

WSL is done via this link Set up a WSL development environment | Microsoft Docs