lattice: support writing arbitrary raw binary data somewhere in external flash

This commit is contained in:
Gwenhael Goavec-Merou 2020-09-05 07:55:20 +02:00
parent 800ad1ce2c
commit 8dace3e2a9
1 changed files with 11 additions and 2 deletions

View File

@ -29,6 +29,7 @@
#include "latticeBitParser.hpp"
#include "mcsParser.hpp"
#include "progressBar.hpp"
#include "rawParser.hpp"
#include "display.hpp"
#include "spiFlash.hpp"
@ -77,13 +78,14 @@ Lattice::Lattice(Jtag *jtag, const string filename,
_mode = Device::FLASH_MODE;
else
_mode = Device::MEM_MODE;
} else if (flash_wr) { // for raw bin to flash at offset != 0
_mode = Device::FLASH_MODE;
} else {
throw std::exception();
}
}
}
void displayFeabits(uint16_t _featbits)
{
uint8_t boot_sequence = (_featbits >> 12) & 0x03;
@ -389,8 +391,15 @@ bool Lattice::program_extFlash(unsigned int offset)
ConfigBitstreamParser *_bit;
if (_file_extension == "mcs")
_bit = new McsParser(_filename, true, _verbose);
else
else if (_file_extension == "bit")
_bit = new LatticeBitParser(_filename, _verbose);
else {
if (offset == 0) {
printError("Error: can't write raw data at the beginning of the flash");
throw std::exception();
}
_bit = new RawParser(_filename, false);
}
printInfo("Open file " + _filename + " ", false);
printSuccess("DONE");