diff --git a/boards/beaglev/fire/05-demos.rst b/boards/beaglev/fire/05-demos.rst index ad003fa2421b6a35b6beb8ca5f34e62ec61daac1..56b95dc0c02c5dc147c305615bbcc5b84d0c2315 100644 --- a/boards/beaglev/fire/05-demos.rst +++ b/boards/beaglev/fire/05-demos.rst @@ -18,3 +18,4 @@ Demos demos-and-tutorials/mchp-fpga-tools-installation-guide demos-and-tutorials/gateware/index demos-and-tutorials/gateware/how-to-find-out-whats-on-the-board + demos-and-tutorials/gateware/gateware-full-flow diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/gateware-full-flow.rst b/boards/beaglev/fire/demos-and-tutorials/gateware/gateware-full-flow.rst new file mode 100644 index 0000000000000000000000000000000000000000..e00bea74049d8922da4241d1bb15568a6159fa66 --- /dev/null +++ b/boards/beaglev/fire/demos-and-tutorials/gateware/gateware-full-flow.rst @@ -0,0 +1,80 @@ +Gateware Full Build Flow +######################## + +Introduction +============ + +BeagleV-Fire gateware is made up of several components: + +- Digital design for the FPGA fabric. +- Microprocessor Subsystem (MSS) configuration containing MSS configuration register values. +- A zero stage bootloader (HSS). +- A set of device tree ovelays describing the content of the FPGA fabric. + +The FPGA's digital design is a combination of: + +- HDL/Verilog source code +- TCL scripts configuring IP blocks +- TCL scripts stiching IP blocks together +- Microprocessor Subsystem (MSS) configuration describing the MSS port list +- Pin, placement and timing constraints + +The Hart Software Service (HSS) zero stage bootloader + +- Configures the PolarFire SoC chip. +- Retrieves the next boot stage from eMMC and hand-over to the next boot stage (e.g. u-boot) +- Makes the board appear as a USB mass-storage for populating the eMMC with secondary boot-loader and operating system image. + +The chip configuration applied by the HSS icludes the configuration of: + +- Clocks +- Memory controllers +- IOs +- Transceivers + +Of course all these components need to be in synch with each other for the system to work properly. +This is the reason for using a gateware build system rather than building and tracking each component individually. + +.. figure:: media/Gateware-Flow-bitstream-builder-full-picture.png + :align: center + :alt: BeagleV-Fire Gateware Full Build Flow + +Programming artifacts +===================== + +The gateware builder for BeagleV-Fire produces two programming artifacts: + +- A bitstream containing the FPGA fabric and eNVM programming +- A device tree overlay describing the FPGA content. + +These two artifacts are packaged differently depending on the programming method. They are merged +into a single programming file for DirectC (.dat) and FlashPro Express (.job). They are kept +separate for Linux programming (mpfs_bitstream.spi and mpfs_dtbo.spi). + +Programming BeagleV-Fire with new gateware +========================================== + +There are several methods possible for programming the BeagleV-Fire with new gateware: + +- Linux script executed on the BeagleV-Fire board. +- Running DirectC on anothe single board computer +- Using Microchip's FlashPro Express + +Linux script +------------ +This is the recommended approach. It does not require any additional hardware. Simply run the script +located in /usr/share/beagleboard/gateware. You should use this methods unless you have soft-bricked +your BeagleV-Fire. + +DirectC +------- +This approach uses a single board computer (SBC) connected to the BeagleV-Fire JTAG port. The SBC +bit-bangs the FPGA programming protocol over GPIOs. This approach is only required for recovering +a soft-bricked BeagleV-Fire. + +FlashPro Express +---------------- +This approach uses Microchip's FlashPro Express programming software and a FlashPro6 JTAG programmer. +I would recommend using the Linux script even if you are an existing Microchip FPGA user with all the +tools. This approach makes most sense when doing bare metal software development and already have a +FlashPro programmer and don't care about device tree overlays. diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/gateware-tcl-scripts-structure.rst b/boards/beaglev/fire/demos-and-tutorials/gateware/gateware-tcl-scripts-structure.rst new file mode 100644 index 0000000000000000000000000000000000000000..31c9bc75051bbe6fe076d34008125ac9565a9115 --- /dev/null +++ b/boards/beaglev/fire/demos-and-tutorials/gateware/gateware-tcl-scripts-structure.rst @@ -0,0 +1,82 @@ +Gateware TCL Scripts Structure +############################## + +This document describes the structure of the gateware TCL scripts. It is of interest to understand +how to extend or customize the gateware. + +The `Libero SoC TCL Command Reference Guide <https://coredocs.s3.amazonaws.com/Libero/2023_2/Tool/libero_soc_tcl_cmd_ref_ug.pdf>`_ describes the TCL command used in the gateware scripts. + +Gateware Project +================ + +The gateware project is made up of: + +- TCL scripts +- HDL/Verilog source code +- IO pin constraints +- Placement constraints +- Device tree overlays + +All these files are found in the FPGA-design directory. + +.. figure:: media/gateware-source-dir.png + :align: center + + +Gateware Components +=================== + +The gateware is organized into 6 components: + +- Clocks and reset control +- A base RISC-V microprocessor subsystem +- Cape interface +- M.2 interface +- MIPI camera interface +- SYZYGY high speed interface + +.. figure:: media/gateware-components.png + :align: center + +Gateware Build Options +====================== + +Each interface component may have a number of build options. For example, which cape will be +supported by the generated gateware. + + +.. figure:: media/gateware-cape-options.png + :align: center + +The name of the directories within the component's directory are the option names passed to the +top Libero BUILD_BVF_GATEWATE.tcl script. These directory names are the option name specified in +the bitstream builder's build option YAML files. + +The gateware is extended or customized by creating additional directories within the component +directory of interest. For example, add a MY_CUSTOM_CAPE directory under the CAPE directory to +add a gateware build option to support a custom cape. + +Gateware Component Directories +============================== + +The component directory contains subdirectories for: + +- Constraint files +- Device tree overlay +- Optional HDL/Verilog source code + +.. figure:: media/gateware-cape-robotics-dirs.png + :align: center + +Gareware TCL Scripts +-------------------- + +The component directory contains the TCL scripts executed by Libero to generate the gateware. +The TCL script framework executes a hand-crafted ADD_<COMPONENT_NAME>.tcl script which instantiates +the component and stiches it to the base RISC-V subsystem and top level IOs. The other TCL scripts +are typically IP configuration scripts and SmartDesign stiching scripts. + +.. figure:: media/gateware-cape-robotics-files.png + :align: center + + diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/media/Gateware-Flow-bitstream-builder-full-picture.png b/boards/beaglev/fire/demos-and-tutorials/gateware/media/Gateware-Flow-bitstream-builder-full-picture.png index 7d37d3d8d7cb97d37cbe908ac39f4fae7c068d55..e9517d622f82ca36ae5472721a0bba6d59e654a7 100644 Binary files a/boards/beaglev/fire/demos-and-tutorials/gateware/media/Gateware-Flow-bitstream-builder-full-picture.png and b/boards/beaglev/fire/demos-and-tutorials/gateware/media/Gateware-Flow-bitstream-builder-full-picture.png differ diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-options.png b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-options.png new file mode 100644 index 0000000000000000000000000000000000000000..0c71ea6c2fa6dedc5605084b74ba8df00873db70 Binary files /dev/null and b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-options.png differ diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-robotics-dirs.png b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-robotics-dirs.png new file mode 100644 index 0000000000000000000000000000000000000000..3af9d01451c9252b2cd6398cf61b3ad82660f392 Binary files /dev/null and b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-robotics-dirs.png differ diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-robotics-files.png b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-robotics-files.png new file mode 100644 index 0000000000000000000000000000000000000000..06af36e0feb7f9a68d2152680b70bb2009cc04ec Binary files /dev/null and b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-cape-robotics-files.png differ diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-components.png b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-components.png new file mode 100644 index 0000000000000000000000000000000000000000..57f97ee580ed516db044a33d1071511c0e945faf Binary files /dev/null and b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-components.png differ diff --git a/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-source-dir.png b/boards/beaglev/fire/demos-and-tutorials/gateware/media/gateware-source-dir.png new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/books/beaglebone-cookbook/11misc/misc.rst b/books/beaglebone-cookbook/11misc/misc.rst index db5c6c06a9433068b2b425b6a64c3bad396cb76c..a0681fecbfa14ea96b3341f6a561b4b81c9dcd2a 100644 --- a/books/beaglebone-cookbook/11misc/misc.rst +++ b/books/beaglebone-cookbook/11misc/misc.rst @@ -704,10 +704,50 @@ Now, sync changes with upstream: bone$ git fetch upstream bone$ git pull upstream main +Using Docker (Podman) +^^^^^^^^^^^^^^^^^^^^^ +It is probably easies to use docker (or podman) if you are already familiar with container workflow. +The repository contains a helper script `docker-build-env.sh` which creates ephemeral container and drops you into bash inside. The project is mouted at `/build/docs.beagleboard.org`. + + +.. note:: + + This section of docs assume that you are using rootless docker or podman. In case of rootful docker, you might run into permission issues + +.. code-block:: bash + + ./docker-build-env.sh + cd /build/docs.beagleboard.org + make clean + +To generate HTML output of docs: + +.. code-block:: bash + + make html + +To generate PDF output of docs: + +.. code-block:: bash + + make latexpdf + +To preview docs on your local machine: + +.. code-block:: bash + + python3 -m http.server -d _build/html/ + + Downloading Sphinx ^^^^^^^^^^^^^^^^^^ -Run the following to download Sphinx. Note: This will take a while, it loads -some 6G bytes. +Skip this section if you are using docker as shown above. + +Run the following to download and setup Sphinx locally. + +.. note:: + + This will take a while, it loads some 6G bytes. .. code-block:: bash