summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/Makefile3
-rw-r--r--example/README21
-rwxr-xr-xexample/ice4pi_prog8
3 files changed, 21 insertions, 11 deletions
diff --git a/example/Makefile b/example/Makefile
index a55ea4c..2bc5d99 100644
--- a/example/Makefile
+++ b/example/Makefile
@@ -1,9 +1,10 @@
-
rot.bin: rot.v rot.pcf
yosys -q -p "synth_ice40 -blif rot.blif" rot.v
arachne-pnr -p rot.pcf rot.blif -o rot.txt
icebox_explain rot.txt > rot.ex
icepack rot.txt rot.bin
+
+load: rot.bin
./ice4pi_prog rot.bin
# iceprog rot.bin
diff --git a/example/README b/example/README
index bde2a04..100c6b9 100644
--- a/example/README
+++ b/example/README
@@ -1,18 +1,19 @@
-To install all necessary packages and synthesize and program ice4pi:
+Assuming you are running on a Raspberry Pi 2-4 or Zero (tested with bullseye):
+
+1. Install all necessary packages to synthesize rot.v and build bit image (rot.bin) for the ice4pi:
sudo apt-get install yosys fpga-icestorm arachne-pnr
make
-1. Make sure your Pi has SPI enabled
-
-2. There is a problem in arachne-pnr reporting bogus dependency conflict that can be worked around:
-
- apt-get source arachne-pnr
- cd arachne-pnr-0.1+20180909git840bdfd-1.1/
- dpkg-buildpackage -us -uc -j2
- sudo dpkg -i ../arachne*.deb
+2. Make sure your Pi has SPI enabled (e.g. use raspi-config)
3. Building and installing the flashrom tool
- git clone https://www.flashrom.org/git/flashrom.git
+
+ git clone https://github.com/lightside-instruments/flashrom.git
cd flashrom
make CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no install
+ cd ..
+
+4. Load the rot.bin file to the shield:
+
+ make load
diff --git a/example/ice4pi_prog b/example/ice4pi_prog
index dea5c7a..c747db8 100755
--- a/example/ice4pi_prog
+++ b/example/ice4pi_prog
@@ -1,7 +1,15 @@
#!/bin/bash
echo 24 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio24/direction
+echo 1 >/sys/class/gpio/gpio24/value
+sleep 1
+echo 0 >/sys/class/gpio/gpio24/value
+
tr '\0' '\377' < /dev/zero | dd bs=1M count=4 of=image iflag=fullblock
dd if=${1} conv=notrunc of=image
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=20000 -w image
+#workaround first time fails after initial programming
+flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=20000 -w image
echo in > /sys/class/gpio/gpio24/direction
+echo 24 > /sys/class/gpio/unexport
+