GATEWARE=$1
FILESIZE=$(stat -c%s "$GATEWARE")

ADDRESS=0x2000000
XDMA_TOOLS_PATH=../tools

sudo $XDMA_TOOLS_PATH/dma_to_device /dev/xdma0_h2c_0 -f ${GATEWARE} -s $FILESIZE -a $ADDRESS -c 1 -v
sudo $XDMA_TOOLS_PATH/dma_from_device /dev/xdma0_c2h_0 -f /tmp/gateware_out.bit -s $FILESIZE -a $ADDRESS -c 1 -v
md5sum ${GATEWARE} /tmp/gateware_out.bit
sudo rm -r /tmp/gateware_out.bit
~                                        
