I can program the FPGA part of an Altera/Intel Cyclone V SoC FPGA with a firmware, from Linux on the HPS (ARM core in the SoC FPGA), using Buildroot. I'm using a device tree overlay to write a raw binary file (.rbf) to the FPGA with configfs.
mount -t configfs none /sys/kernel/config
mkdir -p /sys/kernel/config/device-tree/overlays/ov_soc_firmware_fpga
echo ov_soc_firmware_fpga.dtb > /sys/kernel/config/device-tree/overlays/ov_soc_firmware_fpga/path
But if I issue the echo command again, I get this error: "sh: write error: Operation not permitted".
I tried to umount/mount, but it doesn't help.
How can I reprogram the FPGA without rebooting?
Unloading the overlay is actually really simple. You do
rmdir /the/path/to/overlay, and it gets unloaded.In your case it should be
rmdir /sys/kernel/config/device-tree/overlays/ov_soc_firmware_fpga.After unloading you re-run your part starting with
mkdir /path/to/overlayto get new .rbf loaded.Note, do not unmount configfs itself.