Merge pull request #655 from harbaum/master

Efinix: Check for presence of mode header value before checking its value
This commit is contained in:
Gwenhael Goavec-Merou 2026-05-04 10:06:00 +02:00 committed by GitHub
commit 834c45b682
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -218,11 +218,14 @@ void Efinix::program(unsigned int offset, bool unprotect_flash)
throw std::runtime_error("device mismatch: " + device + " != " + target); throw std::runtime_error("device mismatch: " + device + " != " + target);
} }
} }
std::map<std::string, std::string> hdr = bit->getHeader();
if(hdr.find("mode") != hdr.end()) {
std::string mode = bit->getHeaderVal("mode"); std::string mode = bit->getHeaderVal("mode");
if (mode.find("passive") != std::string::npos) { if (mode.find("passive") != std::string::npos) {
delete bit; delete bit;
throw std::runtime_error("passive mode not supported for flash"); throw std::runtime_error("passive mode not supported for flash");
} }
}
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
throw; throw;
} catch (...) { } catch (...) {