altera,intel: adding an option to bypass spiOverJtag automatic bitstream selection by providing the bitstream file path

This commit is contained in:
Gwenhael Goavec-Merou
2022-12-10 22:05:37 +01:00
parent da9c7630e4
commit fb8c1a5f97
6 changed files with 50 additions and 23 deletions
+16 -10
View File
@@ -26,12 +26,13 @@
Altera::Altera(Jtag *jtag, const std::string &filename,
const std::string &file_type, Device::prog_type_t prg_type,
const std::string &device_package, bool verify, int8_t verbose,
const std::string &device_package,
const std::string &spiOverJtagPath, bool verify, int8_t verbose,
bool skip_load_bridge, bool skip_reset):
Device(jtag, filename, file_type, verify, verbose),
SPIInterface(filename, verbose, 256, verify, skip_load_bridge,
skip_reset),
_device_package(device_package),
_device_package(device_package), _spiOverJtagPath(spiOverJtagPath),
_vir_addr(0x1000), _vir_length(14)
{
if (prg_type == Device::RD_FLASH) {
@@ -171,18 +172,23 @@ bool Altera::prepare_flash_access()
bool Altera::load_bridge()
{
if (_device_package.empty()) {
printError("Can't program SPI flash: missing device-package information");
return false;
}
std::string bitname;
if (!_spiOverJtagPath.empty()) {
bitname = _spiOverJtagPath;
} else {
if (_device_package.empty()) {
printError("Can't program SPI flash: missing device-package information");
return false;
}
// DATA_DIR is defined at compile time.
std::string bitname = DATA_DIR "/openFPGALoader/spiOverJtag_";
// DATA_DIR is defined at compile time.
bitname = DATA_DIR "/openFPGALoader/spiOverJtag_";
#ifdef HAS_ZLIB
bitname += _device_package + ".rbf.gz";
bitname += _device_package + ".rbf.gz";
#else
bitname += _device_package + ".rbf";
bitname += _device_package + ".rbf";
#endif
}
#if defined (_WIN64) || defined (_WIN32)
/* Convert relative path embedded at compile time to an absolute path */