From 700812471c6754938bbcde88b9bf5aa243c1481e Mon Sep 17 00:00:00 2001 From: newell Date: Tue, 15 Oct 2024 23:12:40 -0700 Subject: [PATCH] doc: Additonal EBAZ4205 documentation, fix JSON description terminology (#2588) --- doc/manual/building_developing.rst | 40 +++++++++++++++++++----------- doc/manual/configuring.rst | 3 +++ doc/manual/core_device.rst | 23 ++++++++++++++++- doc/manual/extending_rtio.rst | 8 +++--- doc/manual/flashing.rst | 6 ++--- 5 files changed, 57 insertions(+), 23 deletions(-) diff --git a/doc/manual/building_developing.rst b/doc/manual/building_developing.rst index e196c689d..db9ed1a0c 100644 --- a/doc/manual/building_developing.rst +++ b/doc/manual/building_developing.rst @@ -33,13 +33,13 @@ Download and run the official installer. If using NixOS, note that this will req System description file ----------------------- -ARTIQ gateware and firmware binaries are dependent on the system configuration. In other words, a specific set of ARTIQ binaries is bound to the exact arrangement of real-time hardware it was generated for: the core device itself, its role in a DRTIO context (master, satellite, or standalone), the (real-time) peripherals in use, the physical EEM ports they will be connected to, and various other basic specifications. This information is normally provided to the software in the form of a JSON file called the system description or system configuration file. +ARTIQ gateware and firmware binaries are dependent on the system configuration. In other words, a specific set of ARTIQ binaries is bound to the exact arrangement of real-time hardware it was generated for: the core device itself, its role in a DRTIO context (master, satellite, or standalone), the (real-time) peripherals in use, the physical EEM ports they will be connected to, and various other basic specifications. This information is normally provided to the software in the form of a JSON file called the system description file. .. warning:: - System configuration files are only used with Kasli and Kasli-SoC boards. KC705 and ZC706 ARTIQ configurations, due to their relative rarity and specialization, are handled on a case-by-case basis and selected through a variant name such as ``nist_clock``, with no system description file necessary. See below in :ref:`building` for where to find the list of supported variants. Writing new KC705 or ZC706 variants is not a trivial task, and not particularly recommended, unless you are an FPGA developer and know what you're doing. + Not all core devices use system description files. Devices that use system description files for configuration are referred to as JSON variants (see :ref:`JSON variant devices `). Some rare or specialized boards use hardcoded variants, selected by a variant name such as ``nist_clock``, without needing a system description file (see :ref:`Hardcoded variant devices `). For the list of supported variants, see the :ref:`building` section. Writing new hardcoded variants is not a trivial task and is generally not recommended unless you are an experienced FPGA developer. -If you already have your system configuration file on hand, you can edit it to reflect any changes in configuration. If you purchased your original system from M-Labs, or recently purchased new hardware to add to it, you can obtain your up-to-date system configuration file through AFWS at any time using the command ``$ afws_client get_json`` (see :ref:`AFWS client`). If you are starting from scratch, a close reading of ``coredevice_generic.schema.json`` in ``artiq/coredevice`` will be helpful. +If you already have your system description file on hand, you can edit it to reflect any changes in configuration. If you purchased your original system from M-Labs, or recently purchased new hardware to add to it, you can obtain your up-to-date system description file through AFWS at any time using the command ``$ afws_client get_json`` (see :ref:`AFWS client`). If you are starting from scratch, a close reading of ``coredevice_generic.schema.json`` in ``artiq/coredevice`` will be helpful. System descriptions do not need to be very complex. At its most basic, a system description looks something like: :: @@ -104,7 +104,7 @@ Nix development environment - If using NixOS, instead make the equivalent changes to your ``configuration.nix``. -* Clone `the ARTIQ Git repository `_, or `the ARTIQ-Zynq repository `__ for Zynq devices (Kasli-SoC or ZC706). By default, you are working with the ``master`` branch, which represents the beta version and is not stable (see :doc:`releases`). Checkout the most recent release (``git checkout release-[number]``) for a stable version. +* Clone `the ARTIQ Git repository `_, or `the ARTIQ-Zynq repository `__ for :ref:`Zynq devices ` (Kasli-SoC, ZC706, or EBAZ4205). By default, you are working with the ``master`` branch, which represents the beta version and is not stable (see :doc:`releases`). Checkout the most recent release (``git checkout release-[number]``) for a stable version. * If your Vivado installation is not in its default location ``/opt``, open ``flake.nix`` and edit it accordingly (note that the edits must be made in the main ARTIQ flake, even if you are working with Zynq, see also tip below). * Run ``nix develop`` at the root of the repository, where ``flake.nix`` is. @@ -171,10 +171,10 @@ This will create a directory ``artiq_kasli`` or ``artiq_kc705`` containing the b Look for the option ``-V VARIANT, --variant VARIANT``. -Kasli-SoC or ZC706 (ARTIQ on Zynq) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Kasli-SoC, ZC706 or EBAZ4205 (ARTIQ on Zynq) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The building process for Zynq devices is a little more complex. The easiest method is to leverage ``nix build`` and the ``makeArtiqZynqPackage`` utility provided by the official flake. The ensuing command is rather long, because it uses a multi-clause expression in the Nix language to describe the desired result; it can be executed piece-by-piece using the `Nix REPL `_, but ``nix build`` provides a lot of useful conveniences. +The building process for :ref:`Zynq devices ` is a little more complex. The easiest method is to leverage ``nix build`` and the ``makeArtiqZynqPackage`` utility provided by the official flake. The ensuing command is rather long, because it uses a multi-clause expression in the Nix language to describe the desired result; it can be executed piece-by-piece using the `Nix REPL `_, but ``nix build`` provides a lot of useful conveniences. For Kasli-SoC, run: :: @@ -182,18 +182,18 @@ For Kasli-SoC, run: :: Replace ```` with ``master``, ``satellite``, or ``standalone``, depending on your targeted DRTIO role. Remove ``?ref=release-[number]`` to use the current beta version rather than a numbered release. If you have cloned the repository and prefer to use your local copy of the flake, replace the corresponding clause with ``builtins.getFlake "/absolute/path/to/your/artiq-zynq"``. -For ZC706, you can use a command of the same form: :: +For ZC706 or EBAZ4205, you can use a command of the same form (replace ```` with ``zc706`` or ``ebaz4205``): :: - $ nix build --print-build-logs --impure --expr 'let fl = builtins.getFlake "git+https://git.m-labs.hk/m-labs/artiq-zynq?ref=release-[number]"; in (fl.makeArtiqZynqPackage {target="zc706"; variant="";}).zc706--sd' + $ nix build --print-build-logs --impure --expr 'let fl = builtins.getFlake "git+https://git.m-labs.hk/m-labs/artiq-zynq?ref=release-[number]"; in (fl.makeArtiqZynqPackage {target=""; variant="";}).--sd' or you can use the more direct version: :: - $ nix build --print-build-logs git+https://git.m-labs.hk/m-labs/artiq-zynq\?ref=release-[number]#zc706--sd + $ nix build --print-build-logs git+https://git.m-labs.hk/m-labs/artiq-zynq\?ref=release-[number]#--sd -(which is possible for ZC706 because there is no need to be able to specify a system description file in the arguments.) +(which is possible for ZC706 or EBAZ4205 because there is no need to be able to specify a system description file in the arguments.) .. note:: - To see supported ZC706 variants, you can run the following at the root of the repository: :: + To see supported ZC706 variants (for EBAZ4205 variants, replace ``zc706`` with ``ebaz4205``), you can run the following at the root of the repository: :: $ src/gateware/zc706.py --help @@ -207,7 +207,11 @@ Any of these commands should produce a directory ``result`` which contains a fil 1. Power off the board, extract the SD card and load ``boot.bin`` onto it manually. 2. Insert the SD card back into the board. -3. Ensure that the DIP switches (labeled BOOT MODE) are set correctly, to SD. +3. Set to boot from SD card: + + - For Kasli-SoC or ZC706, ensure that the DIP switches (labeled BOOT MODE) are set correctly, to SD. + - For EBAZ4205, set up the `boot select resistor `_ to boot from SD card. + 4. Power the board back on. Optionally, the SD card may also be loaded at the same time with an additional file ``config.txt``, which can contain preset configuration values in the format ``key=value``, one per line. The keys are those used with :mod:`~artiq.frontend.artiq_coremgmt`. This allows e.g. presetting an IP address and any other configuration information. @@ -219,7 +223,7 @@ After a successful boot, the "FPGA DONE" light should be illuminated and the boa Booting over JTAG/Ethernet """""""""""""""""""""""""" -It is also possible to boot Zynq devices over USB and Ethernet. Flip the DIP switches to JTAG. The scripts ``remote_run.sh`` and ``local_run.sh`` in the ARTIQ-Zynq repository, intended for use with a remote JTAG server or a local connection to the core device respectively, are used at M-Labs to accomplish this. Both make use of the netboot tool ``artiq_netboot``, see also its source `here `__, which is included in the ARTIQ-Zynq development environment. Adapt the relevant script to your system or read it closely to understand the options and the commands being run; note for example that ``remote_run.sh`` as written only supports ZC706. +It is also possible to boot :ref:`Zynq devices ` over USB and Ethernet (EBAZ4205 not currently supported). Flip the DIP switches to JTAG. The scripts ``remote_run.sh`` and ``local_run.sh`` in the ARTIQ-Zynq repository, intended for use with a remote JTAG server or a local connection to the core device respectively, are used at M-Labs to accomplish this. Both make use of the netboot tool ``artiq_netboot``, see also its source `here `__, which is included in the ARTIQ-Zynq development environment. Adapt the relevant script to your system or read it closely to understand the options and the commands being run; note for example that ``remote_run.sh`` as written only supports ZC706. You will need to generate the gateware, firmware and bootloader first, either through ``nix build`` or incrementally as below. After an incremental build add the option ``-i`` when running either of the scripts. If using ``nix build``, note that target names of the form ``--jtag`` (run ``nix flake show`` to see all targets) will output the three necessary files without combining them into ``boot.bin``. @@ -246,7 +250,13 @@ For ZC706: $ gateware/zc706.py -g ../build/gateware -V $ make TARGET=zc706 GWARGS="-V " -where ``fw-type`` is ``runtime`` for standalone or DRTIO master builds and ``satman`` for DRTIO satellites. Both the gateware and the firmware will generate into the ``../build`` destination directory. At this stage you can :ref:`boot from JTAG `; either of the ``*_run.sh`` scripts will expect the gateware and firmware files at their default locations, and the ``szl.elf`` bootloader is retrieved automatically. +For EBAZ4205: + :: + + $ gateware/ebaz4205.py -g ../build/gateware -V + $ make TARGET=ebaz4205 GWARGS="-V " + +where ``fw-type`` is ``runtime`` for standalone or DRTIO master builds and ``satman`` for DRTIO satellites. Both the gateware and the firmware will generate into the ``../build`` destination directory. At this stage, if supported, you can :ref:`boot from JTAG `; either of the ``*_run.sh`` scripts will expect the gateware and firmware files at their default locations, and the ``szl.elf`` bootloader is retrieved automatically. If you prefer to boot from SD card, you will need to construct your own ``boot.bin``. Build ``szl.elf`` from source by running a command of the form: :: diff --git a/doc/manual/configuring.rst b/doc/manual/configuring.rst index 219e37ce4..998344f24 100644 --- a/doc/manual/configuring.rst +++ b/doc/manual/configuring.rst @@ -55,6 +55,9 @@ For Kasli-SoC: For ZC706: If the ``ip`` config is not set, ZC706 firmware defaults to using the IP address ``192.168.1.52``. +For EBAZ4205: + If the ``ip`` config is not set, EBAZ4205 firmware defaults to using the IP address ``192.168.1.57``. + For Kasli or KC705: If the ``ip`` config field is not set or set to ``use_dhcp``, the device will attempt to obtain an IP address and default gateway using DHCP. The chosen IP address will be in log output, which can be accessed via the :ref:`UART log `. diff --git a/doc/manual/core_device.rst b/doc/manual/core_device.rst index ef4859141..b55c638be 100644 --- a/doc/manual/core_device.rst +++ b/doc/manual/core_device.rst @@ -39,7 +39,7 @@ The core device reserves some storage space (either flash or directly on SD card ``device_map`` If set, allows the core log to connect RTIO channels to device names and use device names as well as channel numbers in log output. A correctly formatted table can be automatically generated with :mod:`~artiq.frontend.artiq_rtiomap`, see :ref:`Utilities`. ``net_trace`` - If set to ``1``, will activate net trace (print all packets sent and received to UART and core log). This will considerably slow down all network response from the core. Not applicable for ARTIQ-Zynq (Kasli-SoC, ZC706). + If set to ``1``, will activate net trace (print all packets sent and received to UART and core log). This will considerably slow down all network response from the core. Not applicable for ARTIQ-Zynq (see :ref:`Zynq devices `). ``panic_reset`` If set to ``1``, core device will restart automatically. Not applicable for ARTIQ-Zynq. ``no_flash_boot`` @@ -106,6 +106,27 @@ If not using WRPLL, PLL can also be bypassed entirely with the options Bypassing the PLL ensures the skews between input clock, downstream clock outputs, and RTIO clock are deterministic across reboots of the system. This is useful when phase determinism is required in situations where the reference clock fans out to other devices before reaching the master. +.. _types-of-boards: + +Types of boards +--------------- + +To clarify the terminology used in ARTIQ, we can distinguish the boards into a few key groups. There are two primary ways to categorize them. The first is based on the ARTIQ platform itself: either ARTIQ or ARTIQ-Zynq. ARTIQ-Zynq boards specifically refer to those that feature a Xilinx Zynq FPGA. The second distinction is based on how the boards are configured: some use a :ref:`JSON system description file `, while others do not. + +Below are the current groups of boards: + +.. _devices-table: + ++------------------------------+------------------------------+ +| **Device Type** | **Devices** | ++==============================+==============================+ +| Zynq devices | Kasli-SoC, ZC706, EBAZ4205 | ++------------------------------+------------------------------+ +| JSON variant devices | Kasli, Kasli-SoC | ++------------------------------+------------------------------+ +| Hardcoded variant devices | KC705, ZC706, EBAZ4205 | ++------------------------------+------------------------------+ + Board details ------------- diff --git a/doc/manual/extending_rtio.rst b/doc/manual/extending_rtio.rst index 707a13e3a..b3347f9e2 100644 --- a/doc/manual/extending_rtio.rst +++ b/doc/manual/extending_rtio.rst @@ -37,7 +37,7 @@ Introduction to the ARTIQ internal stack \draw[primary, -Stealth] (gateware) to (firmware); \draw[primary, -Stealth] (hardware) to (gateware); -Like any other modern piece of software, kernel code running on an ARTIQ core device rests upon a layered infrastructure, starting with the hardware: the physical carrier board and its peripherals. Generally, though not exclusively, this is the `Sinara device family `_, which is designed to work with ARTIQ. Other carrier boards, such as the Xilinx KC705 and ZC706, are also supported. +Like any other modern piece of software, kernel code running on an ARTIQ core device rests upon a layered infrastructure, starting with the hardware: the physical carrier board and its peripherals. Generally, though not exclusively, this is the `Sinara device family `_, which is designed to work with ARTIQ. Other carrier boards, such as the :ref:`Hardcoded variant devices `, are also supported. All of the ARTIQ core device carrier boards necessarily center around a physical field-programmable gate array, or FPGA. If you have never worked with FPGAs before, it is easiest to understand them as 'rearrangeable' circuits. Ideally, they are capable of approaching the tremendous speed and timing precision advantages of custom-designed, application-specific hardware, while still being reprogrammable, allowing development and revision to continue after manufacturing. @@ -59,7 +59,7 @@ As briefly explained in :doc:`rtio`, when we talk about RTIO infrastructure, we .. warning:: Note that FPGA resources are finite, and buffer sizes, lane counts, etc., are generally chosen to maximize available resources already, with different values depending on the core device in use. Depending on the peripherals you include (some are more resource-intensive than others) blanket increases will likely quickly outstrip the capacity of your FPGA and fail to build. Increasing the depth of a particular channel you know to be heavily used is more likely to succeed; the easiest way to find out is to attempt the build and observe what results. -Gateware in ARTIQ is housed in ``artiq/gateware`` on the main ARTIQ repository and (for Zynq-specific additions) in ``artiq-zynq/src/gateware`` on ARTIQ-Zynq. The starting point for figuring out your changes will often be the *target file*, which is core device-specific and which you may recognize as the primary module called when building gateware. Depending on your core device, simply track down the file named after it, as in ``kasli.py``, ``kasli_soc.py``, and so on. Note that the Kasli and Kasli-SoC targets are designed to take JSON description files as input, whereas their KC705 and ZC706 equivalents work with hardcoded variants instead. +Gateware in ARTIQ is housed in ``artiq/gateware`` on the main ARTIQ repository and (for Zynq-specific additions) in ``artiq-zynq/src/gateware`` on ARTIQ-Zynq. The starting point for figuring out your changes will often be the *target file*, which is core device-specific and which you may recognize as the primary module called when building gateware. Depending on your core device, simply track down the file named after it, as in ``kasli.py``, ``kasli_soc.py``, and so on. Note that the Kasli and Kasli-SoC targets are designed to take JSON description files as input (see :ref:`JSON variant devices `), whereas their KC705, ZC706 and EBAZ4205 (see :ref:`Hardcoded variant devices `) equivalents work with hardcoded variants instead. To change parameters related to particular peripherals, see also the files ``eem.py`` and ``eem_7series.py``, which describe the core device's interface with other EEM cards in Migen terms, and contain ``add_std`` methods that in turn reference specific gateware modules and assign RTIO channels. @@ -279,7 +279,7 @@ Adding a custom EEM ------------------- .. note:: - Adding a custom EEM to a Kasli or Kasli-SoC system is not much more difficult than adding new gateware logic for existing hardware, and may in some cases be simpler, if no custom PHY is required. On the other hand, modifying hardware in KC705 or ZC706-based systems is a different process, and gateware generation for these boards does not use the files and modules described below. Creating new KC705 or ZC706 variants is not directly addressed in this tutorial. That said, it would begin and end largely in the respective target file, where the variants are defined. + Adding a custom EEM to a Kasli or Kasli-SoC system is not much more difficult than adding new gateware logic for existing hardware, and may in some cases be simpler, if no custom PHY is required. On the other hand, modifying :ref:`Hardcoded variant devices ` is a different process, and gateware generation for these boards does not use the files and modules described below. Creating new hardcoded variants is not directly addressed in this tutorial. That said, it would begin and end largely in the respective target file, where the variants are defined. Non-realtime hardware which does not need to connect directly to the core device or require gateware support should instead be handled through an NDSP, see :doc:`developing_a_ndsp`. This is a more accessible process in general and does not vary based on core device. @@ -330,7 +330,7 @@ Now your EEM is fully supported by the ARTIQ gateware infrastructure. All that r Target file and system description ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -In the :ref:`extending-gateware-logic` tutorial above, we made modifications directly to the target file, to hardcode a certain PHY for a certain set of pads. This is reasonable to do in the case of the core device LEDs, which are always present and cannot be rearranged. It is theoretically possible to hardcode the addition of your new EEM in the same way. In this case it would not be necessary to make modifications to ``eem.py`` and ``eem_7series.py``; the pad assignments, requisite PHYs, and RTIO channels could all be defined directly in the target file. This is essentially how things are done for KC705 and ZC706 variants. +In the :ref:`extending-gateware-logic` tutorial above, we made modifications directly to the target file, to hardcode a certain PHY for a certain set of pads. This is reasonable to do in the case of the core device LEDs, which are always present and cannot be rearranged. It is theoretically possible to hardcode the addition of your new EEM in the same way. In this case it would not be necessary to make modifications to ``eem.py`` and ``eem_7series.py``; the pad assignments, requisite PHYs, and RTIO channels could all be defined directly in the target file. This is essentially how things are done for :ref:`Hardcoded variant devices `. However, with EEM cards, which can be present in different numbers and rearranged at will, it is preferable to be more flexible. This is the reason system description files are used. Assuming you have added your EEM to ``eem.py`` and the ``peripheral_processors`` dictionary, no modifications to the target file are actually necessarily. All Kasli and Kasli-SoC targets already contain the line: :: diff --git a/doc/manual/flashing.rst b/doc/manual/flashing.rst index 00301e5c2..abfc5ec13 100644 --- a/doc/manual/flashing.rst +++ b/doc/manual/flashing.rst @@ -17,7 +17,7 @@ Run the command:: Replace ```` with the login name that was given to you with the subscription, ```` with the name of your system variant, and ```` with the name of an empty directory, which will be created by the command if it does not exist. Enter your password when prompted and wait for the build (if applicable) and download to finish. If you experience issues with the AFWS client, write to the helpdesk@ email. For more information about :mod:`~artiq.frontend.afws_client` see also the corresponding entry on the :ref:`Utilities ` page. -For certain configurations (KC705, ZC706, or EBAZ4205 only) it is also possible to source firmware from `the M-Labs Hydra server `_ (in ``main``, ``zynq`` and ``zynq`` respectively). +For :ref:`hardcoded variant devices ` it is also possible to source firmware from `the M-Labs Hydra server `_ (in ``main`` and ``zynq``). Without a subscription, you may build the firmware yourself from the open source code. See the section :doc:`building_developing`. @@ -25,7 +25,7 @@ Installing and configuring OpenOCD ---------------------------------- .. warning:: - These instructions are not applicable to Zynq devices (Kasli-SoC, ZC706 or EBAZ4205), which do not use the utility :mod:`~artiq.frontend.artiq_flash`. If your core device is a Zynq device, skip straight to :ref:`writing-flash`. + These instructions are not applicable to :ref:`Zynq devices `, which do not use the utility :mod:`~artiq.frontend.artiq_flash`. If your core device is a Zynq device, skip straight to :ref:`writing-flash`. ARTIQ supplies the utility :mod:`~artiq.frontend.artiq_flash`, which uses OpenOCD to write the binary images into an FPGA board's flash memory. For both Nix and MSYS2, OpenOCD are included with the installation by default. Note that in the case of Nix this is the package ``artiq.openocd-bscanspi`` and not ``pkgs.openocd``; the second is OpenOCD from the Nix package collection, which does not support ARTIQ/Sinara boards. @@ -78,7 +78,7 @@ On Windows Writing the flash ----------------- -First ensure the board is connected to your computer. In the case of Kasli, the JTAG adapter is integrated into the Kasli board; for flashing (and debugging) you can simply connect your computer to the micro-USB connector on the Kasli front panel. For Kasli-SoC, ZC706, or EBAZ4205, which use :mod:`~artiq.frontend.artiq_coremgmt` to flash over network, an Ethernet connection and an IP address, supplied either with the ``-D`` option or in your :ref:`device database `, are sufficient. +First ensure the board is connected to your computer. In the case of Kasli, the JTAG adapter is integrated into the Kasli board; for flashing (and debugging) you can simply connect your computer to the micro-USB connector on the Kasli front panel. For :ref:`Zynq devices `, which use :mod:`~artiq.frontend.artiq_coremgmt` to flash over network, an Ethernet connection and an IP address, supplied either with the ``-D`` option or in your :ref:`device database `, are sufficient. For Kasli-SoC, ZC706 or EBAZ4205: ::