Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
19b4026f8This file is pinned to the selected release. Download the original to open it in your design tool.
#!/bin/bash
dtparam spi=on
gpioset -t0 GPIO24=1
sleep 0.1
gpioset -t0 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 -t0 GPIO24=1
#gpioget GPIO24
val='"GPIO25"=active'
while [ "$val" == '"GPIO25"=active' ] ; do
val=`gpioget GPIO25`
echo $val
sleep 0.1
done
dtparam spi=on