Skip to content

Commit

Permalink
Further scripts improvements:
Browse files Browse the repository at this point in the history
  * Reorganised/cleaned up README.md
  * Moved some manual steps back into get-env.sh
  * Create 'flash-hdmi2usb.sh' script to easily get a board running
  • Loading branch information
xfxf committed Aug 24, 2015
1 parent cb1502e commit fca6724
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 105 deletions.
8 changes: 1 addition & 7 deletions README
Expand Up @@ -24,14 +24,8 @@ This firmware is supported on the following to boards;

[> Getting started
------------------
1. Follow MiSoC Quick start guide
https://github.com/m-labs/misoc

2. Clone https://github.com/timvideos/HDMI2USB-misoc-firmware into same directory as misoc

3. Follow instructions to build the gateware and software:
# In the HDMI2USB-misoc-firmware directory
make help
1. See scripts/README.md for firmware build instructions

[> Status:
atlys_base:
Expand Down
Binary file added scripts/.README.md.swp
Binary file not shown.
11 changes: 11 additions & 0 deletions scripts/52-hdmi2usb.rules
@@ -0,0 +1,11 @@
# Grant permission to makestuff usb devices.
ATTR{idVendor}=="1d50", MODE:="666"

# Grant permissions to hdmi2usb usb devices.

This comment has been minimized.

Copy link
@mithro

mithro Aug 25, 2015

Member

This ID shouldn't be needed any more.

ATTR{idVendor}=="fb9a", MODE:="666"

# Grant permissions to unconfigured cypress chips.
ATTR{idVendor}=="04b4", MODE:="666"

# Grant permissions to Digilent Development board JTAG
ATTR{idVendor}=="1443", MODE:="666"
122 changes: 35 additions & 87 deletions scripts/README.md
@@ -1,50 +1,42 @@
# Building HDMI2USB-misoc-firmware
#### (assumes a new Ubuntu Desktop 14.04 LTS install)

TODO: Complete this, clean this up, move some of it back into the script
These scripts are designed to bootstrap a firmware build environment on Ubuntu 14.04 LTS.

These scripts are designed to bootstrap an environment on Ubuntu 14.04 LTS.
Instructions:

To get started (will install packages, etc):
1. Install Xilinx ISE WebPACK 14.7 + activate a licence:

* Run the bootstrap script to get everything required for flashing firmware:
```
curl -fsS https://raw.githubusercontent.com/timvideos/HDMI2USB-misoc-firmware/master/scripts/bootstrap.sh | bash
```

* Download (URL?)
* & install Xilinx ISE WebPACK 14.7 into the default location in /opt/
* Download from [http://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/design-tools.html]
* Install into the default location in /opt (requires X11 GUI):
```
tar xvf Xilinx_ISE_DS_Lin_14.7_1015_1.tar
cd Xilinx_ISE_DS_Lin_14.7_1015_1
sudo ./xsetup (gui, needs X forwarding if over ssh)
sudo ./xsetup
```
step ?, "Select products to install: (*) ISE WebPACK" 17403 MB
Ensure you select "ISE WebPACK" 17403 MB


* Ensure you have a free WebPACK license for ISE installed, see http://license.xilinx.com/getLicense

goes in ~/.Xilinx/Xilinx.lic
* Ensure you have a free WebPACK license for ISE installed, see [http://license.xilinx.com/getLicense], ensure installed into ```~/.Xilinx/Xilinx.lic```

* Ensure licence is activated by checking ISE:
```
source /opt/Xilinx/14.7/ISE_DS/settings64.sh
ise
```
Go to About > Licence, ensure under "information" you can see your ISC WebPACK licence.

This comment has been minimized.

Copy link
@mithro

mithro Aug 25, 2015

Member

s/ISC/ISE/

or maybe Help, Manage Licence?

* Change into the HDMI2USB-misoc-firmware directory:

2. Run the bootstrap script to build an environment required for flashing firmware:
```
cd ~/HDMI2USB-misoc-firmware
curl -fsS https://raw.githubusercontent.com/timvideos/HDMI2USB-misoc-firmware/master/scripts/bootstrap.sh | bash
```

* Initialise the environment:
3. Initalise the environment (required for any of the build/load steps below[2]):
```
cd ~/HDMI2USB-misoc-firmware
source scripts/setup-env.sh
```

* Build the gateware:
4. Build the gateware:
```
make gateware
```
Expand All @@ -58,7 +50,7 @@ goes in ~/.Xilinx/Xilinx.lic

The built gateware will be in build/misoc/build/.

* Ensure board has the right pins set:
5. You've now built the HDMI2USB firmware/gateware. Ensure board has the right pins set before flashing anything, and plug it in:

As the HDMI2USB firmware manipulates the EDID information the following jumpers must be removed;

Expand All @@ -67,91 +59,47 @@ goes in ~/.Xilinx/Xilinx.lic
JP6 and JP7 (which connects the EDID lines from J3/HDMI IN to J2/HDMI OUT).
```

* Plug board in using PROG port & switch on. If using a VM, ensure the device is passed through.

* Load in custom udev rules:
(make a script, which is called as part of get-env)

```
cat > /etc/udev/rules.d/52-hdmi2usb.rules <<EOF
# Grant permission to makestuff usb devices.
ATTR{idVendor}=="1d50", MODE:="666"
# Grant permissions to hdmi2usb usb devices.
ATTR{idVendor}=="fb9a", MODE:="666"
# Grant permissions to unconfigured cypress chips.
ATTR{idVendor}=="04b4", MODE:="666"
# Grant permissions to Digilent Development board JTAG
ATTR{idVendor}=="1443", MODE:="666"
EOF
udevadm control --reload-rules
```
* Flash the gateware and firmware - see [1] if using a VM:
* Plug board in using USB PROG port & switch on. If using a VM, ensure the device is passed through.
* Other USB port is for the HDMI2USB capture. Recommend plugging this in too so you can use/test the device.

6. Flash the gateware and firmware - see [1] if using a VM:

```
PROG=fpgalink make load-gateware
```
(may need to run several times)

* Connect to lm32 softcore:
7. Load fx2 firmware to enable USB capture:
```
make connect-lm32
make load-fx2-firmware
```

* Set a mode/capture - press 'h' and read instructions. TODO: Explain this more

* Run fx2 firmware to enable USB capture:
8. Connect to lm32 softcore to send direct commands to the HDMI2USB such as changing resolution:
```
make load-fx2-firmware
make connect-lm32
```
Set a mode/capture - press 'h' and read instructions.
TODO: Expand on this

---

CHANGES TO GET ENV SCRIPT:

```
cd HDMI2USB-misoc-firmware/build
git clone https://github.com/mithro/exar-uart-driver
cd exar-uart-driver
sudo apt-get install linux-headers-generic debhelper module-assistant
dpkg-buildpackage -rfakeroot
sudo dpkg --install ../vizzini-source_*_all.deb
(copy package build command from README.Debian) (what?)
```

---

To get a device working after above is all built (booted up, etc):
```
cd ~/HDMI2USB-misoc-firmware
source scripts/setup-env.sh
PROG=fpgalink make load-gateware
make load-lm32-firmware
```
9. Once everything has been built, get HDMI2USB running again after a power cycle by running this script (does non-build steps above):
```
~/HDMI2USB-misoc-firmware/scripts/flash-hdmi2usb.sh
```

#### Footnotes

[1] If you are in a VM, during flashing the device will change USB UUID's up to 3 times. You can just run the command above again until you see "Programming successful!" (you may need to choose the new USB vendor/device ID in your hypervisor to pass through).

---

* https://github.com/timvideos/HDMI2USB-firmware-prebuilt

programmer i want to use when running make is
fpgalink (probably)
urjtag
x3progs

last two require firmware on device first, first will do firmware loading for me
so probably use first
[2] Note firmware is only temporarily flashed to the device and is lost if HDMI2USB is power cycled, so has to be reflashed. You can use the 'go-hdmi2usb.sh' script metioned in step 9.

This comment has been minimized.

Copy link
@mithro

mithro Aug 25, 2015

Member

Only place go-hdmi2usb.sh is mentioned?


---

Files:
#### Files

* bootstrap.sh: script to run on a fresh Ubuntu 14.04 LTS install
* get-env.sh: called from bootstrap (gets and installs software)
* setup-env.sh: script to run after installation to setup environemnt

* 52-hdmi2usb.rules: udev rules loaded by get-env.sh
* view-hdmi2usb.sh: test script to view HDMI2USB output
* flash-hdmi2usb.sh: script to run after gateware/firmware built
4 changes: 2 additions & 2 deletions scripts/bootstrap.sh
Expand Up @@ -4,13 +4,13 @@ set -x
set -e

GIT_REPO=https://github.com/timvideos/HDMI2USB-misoc-firmware.git
GIT_BRANCH=scripts
GIT_BRANCH=master

sudo apt-get install -y git realpath

if [ -e HDMI2USB-misoc-firmware ]; then
cd HDMI2USB-misoc-firmware
#git pull
git pull
else
git clone $GIT_REPO
cd HDMI2USB-misoc-firmware
Expand Down
24 changes: 24 additions & 0 deletions scripts/flash-hdmi2usb.sh
@@ -0,0 +1,24 @@
#!/bin/sh

set -x
set -e

if [ ! -e ~/HDMI2USB-misoc-firmware/build ]; then
echo "You need to build the firmware first. Please see README.md"
exit 1
fi

cd ~/HDMI2USB-misoc-firmware

source ~/HDMI2USB-misoc-firmware/scripts/setup-env.sh

echo "Attempting to load gateware; will attempt 3 times, errors are normal"

for loop in 1 2 3
do
PROG=fpgalink make load-gateware; sleep 2
done

make load-fx2-firmware; sleep 1
make connect-lm32

33 changes: 24 additions & 9 deletions scripts/get-env.sh
Expand Up @@ -65,21 +65,17 @@ sudo adduser $USER dialout
# Get migen
(
cd $BUILD_DIR
if [ -e migen ]; then
cd migen
git pull
else
git clone https://github.com/m-labs/migen.git
cd migen
fi
cd vpi
rm -fr migen

This comment has been minimized.

Copy link
@mithro

mithro Aug 25, 2015

Member

Please don't rm -rf this directory as it could have people's changes in it!

git clone https://github.com/m-labs/migen.git
cd migen/vpi
make all
sudo make install
)

# Get misoc
(
cd $BUILD_DIR
rm -fr misoc
git clone https://github.com/m-labs/misoc.git
cd misoc
git submodule init
Expand All @@ -93,13 +89,32 @@ sudo adduser $USER dialout
(
cd $BUILD_DIR
sudo apt-get install -y libreadline-dev libusb-1.0-0-dev python-yaml sdcc fxload
rm -fr makestuff
wget -qO- http://tiny.cc/msbil | tar zxf -

cd makestuff/libs
../scripts/msget.sh makestuff/libfpgalink
cd libfpgalink
make deps
)
# Load custom udev rules
(
cd $SETUP_DIR
sudo cp -uf 52-hdmi2usb.rules /etc/udev/rules.d/

)

# build exar-uart-driver

This comment has been minimized.

Copy link
@mithro

mithro Aug 25, 2015

Member

This is technically only needed for the Atlys board and not the Opsis board - not really sure how to deal with that.

(
cd $BUILD_DIR
rm -fr exar-uart-driver
git clone https://github.com/mithro/exar-uart-driver
cd exar-uart-driver
sudo apt-get install linux-headers-generic debhelper module-assistant
dpkg-buildpackage -rfakeroot
sudo dpkg --install ../vizzini-source_*_all.deb
)



sudo apt-get install -y gtkwave

Expand Down
File renamed without changes.

0 comments on commit fca6724

Please sign in to comment.