1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 11:30:37 +02:00

m1rc3/norruption/2/: new loop and tools, with auto-reporting and auto-recovery

Untested :-)
This commit is contained in:
Werner Almesberger 2011-10-09 23:01:45 -03:00
parent 3599e3ea6b
commit d433f73101
5 changed files with 110 additions and 0 deletions

58
m1rc3/norruption/2/aloop Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
TTY=/dev/ttyUSB0
DIR=${1:-.}
boot()
{
make -C ../../../m1/jtag-boot boot
}
xterm -e "flterm --log $DIR/log --port $TTY --kernel boot.4e53273.bin" &
n=0
while true; do
n=`expr $n + 1`
echo ===== $n =====
labsw ch1=0 ch2=0
sleep 2
labsw ch1=1 ch2=1
sleep 1
bs=`./bootsts`
if [ "$bs" = "0x0001" ]; then
boot
sleep 10
echo echo === $n === `date` >$TTY
sleep 5
continue
fi
echo bootsts = $bs >$DIR/stat$n
./getstby $DIR/corrupt$n.bin
boot
# 1.0-4.3 seconds
sleep 2
echo '\033serialboot' >$TTY
# >= 7.9 seconds
sleep 9
echo -n a >$TTY
# takes about 3 seconds
sleep 4
./putstby standby.fpg
diff -u <(hexdup -C standby.fpg) \
<(hexdump -C $DIR/corrupt$n.bin) >$DIR/diff$n
done

8
m1rc3/norruption/2/bootsts Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
jtag -q <<EOF | sed '/REG\[32\]=/s///p;d'
cable milkymist
detect
instruction CFG_OUT 000100 BYPASS
instruction CFG_IN 000101 BYPASS
pld readreg 0x20
EOF

13
m1rc3/norruption/2/getstby Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
jtag -q <<EOF
cable milkymist
detect
instruction CFG_OUT 000100 BYPASS
instruction CFG_IN 000101 BYPASS
pld load fjmem.bit
initbus fjmem opcode=000010
frequency 6000000
detectflash 0
endian big
readmem 0 0xa0000 $1
EOF

18
m1rc3/norruption/2/lockmost Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# lockmost - lock standby, soc-rescue, bios-rescue, splash-rescue, and
# flickernoise-rescue, but leave standby unlocked
#
jtag -q <<EOF
cable milkymist
detect
instruction CFG_OUT 000100 BYPASS
instruction CFG_IN 000101 BYPASS
pld load fjmem.bit
initbus fjmem opcode=000010
frequency 6000000
detectflash 0
endian big
lockflash 0xa0000 50
EOF

13
m1rc3/norruption/2/putstby Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
jtag -q <<EOF
cable milkymist
detect
instruction CFG_OUT 000100 BYPASS
instruction CFG_IN 000101 BYPASS
pld load fjmem.bit
initbus fjmem opcode=000010
frequency 6000000
detectflash 0
endian big
flashmem 0 $1 noverify
EOF