Add setup for building the firmware instructions

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-06-17 11:59:46 +08:00
parent 47d46b7bbd
commit 98632d7c31
2 changed files with 64 additions and 1 deletions

View File

@ -29,4 +29,5 @@
- [Flashing the Firmware](./sw_sup/flashing_firmware.md)
- [Moninj](./sw_sup/moninj.md)
- [Clocking](sw_sup/clocking.md)
- [device_db.py](sw_sup/device_db.md)
- [device_db.py](sw_sup/device_db.md)
- [Setup your PC for building ARTIQ firmware](sw_sup/setup_build_pc.md)

View File

@ -0,0 +1,62 @@
# Setup your PC for building ARTIQ firmware
This page should guide you through building the firmware on your own PC.
Unfortunately, the building process is not possible on Windows natively (nor MSYS2),
but you can use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
## Prerequisites
You should have a Linux with `nix` and `git` installed. For this purpose you may want to consider NixOS, though it is hard way for everything else.
You should have at least 70+ GB of free space (better 100+ GB) on your `/opt` or `/` - most of this space will be taken
by Vivado.
## Installation
1. Install Vivado 2022.2 from [Vivado archive](https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive.html) into `/opt`.
2. Check that `ls -al /opt/Xilinx/Vivado/2022.2/settings64.sh` exists and has read and execute permissions for all:
```shell
$ ls -al /opt/Xilinx/Vivado/2022.2/settings64.sh
-rwxr-xr-x 1 nobody nogroup 245 Dec 17 2022 /opt/Xilinx/Vivado/2022.2/settings64.sh
```
3. Add following into the `~/.local/share/nix/trusted-settings.json`, by `mkdir -p ~/.local/share/nix/ && nano ~/.local/share/nix/trusted-settings.json`
or with your favorite way (don't forget to save - Ctrl+O in `nano`):
```json
{
"extra-sandbox-paths":{
"/opt":true
},
"extra-substituters":{
"https://nixbld.m-labs.hk":true
},
"extra-trusted-public-keys":{
"nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc=":true
}
}
```
4. Enable flakes in Nix by e.g. adding `experimental-features = nix-command flakes` to nix.conf (for example `~/.config/nix/nix.conf`).
From here, you should be able to enter ARTIQ development shell directly from URL, or by cloning the repository.
The later will allow you to edit the source code in case of need.
For example for Kasli 2.0:
```shell
git clone https://github.com/m-labs/artiq.git
cd artiq
nix develop #boards
```
For Kasli-SoC:
```shell
git clone https://git.m-labs.hk/M-Labs/artiq-zynq.git
cd artiq-zynq
nix develop
```
For building instructions for your JSON, please refer to the [build and test instructions](../build_test_firmware.md).
The reference uses commands like `nix develop github:m-labs/artiq\?ref=release-8#boards` and `nix develop git+https://git.m-labs.hk/m-labs/artiq-zynq\?ref=release-8`.
You may safely skip such commands if you entered the development shell (`nix develop`) from cloned git repository.
If you want to update the source files, you may use `git pull origin master --rebase`.
Please refer to git documentation `https://www.git-scm.com/docs` if you are unfamiliar with `git`.
You may also use GUI git tools, like the one integrated into JetBrains IDEs, VS Code, Sublime Merge or others.