The complete Artiq Toolchain is working on Windows using WSL. You can follow most of the instructions on https://m-labs.hk/artiq/manual/installing.html and https://m-labs.hk/artiq/manual/building_developing.html but there are a few extra steps to make it work with WSL. These instructions worked on multiple machines in our institute. Please comment if you have different issues on your machine.

Prerequisites

  • Windows 10/11
  • Around 200GB free disk space (maybe less if you get the Xilinx webinstaller to work, which didn't work for me)
  • free time (some steps take a few hours)

You can use either cmd or Powershell. I personally recommend Windows Terminal. (From the MS Store)

WSL2

First, you have to enable WSL2 if you haven't yet. Here is a good guide for that. Make sure you're installing WSL2 and not WSL1.
https://learn.microsoft.com/en-us/windows/wsl/install-manual
We used Ubuntu 22.04 but 20.04 or 18.04 should work as well.

Before opening Ubuntu, limit the WSL system resources by writing to the file %userprofile%/.wslconfig (in your windows file system)
[wsl2]
memory=8GB
processors=2
swap=64GB
swapfile=D:\\wsl\\wsl-swap.vhdx

For Memory I recommend around half of what your machine provides as RAM. If it's higher it may crash everything. The Swap should be at least 32GB since Xilinx Vivado is very hungry and will fail otherwise.

Now you can follow most of the instructions on https://m-labs.hk/artiq/manual/building_developing.html as if you're on Ubuntu.

Xilinx Vivado

The Xilinx Vivado webinstaller did not work for me, so I downloaded the whole package from https://www.xilinx.com/support/download.html (Xilinx Unified Installer 2022.2 SFD (TAR/GZIP - 89.4 GB) It also requires you to make an account. You can move the archive to your Ubuntu file system via the Windows Explorer (below quick access there should be a "Linux") or find your Windows file system in Ubuntu at /mnt/.
After extracting I had to run
sudo ./xsetup -a XilinxEULA,3rdPartyEULA -b Install -e 'Vitis Unified Software Platform' -l /opt/Xilinx/
to successfully install. Chose the second option Vivado when it asks you.
Make sure to installl it in /opt/Xilinx or you have to update the path in the artiq repository flake.nix file.

Nix

You can normally install nix. However, due to an unknown reason the following did not work.
nix develop git+https://github.com/m-labs/artiq.git\?ref=release-8
Instead, break it down into the following steps:

git clone https://github.com/m-labs/artiq.git
cd artiq
git checkout release-8
nix develop .#boards

It should probably work for newer Artiq versions as well.
The nix develop may take a few hours the first time. All consecutive runs will be done instantly.
Commands like artiq_run --version and openocd --version should be available now. You have to run nix develop in the artiq repository each time you start WSL.

Generating binaries and device_db.py

Now you should be able to generate binaries with:
python -m artiq.gateware.targets.kasli_generic hardware_description.json
You can generate the device_db.py with:
python -m artiq.frontend.artiq_ddb_template hardware_description.json -o device_db.py

USBIPD

To flash the binaries you need USBIPD to forward the USB connection from Windows to WSL.
Follow https://learn.microsoft.com/de-de/windows/wsl/connect-usb
You may have to update WSL using wsl --update

The Artiq crate should show as something like Quad RS-232.

In WSL you can list the devices with lsusb when it's connected.
For me in /dev/ I got ttyUSB0, ttyUSB1, ttyUSB2 and ttyUSB3 when connecting. Due to unknown reasons only ttyUSB2 gave me output when using
flterm /dev/ttyUSB2
while restarting the Artiq system.

If you get a permission denied error make sure your Ubuntu user are both in the dialout and tty group.
If you still get a permission denied error create a udev rule.
sudo nano /etc/udev/rules.d/50-myusb.rules
Fill it with
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", GROUP="users", MODE="0666"
Where idVendor and idProduct are the first and second 4-digit numbers when listing with lsusb. You can also get a more detailed log with the command usb-devices
Restarting WSL doesn't help to enable it. After every WSL shutdown I have to run both

sudo udevadm trigger
sudo service udev restart

to get permission for the USB device.

IP Address

When getting the startup log from the serial connection via usb, I noticed the IP Address was not what I defined in the hardware_description.json. (Also not sure why) The IP in the device_db.py was as previously defined though.
After setting my ethernet adapter manually to the same ip adress with only the 4th number different (subnet mask 255.255.255.0, gateway 10.1.2.1) I could finally get a ping to the IP. After that you can change the IP with
artiq_coremgmt -D [old IP] config write -s ip [new IP] to match the device_db.py and your prefered local network.
(and then change back your own IP again)

  • nx- likes this.