main: fix SPI access

This commit is contained in:
Gwenhael Goavec-Merou 2021-12-24 11:19:30 +01:00
parent cbae44e1ee
commit 17a874fc04
1 changed files with 6 additions and 1 deletions

View File

@ -209,6 +209,10 @@ int main(int argc, char **argv)
int spi_ret = EXIT_SUCCESS;
/* in spi mode force write to flash */
if (args.prg_type == Device::WR_SRAM)
args.prg_type = Device::WR_FLASH;
if (board && board->manufacturer != "none") {
Device *target;
if (board->manufacturer == "efinix") {
@ -229,7 +233,8 @@ int main(int argc, char **argv)
} else {
target->dumpFlash(args.offset, args.file_size);
}
} else if (args.prg_type == Device::WR_FLASH) {
} else if ((args.prg_type == Device::WR_FLASH) ||
!args.bit_file.empty() || !args.file_type.empty()) {
target->program(args.offset, args.unprotect_flash);
}
if (args.unprotect_flash && args.bit_file.empty())