From 533cd64f37cefc851b134525d26ed2aa5a5c84b9 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Wed, 24 Nov 2021 07:35:10 +0100 Subject: [PATCH] lattice: if unknown file type, fails only for SRAM --- src/lattice.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lattice.cpp b/src/lattice.cpp index c2797b4..57cdbf7 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -149,8 +149,11 @@ Lattice::Lattice(Jtag *jtag, const string filename, const string &file_type, _mode = Device::FLASH_MODE; else _mode = Device::MEM_MODE; - } else { - throw std::runtime_error("incompatible file format"); + } else { /* unknown type: */ + if (prg_type == Device::WR_FLASH) /* to flash: OK */ + _mode = Device::FLASH_MODE; + else /* otherwise: KO */ + throw std::runtime_error("incompatible file format"); } } /* check device family */