Skip to content

Commit a387147

Browse files
committed
Reworking the setup documentation.
1 parent b6007e9 commit a387147

File tree

3 files changed

+169
-123
lines changed

3 files changed

+169
-123
lines changed

scripts/README.md

Lines changed: 164 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Building HDMI2USB-misoc-firmware
22

3-
These scripts are designed to bootstrap a firmware build environment on Ubuntu 14.04 LTS and also works on 15.04 though with less testing.
3+
These scripts are designed to bootstrap a firmware build environment on Ubuntu
4+
14.04 LTS and also works on 15.04 though with less testing.
45

56
## Prerequisite
67

@@ -27,94 +28,187 @@ Install Xilinx ISE WebPACK 14.7 + activate a licence:
2728

2829
## Bootstrap
2930

30-
Run the bootstrap script to build an environment required for flashing firmware:
31-
```
32-
curl -fsS https://raw.githubusercontent.com/timvideos/HDMI2USB-misoc-firmware/master/scripts/bootstrap.sh | bash
33-
```
31+
Run the bootstrap script to build an environment required for flashing
32+
firmware:
33+
```
34+
curl -fsS https://raw.githubusercontent.com/timvideos/HDMI2USB-misoc-firmware/master/scripts/bootstrap.sh | bash
35+
```
3436

35-
This clones the HDMI2USB-misoc-firmware repository, adds the timvideos fpga-support PPA, installs packages required then downloads misoc and its dependencies. Depending on your connection speed this could take a while to download.
37+
This clones the HDMI2USB-misoc-firmware repository, adds the timvideos
38+
fpga-support PPA, installs packages required then downloads misoc and its
39+
dependencies. Depending on your connection speed this could take a while to
40+
download.
3641

37-
## Building the firmware
42+
## Working with the firmware
3843

39-
1. Initalise the environment (required for any of the build/load steps below[2]):
40-
```
41-
cd HDMI2USB-misoc-firmware
42-
source scripts/setup-env.sh
43-
```
44+
### 1) Enter the environment
4445

45-
2. Build the gateware:
46-
```
47-
make gateware
48-
```
46+
Before being able to run any of the build steps you must first `enter` the
47+
development environment.
4948

50-
This may fail at the end after it builds the gateware (as it will try to flash the gateware), this is OK, as long as the gateware files have been built:
49+
Before entering, you should set the type of board you want to use. This is
50+
done by doing;
51+
```
52+
export BOARD=opsis
53+
```
5154

52-
```
53-
Saving bit stream in "atlys_hdmi2usb-hdmi2usbsoc-atlys.bit".
54-
Saving bit stream in "atlys_hdmi2usb-hdmi2usbsoc-atlys.bin".
55-
```
55+
To do this do the following steps;
56+
```
57+
cd HDMI2USB-misoc-firmware
58+
source scripts/enter-env.sh
59+
```
5660

57-
The built gateware will be in build/misoc/build/.
61+
Once you source the environment your prompt should change to look something
62+
like;
63+
```
64+
(H2U BOARD=opsis) #
65+
```
5866

59-
3. You've now built the HDMI2USB firmware/gateware. Ensure board has the right pins set before flashing anything, and plug it in:
67+
FIXME: Add a `make test-env` which verifies the environment is working
68+
(excpecially that the Xilinx stuff has a proper license stuff).
6069

61-
As the HDMI2USB firmware manipulates the EDID information the following jumpers must be removed;
70+
### 2) Build the gateware
6271

63-
```
64-
JP2/SDA (which connects the EDID lines from J1/HDMI IN to JA/HDMI OUT).
65-
JP6 and JP7 (which connects the EDID lines from J3/HDMI IN to J2/HDMI OUT).
66-
```
72+
Once you have entered the environment, you can build things.
6773

68-
* Plug board in using USB PROG port & switch on. If using a VM, ensure the device is passed through.
69-
* Other USB port is for the HDMI2USB capture. Recommend plugging this in too so you can use/test the device.
70-
71-
4. Flash the gateware and firmware - see [1] if using a VM:
74+
Building the full HDMI2USB gateware takes roughly between 15 minutes and 30
75+
minutes on a modern fast machine.
7276

73-
```
74-
make load-gateware
75-
```
76-
(may need to run several times)
77+
```
78+
make gateware
79+
```
7780

78-
5. Load fx2 firmware to enable USB capture:
79-
```
80-
make load-fx2
81-
```
81+
At the end of running the build command, you should end up with;
82+
```
83+
Creating bit map...
84+
Saving bit stream in "opsis_hdmi2usb-hdmi2usbsoc-opsis.bit".
85+
Saving bit stream in "opsis_hdmi2usb-hdmi2usbsoc-opsis.bin".
86+
Bitstream generation is complete.
87+
Firmware 56008 bytes (9528 bytes left)
88+
```
8289

83-
6. Connect to lm32 softcore to send direct commands to the HDMI2USB such as changing resolution:
84-
```
85-
make connect-lm32
86-
```
87-
Set a mode/capture - type 'help' and read instructions.
90+
The built gateware will be in build/misoc/build/.
8891

89-
You likely need to enable a video mode, framebuffer & encoder.
92+
### 3) Configure your board
9093

91-
'status' helps to see what the firmware is doing.
94+
Before loading onto your board, you need to ensure that your board is in the
95+
correct state.
9296

93-
The following commands are an example of what is needed;
94-
```
95-
encoder on
96-
encoder quality 85
97-
video_matrix connect input1 output0
98-
video_matrix connect input1 output1
99-
video_matrix connect input1 encoder
100-
```
97+
---
10198

