Using - timvideos/litex-buildenv GitHub Wiki
1) Enter the environment
Before being able to run any of the build steps you must first enter
the
development environment.
Set the type of board you want to use.
export PLATFORM=opsis
Set-up the environment:
cd litex-buildenv
source scripts/enter-env.sh
If your environment is set up correctly your prompt should change to look something like:
(LX P=opsis) #
If your prompt does not change, then check the output to see whether there are any errors.
On failure
You may also find it helpful to rerun the following commands and check those for errors. (These are originally run by the scripts/bootstrap.sh
script recommended for use to set up your environment in the previous step.)
Fix any errors reported (including install failures from apt) before continuing.
cd litex-buildenv
sudo scripts/download-env-root.sh
scripts/download-env.sh
2) Build the gateware
Once you have entered the environment, you can build things.
Building the larger gateware (such as the HDMI2USB target) takes roughly between 5 minutes and 15 minutes on a modern fast machine.
make gateware
At the end of running the build command, you should end up with;
Creating bit map...
Saving bit stream in "top.bit".
Saving bit stream in "top.bin".
Bitstream generation is complete.
Firmware 56008 bytes (9528 bytes left)
The built gateware will be in build/opsis_hdmi2usb_lm32/gateware/
3) Configure your board
Before loading onto your board, you need to ensure that your board is in the correct state.
Configuring the Opsis
To use the Opsis, you need to set the jumpers correctly, connect cables correctly and then put the board into JTAG mode.
FIXME: Put something here about the Opsis.
Jumpers Configuration
The jumpers as set on the Opsis when it ships work.
FIXME: Put picture showing correct jumper configuration.
Cables
The programming computer must be connected to the USB-B port.
JTAG mode
By default the Opsis will boot into HDMI2USB mode. To load gateware onto the board it must be switched into JTAG mode.
FIXME: Add instructions for switching the Opsis into JTAG mode.
-
HDMI2USB-mode-switch then run:
hdmi2usb-mode-switch --mode=jtag
-
Connect to console and use fx2 switch command.
Configuring the Atlys
Before loading the gateware you need to set the jumpers correctly and connect the cables correctly.
FIXME: Put something here about the Atlys.
Jumpers Configuration
As the HDMI2USB firmware manipulates the EDID information the following jumpers must be removed;
JP2/SDA (which connects the EDID lines from J1/HDMI IN to JA/HDMI OUT).
JP6 and JP7 (which connects the EDID lines from J3/HDMI IN to J2/HDMI OUT).
Cables
-
Plug board in using
PROG
port & switch on. If using a VM, ensure the device is passed through. -
The other UART port is for the controlling the firmware. Recommend plugging :w his in too so you can use/test the device.
4) Loading temporarily
You can load gateware and firmware onto your device temporarily for testing. If you power cycle the device after this step it will go back to the state before this step.
Load the gateware and firmware - see [1] if using a VM:
make gateware-load
On the Opsis, while loading the Blue LED (D1 / Done) and Green LED (D2) will light up. After it has finished, both LED will turn off.
The output will look like this;
jtagspi_program
Info : usb blaster interface using libftdi
Info : This adapter doesn't support configurable speed
Info : JTAG tap: xc6s.tap tap/device found: 0x44028093 (mfg: 0x049 (Xilinx), part: 0x4028, ver: 0x4)
loaded file build/opsis_hdmi2usb-hdmi2usbsoc-opsis.bit to pld device 0 in 31s 983152us
Load fx2 firmware to enable USB capture:
make load-fx2
5) Testing
Connect to lm32 softcore to send direct commands to the HDMI2USB such as changing resolution:
make firmware-connect
Set a mode/capture - type 'help' and read instructions.
You likely need to enable a video mode, frame buffer & encoder.
'status' helps to see what the firmware is doing.
The following commands are an example of what is needed;
encoder on
encoder quality 85
video_matrix connect input1 output0
video_matrix connect input1 output1
video_matrix connect input1 encoder
The following commands are an example to view the video output on monitor
H2U 00:01:28>i0 on
Enabling input0
H2U 00:02:24>i1 on
Enabling input1
H2U 00:02:26>o0 on
Enabling output0
H2U 00:02:30>o1 on
Enabling output
H2U 00:04:20>x c pattern output0 # You should see the pattern on the monitor
Connecting pattern to output0
H2U 00:04:48>x c input0 output0 # You should see your desktop on the monior
Connecting input0 to output0
View the video output on your computer with your preferred tool.
The scripts/view-hdmi2usb.sh script will try and find a suitable tool to display.
make view
# or
scripts/view-hdmi2usb.sh
6) Loading permanently
If you are happy with the firmware you can load it onto the board so that if persists after power cycle.
make flash