forked from sinara-hw/assembly
Merge pull request 'describe building legacy firmware' (#6) from legacy-build into master
Reviewed-on: sinara-hw/assembly#6
This commit is contained in:
commit
ba8f21d9c2
|
@ -18,6 +18,7 @@
|
||||||
- [Sinara 9805 RF Power Amplifier Booster](./hw/booster.md)
|
- [Sinara 9805 RF Power Amplifier Booster](./hw/booster.md)
|
||||||
- [Sinara 8451 Thermostat](./hw/thermostat.md)
|
- [Sinara 8451 Thermostat](./hw/thermostat.md)
|
||||||
- [Software/Support](./sw_sup/software_support.md)
|
- [Software/Support](./sw_sup/software_support.md)
|
||||||
|
- [Building legacy firmware](./sw_sup/artiq_legacy.md)
|
||||||
- [Networking](./sw_sup/networking.md)
|
- [Networking](./sw_sup/networking.md)
|
||||||
- [DRTIO](./sw_sup/drtio.md)
|
- [DRTIO](./sw_sup/drtio.md)
|
||||||
- [UART Logs](./sw_sup/uart_logs.md)
|
- [UART Logs](./sw_sup/uart_logs.md)
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import shutil
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
import zipfile
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-v", default=None, help="Variant name")
|
||||||
|
parser.add_argument("-d", default="./artiq_kasli", help="path to built")
|
||||||
|
parser.add_argument("-o", default=None, help="output zip (default: kasli-<variant>.zip")
|
||||||
|
args = parser.parse_args()
|
||||||
|
if not args.v:
|
||||||
|
raise ValueError("need to specify variant!!")
|
||||||
|
basepath = os.path.abspath(args.d)
|
||||||
|
tempdir = os.path.join(basepath, "kasli-{}".format(args.v))
|
||||||
|
try:
|
||||||
|
os.mkdir(tempdir)
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
|
shutil.copyfile(os.path.join(basepath, args.v, "gateware/top.bit"), os.path.join(tempdir, "top.bit"))
|
||||||
|
shutil.copyfile(os.path.join(basepath, args.v, "software/bootloader/bootloader.bin"), os.path.join(tempdir, "bootloader.bin"))
|
||||||
|
try:
|
||||||
|
shutil.copyfile(os.path.join(basepath, args.v, "software/runtime/runtime.elf"), os.path.join(tempdir, "runtime.elf"))
|
||||||
|
shutil.copyfile(os.path.join(basepath, args.v, "software/runtime/runtime.fbi"), os.path.join(tempdir, "runtime.fbi"))
|
||||||
|
except FileNotFoundError:
|
||||||
|
shutil.copyfile(os.path.join(basepath, args.v, "software/satman/satman.elf"), os.path.join(tempdir, "satman.elf"))
|
||||||
|
shutil.copyfile(os.path.join(basepath, args.v, "software/satman/satman.fbi"), os.path.join(tempdir, "satman.fbi"))
|
||||||
|
output = args.o if args.o else "kasli-{}".format(args.v)
|
||||||
|
|
||||||
|
shutil.make_archive(output, "zip", tempdir)
|
||||||
|
shutil.rmtree(tempdir)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -0,0 +1,64 @@
|
||||||
|
# Building ARTIQ-6 and earlier
|
||||||
|
|
||||||
|
Pre-flake ARTIQ (that is 6 and earlier) requires slightly different steps for building.
|
||||||
|
|
||||||
|
## Initial setup
|
||||||
|
|
||||||
|
The following steps need to be done only once.
|
||||||
|
|
||||||
|
First we will need to specify older nixpkg version - 21.05. Open ``~/.nix-channels`` with your favorite text editor.
|
||||||
|
|
||||||
|
If there are any ``nixpkgs`` present already, comment them out with ``#``.
|
||||||
|
|
||||||
|
Then add the following line:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://nixos.org/channels/nixos-21.05 nixpkgs
|
||||||
|
```
|
||||||
|
|
||||||
|
Save and exit.
|
||||||
|
|
||||||
|
Now, we need special ``nix-scripts`` to configure building environment, and a local copy of the artiq repository, in legacy release.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mkdir artiq-legacy
|
||||||
|
cd artiq-legacy
|
||||||
|
git clone https://git.m-labs.hk/M-Labs/nix-scripts
|
||||||
|
git clone https://github.com/m-labs/artiq/
|
||||||
|
cd artiq
|
||||||
|
git checkout release-6 # or release-5...
|
||||||
|
cd ..
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setting up the environment and building firmware
|
||||||
|
|
||||||
|
Within ``fish`` shell (others may not work correctly), set up the ARTIQ build environment:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
nix-shell -I artiqSrc=<full path to artiq repo in legacy branch> nix-scripts/artiq-fast/shell-dev.nix
|
||||||
|
```
|
||||||
|
|
||||||
|
Then build the required firmware as usual:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
python -m artiq.gateware.targets.kasli_generic <variant>.json
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are building legacy ARTIQ for local use and you want to flash it, use:
|
||||||
|
```shell
|
||||||
|
artiq_flash -V <variant> -d artiq_kasli --srcbuild
|
||||||
|
```
|
||||||
|
|
||||||
|
There's a slight discrepancy from usual command - ``-V <variant>`` option is not present in ARTIQ-7+, but it is necessary here.
|
||||||
|
|
||||||
|
If you want to send the binaries to a customer, there's no need packing up the whole build directory - only ``top.bit``, ``bootloader.bin`` and ``runtime.elf/fbi`` or ``satman.elf/fbi`` are necessary. You can use the ``prep_pkg.py`` script from extras to package them up neatly into a zip file for distributions:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
python prep_pkg.py -v <variant> -d artiq_kasli/
|
||||||
|
```
|
||||||
|
|
||||||
|
Then the customer can use ``artiq_flash`` easily, after extracting the contents:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
artiq_flash -V <variant> -d .
|
||||||
|
```
|
Loading…
Reference in New Issue