102-
7. View the video output on your computer with your preferred tool.
99+
#### Configuring the Opsis
103100

104-
The scripts/view-hdmi2usb.sh script will try and find a suitable tool to display.
105-
```
106-
make view
107-
# or
108-
scripts/view-hdmi2usb.sh
109-
```
101+
To use the Opsis, you need to set the jumpers correctly, connect cables
102+
correctly and then put the board into JTAG mode.
103+
104+
FIXME: Put something here about the Opsis.
105+
106+
##### Jumpers Configuration
107+
108+
The jumpers as set on the Opsis when it ships work.
109+
110+
FIXME: Put picture showing correct jumper configuration.
111+
112+
##### Cables
113+
114+
The programming computer must be connected to the USB-B port.
115+
116+
##### JTAG mode
117+
118+
By default the Opsis will boot into HDMI2USB mode. To load gateware onto the
119+
board it must be switched into JTAG mode.
120+
121+
FIXME: Add instructions for switching the Opsis into JTAG mode.
122+
123+
- HDMI2USB-mode-switch
124+
- Connect to console and use fx2 switch command.
110125

111126
---
112127

128+
#### Configuring the Atlys
129+
130+
Before loading the gateware you need to set the jumpers correctly and connect
131+
the cables correctly.
132+
133+
FIXME: Put something here about the Atlys.
134+
135+
##### Jumpers Configuration
136+
137+
As the HDMI2USB firmware manipulates the EDID information the following jumpers
138+
must be removed;
139+
140+
```
141+
JP2/SDA (which connects the EDID lines from J1/HDMI IN to JA/HDMI OUT).
142+
JP6 and JP7 (which connects the EDID lines from J3/HDMI IN to J2/HDMI OUT).
143+
```
144+
145+
##### Cables
146+
147+
* Plug board in using `PROG` port & switch on. If using a VM, ensure the
148+
device is passed through.
149+
150+
* The other UART port is for the controlling the firmware. Recommend plugging
151+
:w
152+
his in too so you can use/test the device.
153+
154+
---
155+
156+
### 4) Loading temporarily
157+
158+
You can load gateware and firmware onto your device temporarily for testing. If
159+
you power cycle the device after this step it will go back to the state before
160+
this step.
161+
162+
Load the gateware and firmware - see [1] if using a VM:
163+
```
164+
make load-gateware
165+
```
113166

114-
Once everything has been built, get HDMI2USB running again after a power cycle by running this script, possibly multiple times if errors first attempt (does non-build steps above):
115-
```
116-
~/HDMI2USB-misoc-firmware/scripts/flash-hdmi2usb.sh
117-
```
167+
Load fx2 firmware to enable USB capture:
168+
```
169+
make load-fx2
170+
```
171+
172+
### 5) Testing
173+
174+
Connect to lm32 softcore to send direct commands to the HDMI2USB such as
175+
changing resolution:
176+
```
177+
make connect-lm32
178+
```
179+
Set a mode/capture - type 'help' and read instructions.
180+
181+
You likely need to enable a video mode, frame buffer & encoder.
182+
183+
'status' helps to see what the firmware is doing.
184+
185+
The following commands are an example of what is needed;
186+
```
187+
encoder on
188+
encoder quality 85
189+
video_matrix connect input1 output0
190+
video_matrix connect input1 output1
191+
video_matrix connect input1 encoder
192+
```
193+
194+
View the video output on your computer with your preferred tool.
195+
196+
The scripts/view-hdmi2usb.sh script will try and find a suitable tool to display.
197+
```
198+
make view
199+
# or
200+
scripts/view-hdmi2usb.sh
201+
```
202+
203+
### 6) Loading permanently
204+
205+
If you are happy with the firmware you can load it onto the board so that if
206+
persists after power cycle.
207+
208+
209+
```
210+
make flash
211+
```
118212

119213
#### Footnotes
120214

@@ -128,8 +222,10 @@ Once everything has been built, get HDMI2USB running again after a power cycle b
128222

129223
* bootstrap.sh: script to run on a fresh Ubuntu 14.04 LTS install
130224
* get-env.sh: called from bootstrap (gets and installs software)
131-
* setup-env.sh: script to run after installation to setup environemnt
225+
* enter-env.sh: script to run after installation to enter environment
132226

133227
* 52-hdmi2usb.rules: udev rules loaded by get-env.sh
134228
* view-hdmi2usb.sh: test script to view HDMI2USB output
135-
* flash-hdmi2usb.sh: script to run after gateware/firmware built
229+
230+
231+

scripts/setup-env.sh renamed to scripts/enter-env.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,19 @@ export HDMI2USB_ENV=1
156156
# Set prompt
157157
ORIG_PS1="$PS1"
158158
hdmi2usb_prompt() {
159-
P=""
159+
P="(H2U"
160160
if [ ! -z "$BOARD" ]; then
161-
P="$P B=$BOARD"
161+
BOARD=opsis
162162
fi
163+
P="$P B=$BOARD"
164+
163165
if [ ! -z "$TARGET" ]; then
164166
P="$P T=$TARGET"
165167
fi
166168
if [ ! -z "$PROG" ]; then
167169
P="$P P=$PROG"
168170
fi
169171

170-
if [ ! -z "$P" ]; then
171-
P="(H2U$P) $ORIG_PS1"
172-
else
173-
P="(HDMI2USB) $ORIG_PS1"
174-
fi
175-
176-
PS1=$P
172+
PS1="$P) $ORIG_PS1"
177173
}
178174
PROMPT_COMMAND=hdmi2usb_prompt

scripts/flash-hdmi2usb.sh

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)