summaryrefslogtreecommitdiff
path: root/example/ice4pi_prog
blob: 37391f3a19ef99af01dbbcb6a538b5143ec96f2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

dtparam spi=on
gpioset `gpiofind GPIO24`=1
sleep 0.1
gpioset `gpiofind GPIO24`=0

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
dtparam spi=off
gpioset `gpiofind GPIO24`=1
#gpioget `gpiofind GPIO24`


val="0"
while [ "$val" == "0" ] ; do
  val=`gpioget \`gpiofind GPIO25\``
  echo $val
  sleep 0.1
done
dtparam spi=on