From d16d4917d662eb317482781f4de48d87c219c7e8 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 21 Oct 2021 11:25:32 +0200 Subject: [PATCH] build/openfpgaloader: Allow reuse of programmer for consecutive commands and fix --offset. - Avoid appending to self.cmd on each load_bitstream/flash call to allow reused of programmer object. - Convert address to str. --- litex/build/openfpgaloader.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/litex/build/openfpgaloader.py b/litex/build/openfpgaloader.py index cb639030f..a545a3810 100644 --- a/litex/build/openfpgaloader.py +++ b/litex/build/openfpgaloader.py @@ -22,14 +22,14 @@ class OpenFPGALoader(GenericProgrammer): self.cmd += ["--freq", str(int(float(freq)))] def load_bitstream(self, bitstream_file): - self.cmd += ["--bitstream", bitstream_file] - self.call(self.cmd) + cmd = self.cmd + ["--bitstream", bitstream_file] + self.call(cmd) def flash(self, address, data_file, external=False): - self.cmd += ["--write-flash", "--bitstream", data_file] + cmd = self.cmd + ["--write-flash", "--bitstream", data_file] if external: - self.cmd += ["--external-flash"] + cmd += ["--external-flash"] if address: - self.cmd.append("--offset") - self.cmd.append(address) - self.call(self.cmd) + cmd += ["--offset"] + cmd += [str(address)] + self.call(cmd)