Skip to content

Commit

Permalink
correctly wait for end of long ops
Browse files Browse the repository at this point in the history
  • Loading branch information
grg-haas committed Jun 18, 2024
1 parent 86203dd commit b4a75a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/ci/plat/cva6/flash-firmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ start_record_tty "$TTYDEV" 115200 "$LOGFILE" cva6-tty

# Wait for bootrom break
power_on
./scripts/ci/utils/wait_for.py "$LOGFILE" "Hit any key to enter update mode"
wait_for "Hit any key to enter update mode"
echo -n 'a' > "$TTYDEV"
sleep 1

Expand All @@ -34,21 +34,24 @@ printf "0: %.8x" "$FILESIZE" | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd
sleep 1

# Send bytes
dd if="$FIRMWARE_FILENAME" of="$TTYDEV" bs=1 status=progress 2>&1 | awk 'NR % 5 == 0'
dd if="$FIRMWARE_FILENAME" of="$TTYDEV"

## Uboot phase (TFTP)

# Wait for uboot prompt and send firmware image
./scripts/ci/utils/wait_for.py "$LOGFILE" "Hit any key to stop autoboot"
wait_for "Hit any key to stop autoboot"
echo 'a' > "$TTYDEV"

rm -f "$TFTP_DIR/fw_payload.bin"
cp "$FIRMWARE_FILENAME" "$TFTP_DIR/fw_payload.bin"

echo "setenv serverip $HOST_IP" > "$TTYDEV" ; sleep 1
echo "setenv ipaddr $BOARD_IP" > "$TTYDEV" ; sleep 1
echo "tftp fw_payload.bin" > "$TTYDEV" ; sleep 1
echo "mmc write 80200000 800 1800" > "$TTYDEV" ; sleep 1

echo "tftp fw_payload.bin" > "$TTYDEV"
wait_for "=>"
echo "mmc write 80200000 800 1800" > "$TTYDEV"
wait_for "=>"

stop_record_tty cva6-tty
power_off
Expand Down
9 changes: 9 additions & 0 deletions scripts/ci/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ function stop_record_tty {
screen -wipe
}

function wait_for {
if [[ "$#" -ne 1 ];; then
echo "usage: wait_for [pattern]"
exit 1
fi

./scripts/ci/utils/wait_for.py "$LOGFILE" "$1"
}

#############
## Cleanup ##
#############
Expand Down

0 comments on commit b4a75a9

Please sign in to comment.