forked from M-Labs/artiq
1
0
Fork 0
artiq/DEVELOPER_NOTES.rst

69 lines
2.6 KiB
ReStructuredText
Raw Normal View History

2017-10-30 18:03:28 +08:00
Sharing development boards
==========================
To avoid conflicts for development boards on the server, while using a board you must hold the corresponding lock file present in ``/var/lib/artiq/boards``. Holding the lock file grants you exclusive access to the board.
2017-10-30 18:03:28 +08:00
To lock the KC705 for 30 minutes or until Ctrl-C is pressed:
::
flock --verbose /var/lib/artiq/boards/kc705-1 sleep 1800
2018-01-15 19:43:29 +08:00
2017-10-30 18:03:28 +08:00
Check that the command acquires the lock, i.e. prints something such as:
::
flock: getting lock took 0.000003 seconds
flock: executing sleep
To lock the KC705 for the duration of the execution of a shell:
::
flock /var/lib/artiq/boards/kc705-1 bash
2017-10-30 18:03:28 +08:00
2017-10-31 22:53:39 +08:00
You may also use this script:
::
#!/bin/bash
exec flock /var/lib/artiq/boards/$1 bash --rcfile <(cat ~/.bashrc; echo PS1=\"[$1\ lock]\ \$PS1\")
2017-10-31 22:53:39 +08:00
2017-10-30 18:37:12 +08:00
If the board is already locked by another user, the ``flock`` commands above will wait for the lock to be released.
2017-10-30 18:03:28 +08:00
To determine which user is locking a board, use:
::
fuser -v /var/lib/artiq/boards/kc705-1
2017-10-30 18:03:28 +08:00
Selecting a development board with artiq_flash
==============================================
2018-01-19 15:59:23 +08:00
The board lock file also contains the openocd commands for selecting the corresponding developer board:
::
2018-01-20 01:44:23 +08:00
artiq_flash -I "$(cat /var/lib/artiq/boards/sayma-1)"
2018-01-19 15:59:23 +08:00
Using developer tools
=====================
2017-11-01 21:37:30 +08:00
2018-01-19 15:59:23 +08:00
ARTIQ ships with an ``artiq_devtool`` binary, which automates common actions arising when developing the board gateware and firmware on a machine other than the one to which the board is connected.
.. argparse::
2018-02-23 22:16:14 +08:00
:ref: artiq.frontend.artiq_devtool.get_argparser
:prog: artiq_devtool
2018-01-19 15:59:23 +08:00
To build and flash the firmware for ``sayma_amc_standalone`` target:
::
artiq_devtool -t sayma_amc_standalone build flash+log
To build the same target, flash it to the 3rd connected board, and forward the core device ports (1380, 1381, ...) as well as logs on the serial port:
::
artiq_devtool -t sayma_amc_standalone -b sayma-3 build flash connect
While the previous command is running, to build a new firmware and hotswap it, i.e. run without reflashing the board:
::
artiq_devtool -t sayma_amc_standalone build hotswap
While the previous command is running, to reset a board, e.g. if it became unresponsive:
::
artiq_devtool -t sayma_amc_standalone reset
2017-10-30 18:03:28 +08:00
Deleting git branches
=====================
Never use ``git push origin :branch`` nor ``git push origin --delete branch``, as this can delete code that others have pushed without warning. Instead, always delete branches using the GitHub web interface that lets you check better if the branch you are deleting has been fully merged.