From 17a874fc04a9ff7b40365133c47903076ffdcc92 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Fri, 24 Dec 2021 11:19:30 +0100 Subject: [PATCH] main: fix SPI access --- src/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index f3e3627..a4d4ca7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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())