From a4cda932d2549a37f64560ee1631e489b43f0bd5 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 7 Mar 2024 12:34:54 +0100 Subject: [PATCH] Use old method to upload files to FPGA Using a single dd command fails sometimes. --- fpga/fpgactl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fpga/fpgactl b/fpga/fpgactl index 987c880..1b8bf44 100755 --- a/fpga/fpgactl +++ b/fpga/fpgactl @@ -98,7 +98,7 @@ function copy_by_dma() # {{{ while [ "$skip" -lt "$nblocks" ]; do dst=$(($address + $skip * $bs)) - dd if="$ifile" skip=$skip count=1 bs=$bs of="$ofile" seek=$dst oflag=seek_bytes + dd if="$ifile" skip=$skip count=1 bs=$bs of="$ofile" seek=$dst oflag=seek_bytes status=none let skip=$skip+1 done @@ -109,6 +109,8 @@ function load_file_in_memory() # {{{ address_hex="$2" address=$(($address_hex)) + total_size=$(stat --format "%s" "$file") + # Previous tests... #strace -f dma-to-device -d /dev/qdma08000-MM-1 -a "$address" -s $((8*1024*1024)) -f "$file" #strace -f dd if="$file" bs=16M seek="${address}" oflag=seek_bytes of=/dev/qdma08000-MM-1 status=progress conv=sync @@ -116,9 +118,11 @@ function load_file_in_memory() # {{{ #ID=08 ./load_image.sh "$file" "$address" # Now dd seems to work fine, but I will leave this as fallback: - #copy_by_dma "$file" "$address" + copy_by_dma "$file" "$address" - dd if="$file" bs=8M seek="${address}" oflag=seek_bytes of=/dev/qdma08000-MM-1 status=none + #dd if="$file" bs=8M seek="${address}" oflag=seek_bytes of=/dev/qdma08000-MM-1 status=none + + printf "loaded '%s' at 0x%x with size %d\n" "$file" "$address" "$total_size" >&2 } # }}} function do_boot_only() # {{{ {