Commit 2368263a authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

svec-flasher: added update over VME option

parent f2768ddc
......@@ -82,7 +82,7 @@ There are three versions of the bootloader in use:
@itemize
@item @b{Version 1} which only allows booting the Application FPGA via VME (no flash support). This version of the bootloader has been programmed in older SVEC cards. If the VME flasher (@code{svec-flasher}) tool is unable to detect the flash memory, you're likely running the old bootloader.
@item @b{Version 2} which supports everything described in this manual except for providing SPI flash access to the AFPGA.
@item @b{Version 3} which supports everything described in this manual, including accessing the SPI flash from AFPGA.
@item @b{Version 3} which supports everything described in this manual, including accessing the SPI flash from the AFPGA.
@end itemize
The new version is software-compatible with the old one, there is no need to update any drivers. The register description applies to both versions, except that for the version 1, the Flash Access Register (@code{FAR}) is not functional.
......@@ -131,7 +131,7 @@ The flash memory of the SVEC contains 16 Megabytes of data, that is 65536 pages
@itemize
@item @code{0}: Raw bitstream for the System FPGA (up to 1 MB).
@item @code{0x100000}: Raw bitstream for the Application FPGA (up to 5 MB).
@item @code{0x601000 - 0xffffff}: User-defined area, foreseen for AFPGA data storage.
@item @code{0x601000 - 0xffffff}: Free space, foreseen for the AFPGA's private data storage.
@end itemize
An example script for building the default flash filesystem (containg the bootloader and golden bitstreams) is located in the @code{software/sdb-flash} subdirectory in the SVEC project's repository(@pxref{repo_link,,2}). Presence of the SDB descriptor table at @code{0x600000} is checked by the bootloader to prevent booting up from a corrupted or unprogrammed flash.
......@@ -170,11 +170,11 @@ The OneWire core allows reading the board's serial number (equal to S/N of the D
@b{Note:} Please do not hardcode the base addresses of the cores, query them from the SDB descriptor. The SDB address of @code{0x0} is guaranteed to stay constant.
Only A32/A24/D32/CSR address modifiers are supported.
@multitable @columnfractions .20 .10 .15 .65
@multitable @columnfractions .23 .10 .20 .55
@headitem Core @tab Base address @tab Library @tab Description
@item @code{sdb_rom} @tab @code{0x0} @tab @code{general-cores} @tab SDB descriptor.
@item @code{golden_core} @tab @code{0x10000} @tab local @tab Golden Bitstream core.
@item @code{xwb_onewire_master} @tab @code{0x12000} @tab @code{general-cores} @tab OneWire Master for accessing temperature sensor/serial ID.
@item @code{xwb_onewire_master} @tab @code{0x12000} @tab @code{general-cores} @tab OneWire Master (temp sensor).
@end multitable
@macro regsection{name}
......@@ -182,14 +182,15 @@ Only A32/A24/D32/CSR address modifiers are supported.
@end macro
@chapter Flashing the SVEC
@section Application FPGA Flash programming through VME
The SVEC Application FPGA can be programmed with the @code{svec-flasher} tool, located in @code{software/vme-flasher} subdirectory of the SVEC project repository. It requires a @code{.bin} format bitstream, that can be generated by Xilinx ISE by selecting ``Generate binary configuration file'' in @i{Generate Programming File} options.
The flasher requires the slot number as the first argument and the file with the bitstream as the second, just like in the example below:
@example
# ./svec-flasher.L865 12 /lib/firmware/fmc/svec-golden.bin
Programming the Application FPGA flash with bitstream /lib/firmware/fmc/svec-golden.bin.
# ./svec-flasher.L865 12 svec-golden.bin
Programming the Application FPGA flash with bitstream svec-golden.bin.
Programming page 7651/7651.
Verification...
Programming page 0/0.
......@@ -201,20 +202,44 @@ Programming OK.
@example
# rmmod svec
@end example
@b{Note 2:} The flasher must be run as root.
@b{Note 3:} The card must be rebooted for the new bitstream to be loaded to the Application FPGA.
@section Updating the bootloader
@section Updating the bootloader through VME
Starting from the version 2, the bootloader can update itself via VME by using the @code{svec-flasher} tool. In order to update the bootloader,
invoke the flasher with @code{-b} parameter.
@example
# ./svec-flasher 5 svec-boot-v3.bin -b
Programming the Application FPGA flash with bitstream svec-boot-v3.bin.
Bootloader version: 3
WARNING! You're about to update the SVEC bootloader.
If this operation fails (due to incorrect bitstream or power loss),
the card can be only recovered through JTAG.
Type 'yes' to continue or Ctrl-C to exit the program: yes
Programming page 1331/1331.
Verification...
Programming OK.
@end example
@b{Note}: Programming incorrect bootloader bitstream or a failure of bootloader update process will render your card unusable. In such case, the card
can be recovered by programming the bootloader through JTAG. The flasher tool asks for additional confirmation before reprogramming the memory.
@section Updating the bootloader through JTAG
Certain older SVEC cards have been shipped with the first version of the bootloader that does not support booting the AFPGA from the Flash memory. In order to use from the VME Flasher, an update is necessary. The procedure goes as follows:
@itemize
@item Download the updated bootloader @code{svec-bootloader-v2-20140207.mcs} from @uref{http://www.ohwr.org/projects/svec/wiki/Gateware_release_2_0}.
@item Download the latest bootloader @code{svec-bootloader-[latest release].mcs} from @uref{http://www.ohwr.org/projects/svec/wiki/Releases}.
@item Connect Xilinx JTAG programmer to the JTAG connector of the card to be updated.
@item Launch ISE iMPACT.
@item Double-Click ``Boundary Scan'' in the left pane (``iMPACT flows'').
@item Open the right-click menu in the main work area and select ``Initialize chain'' or press Ctrl+I.
@item Right click on the ``SPI/BPI ?'' box above the ``xc6slx9'' FPGA and select ``Add SPI/BPI Flash''.
@item Pick the @code{svec-bootloader-v2-20140107.mcs} file.
@item Pick the @code{svec-bootloader-[latest release].mcs} file.
@item Select flash type: SPI PROM, M25P128, data width: 1.
@item Right click on the ``FLASH'' chip above the ``xc6slx9'' and select ``Program''. Select the ``Verify'' option and click OK.
@item If everything went fine, ``Programming succeeded'' message will appear.
......@@ -262,7 +287,7 @@ Preparation of the flash image described above requires some (currently) Linux-o
@section Accessing the SPI Flash from the Application FPGA
The Version 3 of the bootloader allows the Application FPGA to access the SPI interface of the Flash memory. Once the boot process is done, the System FPGA routes the following AFPGA pins
The version 3 of the bootloader allows the Application FPGA to access the SPI interface of the Flash memory. Once the boot process is done, the System FPGA routes the following AFPGA pins
directly to the Flash memory's SPI interface (Xilinx UCF file syntax):
@example
......
......@@ -280,11 +280,17 @@ int main(int argc, char *argv[])
void *buf;
uint32_t size;
int slot;
int program_boot=0;
if (argc < 3) {
printf("usage: %s slot bitstream.bin\n", argv[0]);
return -1;
printf("usage: %s slot bitstream.bin [-b]\n", argv[0]);
printf(" -b: updates the bootloader itself\n");
return 0;
}
if(argc > 3 && !strcmp(argv[3], "-b"))
{
program_boot = 1;
}
printf("Programming the Application FPGA flash with bitstream %s.\n",
......@@ -322,9 +328,25 @@ int main(int argc, char *argv[])
int version = SXLDR_CSR_VERSION_R(csr_readl( SXLDR_REG_CSR ));
printf("Bootloader version: %d\n", version);
flash_program(BOOTLOADER_SDB_BASE, sdb_header, sizeof(sdb_header));
flash_program(BOOTLOADER_BITSTREAM_BASE, buf, size);
if(program_boot)
{
char confirm[1024];
printf("\nWARNING! You're about to update the SVEC bootloader. \nIf this operation fails (due to incorrect bitstream or power loss), the card "
"can be only recovered through JTAG.\n\n");
printf("Type 'yes' to continue or Ctrl-C to exit the program: ");
fgets(confirm, 1024, stdin);
if(strncmp(confirm,"yes", 3))
{
printf("Bootloader update aborted.\n");
return -1;
}
flash_program(0, buf, size);
} else {
flash_program(BOOTLOADER_SDB_BASE, sdb_header, sizeof(sdb_header));
flash_program(BOOTLOADER_BITSTREAM_BASE, buf, size);
}
free(buf);
printf("Programming OK.\n");
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment