xilinx: support writing .bit file to flash
This commit is contained in:
parent
e8acec9873
commit
d9bbcdf68b
|
|
@ -176,7 +176,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
Device *fpga;
|
Device *fpga;
|
||||||
if (fab == "xilinx") {
|
if (fab == "xilinx") {
|
||||||
fpga = new Xilinx(jtag, args.bit_file, args.verbose);
|
fpga = new Xilinx(jtag, args.bit_file, args.write_flash, args.write_sram,
|
||||||
|
args.verbose);
|
||||||
} else if (fab == "altera") {
|
} else if (fab == "altera") {
|
||||||
fpga = new Altera(jtag, args.bit_file, args.verbose);
|
fpga = new Altera(jtag, args.bit_file, args.verbose);
|
||||||
} else if (fab == "anlogic") {
|
} else if (fab == "anlogic") {
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,25 @@
|
||||||
#include "part.hpp"
|
#include "part.hpp"
|
||||||
#include "progressBar.hpp"
|
#include "progressBar.hpp"
|
||||||
|
|
||||||
Xilinx::Xilinx(Jtag *jtag, const std::string &filename, bool verbose):
|
Xilinx::Xilinx(Jtag *jtag, const std::string &filename,
|
||||||
|
bool flash_wr, bool sram_wr, bool verbose):
|
||||||
Device(jtag, filename, verbose)
|
Device(jtag, filename, verbose)
|
||||||
{
|
{
|
||||||
if (_filename != ""){
|
if (_filename != ""){
|
||||||
if (_file_extension == "bit")
|
if (flash_wr && sram_wr) {
|
||||||
_mode = Device::MEM_MODE;
|
printError("both write-flash and write-sram can't be set");
|
||||||
else
|
throw std::exception();
|
||||||
|
}
|
||||||
|
if (_file_extension == "mcs") {
|
||||||
_mode = Device::SPI_MODE;
|
_mode = Device::SPI_MODE;
|
||||||
|
} else if (_file_extension == "bit") {
|
||||||
|
if (sram_wr)
|
||||||
|
_mode = Device::MEM_MODE;
|
||||||
|
else
|
||||||
|
_mode = Device::SPI_MODE;
|
||||||
|
} else {
|
||||||
|
_mode = Device::SPI_MODE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Xilinx::~Xilinx() {}
|
Xilinx::~Xilinx() {}
|
||||||
|
|
@ -97,6 +108,8 @@ void Xilinx::program_spi(unsigned int offset)
|
||||||
ConfigBitstreamParser *_bit;
|
ConfigBitstreamParser *_bit;
|
||||||
if (_file_extension == "mcs")
|
if (_file_extension == "mcs")
|
||||||
_bit = new McsParser(_filename, false, _verbose);
|
_bit = new McsParser(_filename, false, _verbose);
|
||||||
|
else if (_file_extension == "bit")
|
||||||
|
_bit = new BitParser(_filename, false, _verbose);
|
||||||
else {
|
else {
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
printError("Error: can't write raw data at the beginning of the flash");
|
printError("Error: can't write raw data at the beginning of the flash");
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@
|
||||||
|
|
||||||
class Xilinx: public Device, SPIInterface {
|
class Xilinx: public Device, SPIInterface {
|
||||||
public:
|
public:
|
||||||
Xilinx(Jtag *jtag, const std::string &filename, bool verbose);
|
Xilinx(Jtag *jtag, const std::string &filename,
|
||||||
|
bool flash_wr, bool sram_wr, bool verbose);
|
||||||
~Xilinx();
|
~Xilinx();
|
||||||
|
|
||||||
void program(unsigned int offset = 0) override;
|
void program(unsigned int offset = 0) override;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue