multiboot.py
============

The multiboot.py script can be used to upload a firmware to the CONV-TTL-BLO
flash chip for MultiBoot. It imports the ../ei2c/ei2c.py module for the Telnet
accesses to the I2C bus and defines functions for accessing the SPI flash
via the wb_xil_multiboot module on the FPGA.

You will need a raw bitstream file to write to the flash chip. This bitstream
file can have any extension, as long as the data in it is binary. The script
simply reads it as a binary file, parses it in 256-byte chunks and writes these
chunks to the flash chip via the FPGA.

To run it:

%> python multiboot.py
Crate IP or hostname: <give IP or hostname of crate with CONV-TTL-BLO>
Username: <give crate username for Telnet login>
Password: <give password for Telnet login>
Slot no.: <give slot number of CONV-TTL-BLO card here>
Read config reg? (y/n) <'y' to read configuration registers>
Read first page? (y/n) <'y' to read the first page from the MultiBoot address
                        you will give later>
Write to flash?  (y/n) <'y' to write bitstream data>
Are you sure?    (y/n) <asks you twice, since writing takes realy long>
Issue IPROG?     (y/n)
Multiboot bitstream address(hex): <hex bitstream address, nominally "170000">
<if you answered 'y' on both write questions:>
Input file name: <give here the FULL name of the bitstream file>

The tool will now start sending your bitstream, outputting the page address
it is currently writing to. Go grab a coffee, since this will take at least
11 mins, maybe even more if your network connection is not that good, or
you're using Windows

readflash.py
============

This script reads flash pages from a start to an end address, both of these
given by the user. As the multiboot.py script, it relies on the ei2c.py and
defines the same methods for SPI flash access as the multiboot.py script.
Maybe sometime in the future it will make sense to put these methods in a
class within a common module, but for now it works as is.

When you run it, it asks (as multiboot.py) for crate IP and login data, and then
for a start and end address. It then goes and reads the flash data between these
two addresses via the FPGA logic. The output is stored to a local file called
`flash.bin'.

Note that the script reads 256 bytes at a time from the flash, but does not
check if you gave it an address on a flash page boundary. Therefore, if you
don't give it a starting address which is a page boundary, it will output
data which is shifted by the amount of bytes the starting address is shifted
from the start of the page. For example, if you start reading from address
0x000110, the data in flash.bin will be shifted by 16 bytes when compared
to the flash contents.

