1 # Utilities for Jacob Lifshay's build server for Libre-SOC
3 ## Programming the FPGA from your `.gitlab-ci.yml` file
5 Add the gitlab-build-utils branch of utils.git to your repo:
8 git submodule add -b gitlab-build-utils https://git.libre-soc.org/git/utils.git gitlab-build-utils
11 Add the environment variable override to the `build` `before_script` section of your `.gitlab-ci.yml` file:
17 - export XC3SPROG="$PWD/gitlab-build-utils/program-fpga.py"
20 Use the `ArtyA7_100Platform` from `nmigen_boards`:
23 from nmigen_boards.arty_a7 import ArtyA7_100Platform
24 from nmigen_boards.test.blinky import Blinky
26 platform = ArtyA7_100Platform(toolchain="yosys_nextpnr")
27 platform.build(Blinky(), do_program=True)
30 ## Setting up the build server
32 Switch to the root user:
43 Clone https://git.libre-soc.org/git/utils.git and checkout the
44 gitlab-build-utils branch:
46 git clone -b gitlab-build-utils https://git.libre-soc.org/git/utils.git gitlab-build-utils
49 Install `program-fpga.py`:
52 install program-fpga.py /usr/local/bin/
55 Install the systemd service:
57 systemctl enable `realpath program-fpga.socket program-fpga.service`
60 Start the systemd socket (only needed right after installation,
61 it should start automatically on next reboot):
63 systemctl start program-fpga.socket
66 Add it to the `runners.runners.docker.volumes` key in `gitlab-runner`'s
67 config file `/etc/gitlab-runner/config.toml`:
73 volumes = ["/cache", "/run/program-fpga.sock:/arty-prog-socket"]
76 Press Ctrl+D to exit the root shell.
81 ARTY_PROG_SOCKET=/run/program-fpga.sock program-fpga.py -c nexys4 empty.bit
84 It should output something like this (error because an empty file isn't
85 something it can program to the fpga):
87 xc3sprog -c nexys4 last.bit
88 XC3SPROG (c) 2004-2011 xc3sprog project $Rev$ OS: Linux
89 Free software: If you contribute nothing, expect nothing!
90 Feedback on success/failure/enhancement requests:
91 http://sourceforge.net/mail/?group_id=170565
92 Check Sourceforge for updates:
93 http://sourceforge.net/projects/xc3sprog/develop
99 Test it through gitlab-ci:
100 Go to https://salsa.debian.org/Kazan-team/mirrors/utils/-/tree/gitlab-build-utils
102 Go to the latest commit, click on the link to the pipeline, click on the retry button on the build button, it looks like:
104 ![gitlab-rerun-job.png](gitlab-rerun-job.png)
106 Wait until the job completes, it should be successful, with the last few lines being where the fpga is programmed:
110 xc3sprog -c nexys4 last.bit
111 XC3SPROG (c) 2004-2011 xc3sprog project $Rev$ OS: Linux
112 Free software: If you contribute nothing, expect nothing!
113 Feedback on success/failure/enhancement requests:
114 http://sourceforge.net/mail/?group_id=170565
115 Check Sourceforge for updates:
116 http://sourceforge.net/projects/xc3sprog/develop
118 Saving cache for successful job