altera: check file type: for an unknown type user has to explicitly provides flash mode fails otherwise

This commit is contained in:
Gwenhael Goavec-Merou 2021-11-06 08:37:14 +01:00
parent b27422cbe9
commit 28620f8ce9
1 changed files with 10 additions and 2 deletions

View File

@ -42,8 +42,16 @@ Altera::Altera(Jtag *jtag, const std::string &filename,
_mode = Device::MEM_MODE;
else
_mode = Device::SPI_MODE;
} else {
_mode = Device::SPI_MODE;
} else { // unknown type -> sanity check
if (prg_type == Device::WR_SRAM) {
printError("file has an unknown type:");
printError("\tplease use rbf or svf file");
printError("\tor use --write-flash with: ", false);
printError("-b board_name or --fpga_part xxxx");
std::runtime_error("Error: wrong file");
} else {
_mode = Device::SPI_MODE;
}
}
}
}