When loading a new FPGA bitstream, it is important to make sure that
there will not be any disturbances caused by the underlying hardware
changing unexpected to the drivers or operating system. So, be
sure to:
- Before loading the new bitstream, do not load any drivers which
cannot be safely unloaded. (This includes things like
TS-UART/XUART drivers)
- Drivers which can be safely unloaded should be unloaded before
loading the
new bitstream, if they in any way touch features of the FPGA.
This includes the SD card and NAND flash drivers.
Note that if do do not follow the above guidelines, you may still be
able to successfully load a new bitstream. However this is not
recommended, as it depends on elements of luck which may not be
reproducable or which may unexpectedly fail.
It is possible load a new bitstream into the TS-7350, TS-7370, and
TS-7390 boards using the load_ts7350 program.
However, since this program is dynamically linked, it is necessary to
set up a RAM file system to hold the dependencies, so that the SD
and/or NAND flash drivers can be unloaded. I have found the
following commands to work, although I have only tested them on boards
without NAND flash, and so some modification is needed if there are
NAND flash drivers loaded.
mkdir /mnt/ram
mount -t tmpfs -o size=2M tmpfs /mnt/ram
mkdir /mnt/ram/lib
cp /lib/ld-2.3.6.so /mnt/ram/lib
cp /lib/libc-2.3.6.so /mnt/ram/lib
ln -s /mnt/ram/lib/ld-2.3.6.so /mnt/ram/lib/ld-linux.so.2
ln -s /mnt/ram/lib/libc-2.3.6.so /mnt/ram/lib/libc.so.6
umount /mnt/root
rm -fr /mnt/root
ln -s /mnt/ram /mnt/root
rmmod tssdcard
/load_ts7350 ./ts7350.vme
Then to reload/mount the SD card you will need something like this:
# reset the registers in the SD controller
# if needed replace the 0x600ff01X with the appropriate address for your system
peekpoke 32 0x600ff010 0xC0081000
peekpoke 32 0x600ff014 0x4
peekpoke 32 0x600ff018 0x4
# reload the SD driver and mount the drive
insmod /tssdcard.ko
mdev -s
rm /mnt/root
umount /mnt/ram
rmdir /mnt/ram
mkdir /mnt/root
echo > /mnt/root/notrootfs
mount -o ro /dev/tssdcarda4 /mnt/root
Known Assumptions:
- The load_ts7350 program is in the root directory of the initrd.
- The bitstream file is named ts7350.vme
and is in the root directory of the initrd.
- The SD card is mounted on /mnt/root
- busybox allows us to safely run basic commands such as ln while the fs is in an
intermediate state
Explanation:
The above code creates a new temporary directory in the initrd, and
mounts a tmpfs filesystem on it. It then copies the dependencies
of load_ts7350 into the tmpfs. The SD card is then unmounted and
a symlink created so that
our libraries are accessible. We then remove the sdcard module
load the new bitstream.
The above code would typically be put in the /linuxrc file.
Additional code will be needed to re-mount the SD card and load any
other drivers needed.
Revision History:
- 1-12-2009 : added some commands to the SD reload/mount
sequence