From 6d1e5ed15aead64a33ba0dc38d59bc2d416adeea Mon Sep 17 00:00:00 2001
From: donker <donker@astron.nl>
Date: Thu, 26 Aug 2021 12:57:08 +0200
Subject: [PATCH] L2SDP-454, add comment and extra check to detect image
 change.

---
 src/periph/fpga.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/periph/fpga.cpp b/src/periph/fpga.cpp
index 65e4462d..ff238852 100644
--- a/src/periph/fpga.cpp
+++ b/src/periph/fpga.cpp
@@ -631,6 +631,7 @@ bool Periph_fpga::read_system_info(TermOutput& termout)
         return false;
     }
 
+    // Register can be read, now get mmap if empty.
     if (mmap->empty()) {
         if (mmap != NULL) { delete mmap; }
         mmap = new CMMap(read_reg_map());
@@ -647,8 +648,13 @@ bool Periph_fpga::read_system_info(TermOutput& termout)
         }
     }
 
-    // string design_name = read_design_name();
-    my_current_design_name = read_design_name();
+    // If the design name is changed clear the mmap.
+    string design_name = read_design_name();
+    if (design_name != my_current_design_name) {
+        mmap->clear();
+    }
+    my_current_design_name = design_name;
+
     // cout << "node " << GlobalNr << " design_name= " << my_current_design_name << endl;
 
     // FIXME: get rid of magic constants in masks, should be in CCFG:
-- 
GitLab