Skip to content

Commit

Permalink
Merge pull request #456 from mithro/doc-move
Browse files Browse the repository at this point in the history
Reworking the documentation
  • Loading branch information
mithro committed Sep 2, 2018
2 parents 2b3ff04 + a93a7bd commit e260e6e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 804 deletions.
144 changes: 43 additions & 101 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,71 @@
# HDMI2USB LiteX Firmware
# LiteX Build Environment

## Quick Links

* [HDMI2USB user documentation](http://hdmi2usb.tv/)
* [HDMI2USB Firmware documentation](https://hdmi2usb.tv/firmware-misoc)
* [Report a bug](https://github.com/timvideos/HDMI2USB-misoc-firmware/issues/new)
* [misoc + migen website](http://m-labs.hk/gateware.html)

# Table of contents

* Overview
* HDMI2USB LiteX Firmware
* Supported Boards
* In Progress Boards
* Other Boards
* Getting started
* Documentation
* License
* Contact

# Overview

**The HDMI2USB project develops affordable hardware options to record and
stream HD videos (from HDMI & DisplayPort sources) for conferences, meetings
and user groups.**

We are currently developing our own hardware (the
[Numato Opsis](https://hdmi2usb.tv/numato-opsis), and also provide firmware for
various prototyping boards.

HDMI2USB started in 2013, and is an active ongoing project in its third
iteration of hardware prototyping. Today you can download early working
firmware and have real capture happen, but we actively wish to improve and are
seeking assistance:

* **For video recording individuals+teams:** Be an early adopter; get a
board, start using it, report back to us with feedback

* **For software/FPGA developers:** Get involved in contributing code both to
the capture software + FPGA stack

Our aim is this becomes the defacto, incredibly affordable and easy to use
video recording hardware for conferences, meetings and user groups worldwide.
[The LiteX Build Environment](https://github.com/timvideos/litex-buildenv)
is a tool for easily developing
[LiteX](https://github.com/enjoy-digital/litex) based systems. It was
originally designed to make the [TimVideos' HDMI2USB](https://hdmi2usb.tv) easy
to develop, but has now expanded to support multiple projects.

**Find out more about HDMI2USB and why we're doing this in [ABOUT + FAQ](http://hdmi2usb.tv/faq)**

![HDMI2USB Diagram](https://hdmi2usb.tv/img/hdmi2usb.png "HDMI2USB Diagram")

# HDMI2USB LiteX Firmware

## Supported Boards

This firmware is supported on the following to boards for capturing
conferences;


* [Digilent Atlys](https://hdmi2usb.tv/digilent-atlys/) - `PLATFORM=atlys` - http://digilentinc.com/atlys/

The original board used for HDMI2USB prototyping.

![Digilent Atlys Picture](https://hdmi2usb.tv/img/digilent-atlys-small.jpg)

* [Numato Opsis](https://hdmi2usb.tv/numato-opsis/) - `PLATFORM=opsis` - https://numato.com/product/numato-opsis-fpga-based-open-video-platform

The first production board made in conjunction with TimVideos.us project.
## Quick Links

![Numato Opsis Picture](https://hdmi2usb.tv/img/numato-opsis-small.jpg)
* [LiteX Build Environment Wiki](https://github.com/timvideos/litex-buildenv/wiki)
* [Getting Started Guide](https://github.com/timvideos/litex-buildenv/wiki/Getting-Started)

For a comparison between the supported boards, see the
[HDMI2USB Hardware page](https://hdmi2usb.tv/hardware/).
* TBD: [LiteX Build Environment Docs](https://litex-buildenv.readthedocs.io)

## In Progress Boards
* Dependency documentation
- Migen - [[Website](http://m-labs.hk/migen/index.html)] [[User Guide](http://m-labs.hk/migen/manual/)] [[Code Repository](https://github.com/m-labs/migen)]
- [Enjoy Digital Website](http://www.enjoy-digital.fr/)
- [LiteX GitHub Repository](https://github.com/enjoy-digital/litex)

The following boards are under development for conference capture;
* Projects using LiteX Build Environment:
- [HDMI2USB](http://hdmi2usb.tv/) - The HDMI2USB project develops affordable hardware options to record and stream HD videos (from HDMI & DisplayPort sources) for conferences, meetings and user groups.
- [FuPy](https://fupy.github.io) - The aim of the FuPy project is to make MicroPython run on FPGAs using the LiteX & Migen+MiSoC technologies. This allows you to do full stack development (FPGA gateware & soft CPU firmware) in Python!

* Digilent Nexys Video
* Alphamax NeTV2
---

## Other Boards
## Important Terminology

The following boards are useful for development but *not* conference capture;
* [Gateware](https://github.com/litex-buildenv/wiki/Gateware) - The FPGA configuration.
* [Soft CPU](https://github.com/litex-buildenv/wiki/Soft-CPU) - A CPU running inside the FPGA.
* [Firmware](https://github.com/litex-buildenv/wiki/Firmware) - The software running on the `soft CPU` inside the FPGA.

* Saanlima Pipistrello - http://pipistrello.saanlima.com/
## Structure

`PLATFORM=pipistrello`
![LiteX BuildEnv Structure Image](https://docs.google.com/drawings/d/e/2PACX-1vTfB_DQ3PXJWKrERnzkGoWdKsTfuI3Kk-9rF1oBDB8NM44qZefU_O_H7rdNoN5cIWZmqzfIm1ftz52B/pub?w=419&h=485)

A small FPGA board with only one HDMI output port.
Due to the lack of video *inputs*, this board is only useful for developers.
## [Boards](https://github.com/litex-buildenv/wiki/Boards)

* ScarabHardware miniSpartan6+ - https://www.scarabhardware.com/minispartan6/
The LiteX Build Environment supports a
[large number of FPGA boards](https://github.com/litex-buildenv/wiki/Boards),
but not all boards can be used for all projects.

`PLATFORM=miniSpartan`
## [Firmware](https://github.com/litex-buildenv/wiki/Firmware)

A small FPGA board with HDMI input and HDMI output.
Due to the low speed ram and USB interface, this board is only useful for
developers who want to work on the HDMI subsystem and need a small board
that fits in their pocket.
* [HDMI2USB](https://github.com/litex-buildenv/wiki/HDMI2USB) - The firmware currently used for the HDMI2USB project.
* [Bare Metal](https://github.com/litex-buildenv/wiki/Bare-Metal) - Your own firmware running directly on the soft CPU in the FPGA.
* [Zephyr](https://github.com/litex-buildenv/wiki/Zephyr) - Support for [Zephyr RTOS](https://www.zephyrproject.org/).
* [Linux](https://github.com/litex-buildenv/wiki/Linux) - Support for Linux.

* Numato MimasV2 - https://numato.com/mimas-v2-spartan-6-fpga-development-board-with-ddr-sdram/
## [Gateware](https://github.com/litex-buildenv/wiki/Gateware)

`PLATFORM=mimasv2`
FIXME: Put stuff here.

A small, cheap FPGA board with a Spartan 6 and DDR RAM. Due to the lack of
video input and high speed data interfaces this board can't be used for
capture. It can however be used for development of non-capture related
firmware features and experimenting with FPGA development.
## [Environment](https://github.com/litex-buildenv/wiki/Environment)

# Getting started
FIXME: Put stuff here.

For **using** a HDMI2USB board, prebuilt versions of the firmware are available in
the
[HDMI2USB-firmware-prebuilt](http://github.com/timvideos/HDMI2USB-firmware-prebuilt)
repository.
## [Applications](https://github.com/litex-buildenv/wiki/Applications)

For **helping with the development**, instructions for setting up the build
environment are found in the [getting-started.md](getting-started.md) file.
FIXME: Put stuff here.

# Documentation
![LiteX Application Relationship](https://docs.google.com/drawings/d/e/2PACX-1vTLVQXwkH3p5ZvN-7nIMxRXOyFEsg2x5_yrd3wREw3vaWr3Mc-_P7kfTbeQ--BN0k5VjQgxHchliyno/pub?w=1398&h=838)

**User** documentation is found on the [HDMI2USB website](https://hdmi2usb.tv).
## [Other Topics](https://github.com/litex-buildenv/wiki/Other-Topics)

High level **developer** documentation for the firmware can be found in the
[doc](doc/) directory. More documentation is found in the source code.
FIXME: Put stuff here.

![System Diagram](doc/architecture.png)
---

# License

Expand Down
216 changes: 2 additions & 214 deletions doc/notes.md
Original file line number Diff line number Diff line change
@@ -1,221 +1,9 @@


# Setting up the environment

### Step 1 - If your board requires a proprietary toolchain, install that.

* Spartan 6 based boards require [Xilinx ISE]().
Xilinx ISE is a propitary toolchain which *must be installed manually*.

This is *most* boards, including
- MimasV2,
- Opsis,
- Atlys,
- Pipistrello,
- TODO: minispartan6/minispartan6+

* "Series 7" based boards require [Xilinx Vivado]().
Xilinx Vivado is a propitary toolchain which *must be installed manually*.

These boards include;
- NeTV2,
- Nexys_Video,
- TODO: Arty

* TODO: Cyclone V based boards require [Altera Quatras]()
Altera Quatras is a propitary toolchain which *must be installed manually*.

These boards include;
- De Nano???

* TODO: ICE40 based boards require [Yosys, Anancr-PNR]().
[XXXX] is an open source toolchain which can be installed automatically.

These boards include;
- IceStick?
- ???

### Step 2 - Install required system packages

* `download-env-root.sh` does this.

Bunch of packages are needed;
* Libraries for talking to USB - libftdi, libusb, fxload

* udev rules.

* Kernel modules for some boards. Mostly not needed....

### Step 3 - Setup a self contained environment.

* `download-env.sh` does this.

The steps are;
- Get conda.
Conda is a self contained Python install, kind of like virtualenv but
includes the ability to install precompiled binary packages.

- Install precompiled C compiler toolchain from TimVideos Conda repo. This
includes; binutils, gcc and gdb.

- The C compiler toolchain is needed for compiling the BIOS and firmware.

- Install precompiled JTAG tool from from TimVideos Conda repo. The tool we
use is openocd.

- Install dependent Python packages (from pip/conda/elsewhere). Things like
pyserial and stuff.

- Install tools for simulation and testing. Things like verilator.

- Install tools for helping manage FPGA boards. Things like
HDMI2USB-mode-switch, MimasV2Config.py, flterm.

- Initialising submodules and install litex packages from `third_party/`.

This is completely contained in the `build/conda` directory. Removing that
directory will totally remove the installed environment.

### Step 4 - Enter self contained environment & set environment variables.
* If you installed Xilinx to anywhere other than `/opt/Xilinx/`, run
`export XILINX_DIR=<path>`. This must be set before entering the
environment, as it is not updated from within it.
* `source scripts/enter-env.sh` - enter-env checks that your environment is
setup correctly and contains all the dependencies you need.

* `export PLATFORM=<platform>` - Default is Opsis
* `export TARGET=<targetname>` - Default is dependent on the platform.

# After entering environment

### Build `gateware` for the FPGA

* `make gateware`

### Load or Flash `gateware` onto the FPGA

* This step is board specific.

<br>
<br>
<br>
<hr>
<br>
<br>
<br>
[This info has moved to the LiteX Build Environment Wiki's Environment page](https://github.com/timvideos/litex-buildenv/wiki/Environment#setting-up-the-environment)

# Random Comments

## `Firmware` verses `Gateware`

* `gateware` is for configuration of the FPGA. It is the "hardware
description".

* `firmware` is software which runs on a CPU (it can be either `SoftCPU` or
`HardCPU`).

* The `gateware` can include a `SoftCPU` which runs `firmware`.

* Most HDMI2USB boards have two `firmware` blobs,
- firmware which runs on the SoftCPU inside the gateware,
- firmware which runs on the Cypress FX2 USB interface chip attached to the
FPGA.

## `Migen`, `MiSoC`, `LiteX` & `LiteXXX`

* `Migen` is the `Python HDL` which allows easy creation of gateware to run on
an FPGA. It includes all the primitives needed to write things for the FPGA

* `MiSoC` is a `SoC` (System on Chip) which uses `Migen`. It includes;
- Multiple `SoftCPU` implementations,
- a `CSR` (Config/Control Status Registers) bus
- Bunch of peripherals

* `LiteX` is @enjoy-digital 's *soft* fork of `Migen+MiSoC`.
- LiteX combines both `Migen+MiSoC` into one repo.
- LiteX includes legacy features removed from Migen+MiSoC which are still in
use.
- LiteX includes more experimental features that have not made it to
Migen/MiSoC (and may never make it into Migen/MiSoC).
- LiteX code should be *easily* portable to Migen/MiSoC if
legacy/experimental features are not used and is done regularly.

* LiteEth, LiteDRAM, liteSATA, litePCIe are all cores which provide
functionality.

- LiteEth is heavily used inside liteX


## `SoftCPU` verses `HardCPU`

* A `SoftCPU` is a CPU which is defined by a HDL (like Verilog, VHDL or Migen)
and is included in the gateware inside a FPGA. As the definition can be
changed when creating the gateware, `SoftCPU`s are highly customisable.

* A `HardCPU` is a CPU which is predefined piece of hardware. As it physical
hardware it can't be changed.

* Most manufactures sell chips which include a FPGA fabric and a `HardCPU` in
one package.
- These are often called `SoC` (System on Chip) FPGAs.
- Generally the `HardCPU` is an ARM these days. (Although PowerPC was
previously fairly common.)
- Xilinx's range is called the `Zynq`.
- Altera have the Cyclone V `SoC` series.

* A `SoftCPU` runs `firmware`.
- Normally the first `firmware` is a small program like a "BIOS" which does
initilisation (like setting up main ram, running memtest, etc) before
loading a more useful firmware into "main ram" and jumping it.

- The "BIOS" is normally embedded inside the gateware. However as this
takes up resources that can't be reused, on smaller boards the BIOS is
executed directly from external flash (normal SPI flash).

- The "BIOS" in MiSoC/LiteX can load the primary firmware from;
* FPGA ROM
* Memory mapped SPI flash
* Serial download (using flterm)
* TFTP (via liteEth)

* There are a bunch of common 32bit `SoftCPU` implementations;
Proprietary `SoftCPU`s are;
- Xilinx's MicroBlaze
- Altera's Nios2

FOSS `SoftCPU`s are;
- LatticeMico32 - lm32
- OpenRisc - mor1k
- Clifford's Pico Risc-V
- J-Core - sh4/sh2 implementation
- ZPU - ???

* MiSoC supports `lm32` and `mor1k`.
* LiteX supports `lm32`, `mor1k` and has WIP support for `pico risc-v` and
(maybe) soon `J-Core`.

## `Flashing` verses `Loading`

* FPGAs (generally) loose their "configuration" when they loose power or are
reset. When powered on they will load their configuration from a flash chip
(normally SPI flash) on the FPGA board.

* `Loading` means to temporarily put something (gateware, firmware, etc) onto
a device. After a power cycle, the device will return to the flashed
configuration.

* `Flashing` means to permanently put something (gateware, firmware, etc)
onto a device. After a power cycle, the device will reload the flashed
configuration.

* Flashing is the process of writing a new configuration to the flash chip.

* Flashing is generally slower than loading because it requires you to erase
the contents of the flash, write the new contents and then verify the
result.

* Flashing is sometimes done by loading a "flash proxy" gateware onto the
FPGA, which then allows the computer to communicate with the flash chip.

* Some devices only support flashing and not loading (IE MimasV2)
[This info has moved to the LiteX Build Environment Wiki's Glossary page](https://github.com/timvideos/litex-buildenv/wiki/Glossary)

0 comments on commit e260e6e

Please sign in to comment.