<commit_before>

# 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.

 * `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.

# 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<commit_msg>Adding some spacing to notes.<commit_after>

# 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.

 * `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>

# 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
{'fraction_non_alphanumeric': 0.0770042194092827, 'fraction_numerical': 0.004822182037371911, 'mean_word_length': 3.232780612244898, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1826030', 'n_tokens_mistral': 2012, 'n_tokens_neox': 1869, 'n_words': 836}