Windows WSL Setup - uw-advanced-robotics/taproot GitHub Wiki
This guide is deprecated and no longer supported. We recommend either installing natively on Windows without WSL, or using the Docker container if you do not require the ability to deploy to a robot.
- Enable WSL for Windows. The majority of this guide comes from
here.
- Open up "Apps & Features" (search for it in the "Start" menu).
- Click on "Programs and Features."
- Click the "Turn Windows features on or off" option from the left pane.
- Scroll down and check the "Windows Subsystem for Linux" option.
- Open up "Apps & Features" (search for it in the "Start" menu).
- Install Ubuntu 20.04 from the windows store.
- In the Start menu, search for "Windows Store."
- Search for "Ubuntu 20.04" in the windows store search menu.
- Once the installation is complete, Search for "Ubuntu 20.04 LTS" and hit enter. The first time you open up the distribution, you will need to create a new user account and password for your Linux distribution. The terminal will prompt you set up an account. Don't forget the password you entered, you will have to use it a lot.
- See here if you are having issues
installing WSL. Once WSL is set up, you should be able to open the "Ubuntu 20.04 LTS" terminal
from the "Start" menu and see the below.
- In the Ubuntu terminal, type
sudo apt-get update && apt-get upgrade
. - Download and Install VSCode.
- Open a new VSCode window (Search for "VSCode" in the start menu), and in the resulting VSCode editor type Ctrl+Shift+X, which will open up an extension manager. In the "Search Extensions in Marketplace" search bar, type "Remote - WSL", click on the resulting extension, and click on the "Install" button.
- When the "Remote - WSL" extension is installed, in VSCode type Ctrl+Shift+P and type into the prompt that pops up "Remote Explorer: Focus on WSL Targets View" and hit enter.
- On the side panel that pops up, next to the "Ubuntu-20.04" WSL target, click on the folder (see
image below).
- Another VSCode window will pop up indicating that you are being connected via WSL. Once the connection is complete, open up the VSCode terminal (this can be accomplished via Ctrl+~).
- With the Ubuntu 20.04 LTS WSL terminal open, type in the following commands:
sudo apt-get install python3 python3-pip scons git sudo apt-get --no-install-recommends install doxygen pip3 install modm sudo apt-get install gcc build-essential libboost-all-dev pip3 install lbuild pip3 install pyelftools
- Add lbuild to your path:
- Open
~/.bashrc
with VSCode. This can be accomplished in the terminal viacode ~/.bashrc
. - Scroll down to the end of the file and type this:
PATH="$HOME/.local/bin:$PATH" export PATH
- Save the new updates.
- Open
- Download the latest
version
of the arm-none-eabi toolchain. You will need to do this via the Ubuntu 18.04 terminal as well.
- You can do the download on your windows machine, then in the Ubuntu terminal navigate to where
the folder was downloaded using
cd
. Note that the "c" drive is located in/mnt/c
. - Once you have found the folder, I recommend moving it somewhere permanent via
mv path/to/folder/folder-name path/to/destination
- Unzip the file through the Ubuntu terminal. This can be accomplished via
tar -xvf filename
, wherefilename
is the name of the tar you downloaded.
- You can do the download on your windows machine, then in the Ubuntu terminal navigate to where
the folder was downloaded using
- Add the
/bin
folder ofgcc-arm-none-eabi-<version>-update
to your path (where<version>
is the compiler version you downloaded):- Open
~/.bashrc
with VSCode (code ~/.bashrc
). - Scroll down to the end of the file, and right above
PATH="$HOME/.local/bin:$PATH"
, type this:WherePATH=path/to/gcc-arm-none-eabi-<version>-update/bin:$PATH
path/to/gcc-arm-none-eabi-<version>-update
is replaced with your own path to the toolchain.
- Open
- Clone this repository:
-
Important: In the WSL terminal you have open, you should navigate away from
~/
(your WSL home directory, which you can't access via Windows) to a directory that you can access through your Windows system. - Your "c" drive can be found via
cd /mnt/c
. From there, you can navigate usingcd
to a directory where you would like the cloned repository to be stored. - Once you have navigated to your desired directory, in the terminal type
git clone --recursive https://gitlab.com/aruw/controls/taproot.git
.- If you forget the
--recursive
, run:git submodule update --init --recursive
.
- If you forget the
-
Important: In the WSL terminal you have open, you should navigate away from
- Open the
taproot
folder in your WSL version of VSCode. The first time you try to open this folder, you can start VSCode, then in the "Welcome" page, under the "Start" menu, find "Open folder...". - When you open up the folder, VSCode should prompt you to install the recommended extensions.
Click "install recommended extensions". You should now have the "C/C++", "Cortex-Debug", and
"aruw robot chooser" extensions.
- Note: The Cortex-Debug extension must be installed on your Windows version of VSCode (its OK if it is default installed on your WSL version of VSCode). To do this, open up a new VSCode terminal, open up the extension marketplace Ctrl+Shift+X) and into the search menu type "Cortex-Debug". Install the extension that comes up.
- The next steps are not to be done through WSL (do not use the Ubuntu 18.04 LTS terminal you have open).
- Download the latest version of openocd. Download
the newest version of the software and extract the files to a permanent location. The downloaded
file is of type
.7zip
, so you will need a way to extract 7zip files, either by installing the 7zip extractor or by using an online unzipper. - Add the path of the
/bin
directory of OpenOCD to your PATH environment variable.- In your Start menu, search for "environment" and select "Edit the system environment variables."
- In the "User variables for {your username here}", where {your username here} is a
placeholder for your actual name. Double click on "Path."
- In "Edit environment variable," click "New."
- Add the absolute path of the
/bin
directory of OpenOCD to the box that shows up after you click "New".
- Select "OK."
- Download and run the the ST-Link V-2 driver installer.
- Download and install the J-Link driver, Ozone, and J-Scope from the Segger website. This is only needed if you plan on using a J-Link for development and debugging.
- Restart your computer to ensure everything has been installed properly.