From 7800ea81999ff145b642472c224aa3faca8d5d6a Mon Sep 17 00:00:00 2001
From: donker <donker@astron.nl>
Date: Thu, 30 Jan 2025 14:18:30 +0100
Subject: [PATCH 1/4] add --nodes to flash_image tool

---
 flash_image | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/flash_image b/flash_image
index c2d3569b..ca23de0f 100755
--- a/flash_image
+++ b/flash_image
@@ -31,7 +31,7 @@
 #   - call this script to flash the factory image:
 #       ./flash_image -h
 #       ./flash_image unb2c --fact --user
-#       ./flash_image unb2c --fact --user --host dop386 --port 4840
+#       ./flash_image unb2c --fact --user --host dop386 --port 4840 --nodes 0,2,8:15
 #   - see flash_status.txt for status:
 #       cat flash_status.txt
 ###############################################################################
@@ -71,6 +71,7 @@ Options: --host=*       which host to connect to.
          --port=*       which opc-ua port to use.
          --fact:        flash factory image.
          --user:        flash user image.
+         --nodes=*:     nodes to flash (* = 0,3,5 or 8:15)
 --> Note: It does not matter where the options are placed: before, in between or after the arguments.
 @EndOfHelp@
     exit 1
@@ -82,6 +83,7 @@ host=
 port=4840
 fact=
 user=
+nodes=
 
 while [[ $# -gt 0 ]]
 do
@@ -92,6 +94,9 @@ do
         --port=*)
             port=${1#*=}
             ;;
+        --nodes=*)
+            nodes=${1#*=}
+            ;;
         --fact)
             fact="flash"
             ;;
@@ -152,11 +157,18 @@ source ./init_sdptr_python.sh
 
 sdp_rw.py --host ${host} --port ${port} -r firmware_version
 
+
 # write fact and/or user image
 # fact image is important, so verify it.
 #
 if [[ -n "${fact}" ]]; then
-    sdp_firmware.py --host "${host}" --port "${port}" --write --read --verify --image FACT --file "${FACT_IMAGE}"
+    if [[ -n "${nodes}" ]]; then
+        echo "flash factory image to nodes: ${nodes}"
+        sdp_firmware.py --host "${host}" --port "${port}" --nodes "${nodes}" --write --read --verify --image FACT --file "${FACT_IMAGE}"
+    else
+        echo "flash factory image to all nodes"
+        sdp_firmware.py --host "${host}" --port "${port}" --write --read --verify --image FACT --file "${FACT_IMAGE}"
+    fi
 
     if grep -Fq "NOT SAME" "${LOGFILE}"; then
         # if found
@@ -171,7 +183,13 @@ if [[ -n "${fact}" ]]; then
 fi
 
 if [[ -n "${user}" ]]; then
-    sdp_firmware.py --host "${host}" --port "${port}" --write --image USER --file "${USER_IMAGE}"
+    if [[ -n "${nodes}" ]]; then
+        echo "flash user image to nodes: ${nodes}"
+        sdp_firmware.py --host "${host}" --port "${port}" --nodes "${nodes}" --write --image USER --file "${USER_IMAGE}"
+    else
+        echo "flash user image to all nodes"
+        sdp_firmware.py --host "${host}" --port "${port}" --write --image USER --file "${USER_IMAGE}"
+    fi
     echo "SUCCESS, flashing user image"
     echo "FLASH-USER-IMAGE-SUCCESS" >> "${STATEFILE}"
 fi
-- 
GitLab


From 844b8a20ddbe9cbe63c201080447c29a3f639f37 Mon Sep 17 00:00:00 2001
From: donker <donker@astron.nl>
Date: Mon, 3 Feb 2025 11:33:47 +0100
Subject: [PATCH 2/4] backup nodes change

---
 flash_image | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/flash_image b/flash_image
index ca23de0f..5a8cb112 100755
--- a/flash_image
+++ b/flash_image
@@ -154,9 +154,11 @@ fi
 # source init_sdptr_python.sh
 cd ${SDPTR_DIR}
 source ./init_sdptr_python.sh
-
-sdp_rw.py --host ${host} --port ${port} -r firmware_version
-
+if [[ -n "${nodes}" ]]; then
+    sdp_rw.py --host ${host} --port ${port} --nodes ${nodes} -r firmware_version
+else
+    sdp_rw.py --host ${host} --port ${port} -r firmware_version
+fi
 
 # write fact and/or user image
 # fact image is important, so verify it.
-- 
GitLab


From cb33e4c7e81fc2aba37edef33d17ccfe0df92f71 Mon Sep 17 00:00:00 2001
From: donker <donker@astron.nl>
Date: Mon, 3 Feb 2025 12:11:25 +0100
Subject: [PATCH 3/4] add newest user image to flash.config

---
 flash.config | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flash.config b/flash.config
index 7dcf348a..e7941b24 100644
--- a/flash.config
+++ b/flash.config
@@ -4,4 +4,5 @@ FACT_IMAGE_UNB2B=${UNB2_IMAGES}/unb2b_minimal-rce6b96eed.rbf
 USER_IMAGE_UNB2B=${UNB2_IMAGES}/lofar2_unb2b_sdp_station_full_wg-b3d679286.rbf
 # FACT_IMAGE_UNB2C=${UNB2_IMAGES}/unb2c_minimal-re6769e2e3.rbf
 FACT_IMAGE_UNB2C=${UNB2_IMAGES}/unb2c_test_ddr_16G_I-r5f4ea2394.rbf
-USER_IMAGE_UNB2C=${UNB2_IMAGES}/lofar2_unb2c_sdp_station_full-dbc6375ef.rbf
+# USER_IMAGE_UNB2C=${UNB2_IMAGES}/lofar2_unb2c_sdp_station_full-dbc6375ef.rbf
+USER_IMAGE_UNB2C=${UNB2_IMAGES}/lofar2_unb2c_sdp_station_full-d601da896.rbf
-- 
GitLab


From 4175bbfa2cb8b46a591ba6b1280165b6afa6c4e8 Mon Sep 17 00:00:00 2001
From: donker <donker@astron.nl>
Date: Mon, 3 Feb 2025 12:27:04 +0100
Subject: [PATCH 4/4] changed sdp_rw, list only selected nodes

---
 test/py/control/sdp_rw.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/py/control/sdp_rw.py b/test/py/control/sdp_rw.py
index cea2722a..6b6b262c 100755
--- a/test/py/control/sdp_rw.py
+++ b/test/py/control/sdp_rw.py
@@ -106,7 +106,6 @@ def main():
             if args.read:
                 data = client.read(args.read[0])
                 success = False if data is None else True
-
                 if not success:
                     print(f"opcua.read {args.read[0]} not available")
                 else:
@@ -133,6 +132,9 @@ def main():
                         col = 0
                         node = client.gn_first_fpga
                         for d in data:
+                            if node not in nodelist:
+                                node += 1
+                                continue
                             line.append(f"{str(d):4s}")
                             col += 1
                             if col == cols:
-- 
GitLab