Use old method to upload files to FPGA

Using a single dd command fails sometimes.
This commit is contained in:
Rodrigo Arias 2024-03-07 12:34:54 +01:00
parent 94eb71dd80
commit a4cda932d2

View File

@ -98,7 +98,7 @@ function copy_by_dma() # {{{
while [ "$skip" -lt "$nblocks" ]; do while [ "$skip" -lt "$nblocks" ]; do
dst=$(($address + $skip * $bs)) 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 let skip=$skip+1
done done
@ -109,6 +109,8 @@ function load_file_in_memory() # {{{
address_hex="$2" address_hex="$2"
address=$(($address_hex)) address=$(($address_hex))
total_size=$(stat --format "%s" "$file")
# Previous tests... # Previous tests...
#strace -f dma-to-device -d /dev/qdma08000-MM-1 -a "$address" -s $((8*1024*1024)) -f "$file" #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 #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" #ID=08 ./load_image.sh "$file" "$address"
# Now dd seems to work fine, but I will leave this as fallback: # 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() # {{{ function do_boot_only() # {{{
{ {