lattice: drop the limitation, for .bin, to write at offset > 0

This commit is contained in:
Gwenhael Goavec-Merou 2021-02-27 06:49:42 +01:00
parent 6d1c51d0a4
commit 43caa612ca
2 changed files with 3 additions and 11 deletions

View File

@ -402,7 +402,7 @@ openFPGALoader [-b yourBoard] [-c yourCable] -m project_name/*.bit
##### bit
```bash
openFPGALoader [-b yourBoard] [-c yourCable] -f project_name/*.bit
openFPGALoader [-b yourBoard] [-c yourCable] -f project_name/*.bit # or *.bin
```
##### mcs

View File

@ -75,14 +75,11 @@ Lattice::Lattice(Jtag *jtag, const string filename, const string &file_type,
if (!_file_extension.empty()) {
if (_file_extension == "jed" || _file_extension == "mcs") {
_mode = Device::FLASH_MODE;
} else if (_file_extension == "bit") {
} else if (_file_extension == "bit" || _file_extension == "bin") {
if (prg_type == Device::WR_FLASH)
_mode = Device::FLASH_MODE;
else
_mode = Device::MEM_MODE;
} else if (prg_type == Device::WR_FLASH) {
// for raw bin to flash at offset != 0
_mode = Device::FLASH_MODE;
} else {
throw std::runtime_error("incompatible file format");
}
@ -418,13 +415,8 @@ bool Lattice::program_extFlash(unsigned int offset)
_bit = new McsParser(_filename, true, _verbose);
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();
}
else
_bit = new RawParser(_filename, false);
}
printInfo("Open file ", false);
printSuccess("DONE");