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 (https://code.visualstudio.com/Download)

  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: https://docs.legato.io/latest/tools_vsCode.html

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.

2 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.