Standardise usage of rom_get_sys_info function.
RP2350 Datasheet says "You should always check (the first word in the returned buffer) before interpreting the buffer.", so do that.
Also some small unique_id tidy-ups.
diff --git a/src/rp2_common/pico_bootrom/bootrom.c b/src/rp2_common/pico_bootrom/bootrom.c
index fd8e56c..f6ea343 100644
--- a/src/rp2_common/pico_bootrom/bootrom.c
+++ b/src/rp2_common/pico_bootrom/bootrom.c
@@ -86,8 +86,8 @@
 #if !PICO_RP2040
 bool rom_get_boot_random(uint32_t out[4]) {
     uint32_t result[5];
-    rom_get_sys_info_fn func = (rom_get_sys_info_fn) rom_func_lookup_inline(ROM_FUNC_GET_SYS_INFO);
-    if (5 == func(result, count_of(result), SYS_INFO_BOOT_RANDOM)) {
+    int words_returned = rom_get_sys_info(result, 5, SYS_INFO_BOOT_RANDOM);
+    if (words_returned == count_of(result) && result[0] == SYS_INFO_BOOT_RANDOM) {
         for(uint i=0;i<4;i++) {
             out[i] = result[i+1];
         }
@@ -209,4 +209,4 @@
 
     return rc;
 }
-#endif
\ No newline at end of file
+#endif
diff --git a/src/rp2_common/pico_unique_id/unique_id.c b/src/rp2_common/pico_unique_id/unique_id.c
index 11b921c..86e3d1d 100644
--- a/src/rp2_common/pico_unique_id/unique_id.c
+++ b/src/rp2_common/pico_unique_id/unique_id.c
@@ -8,7 +8,12 @@
 #include "pico/bootrom.h"
 #include "pico/unique_id.h"
 
-static_assert(PICO_UNIQUE_BOARD_ID_SIZE_BYTES <= FLASH_UNIQUE_ID_SIZE_BYTES, "Board ID size must at least be the size of flash ID");
+#if PICO_RP2040
+static_assert(PICO_UNIQUE_BOARD_ID_SIZE_BYTES <= FLASH_UNIQUE_ID_SIZE_BYTES, "Board ID size cannot be greater than the size of flash ID");
+#else
+#define SYS_INFO_DEVICE_ID_SIZE_BYTES 8
+static_assert(PICO_UNIQUE_BOARD_ID_SIZE_BYTES <= SYS_INFO_DEVICE_ID_SIZE_BYTES, "Board ID size cannot be greater than the size of device ID");
+#endif
 
 static pico_unique_board_id_t retrieved_id;
 
@@ -38,16 +43,22 @@
         #error unique board ID size is greater than flash unique ID size
     #endif
 #else
-    rom_get_sys_info_fn func = (rom_get_sys_info_fn) rom_func_lookup(ROM_FUNC_GET_SYS_INFO);
-    union {
-        uint32_t words[9];
-        uint8_t bytes[9 * 4];
-    } out;
-    __unused int rc = func(out.words, 9, SYS_INFO_CHIP_INFO);
-    assert(rc == 4);
-    for (int i = 0; i < PICO_UNIQUE_BOARD_ID_SIZE_BYTES; i++) {
-        retrieved_id.id[i] = out.bytes[PICO_UNIQUE_BOARD_ID_SIZE_BYTES - 1 + 2 * 4 - i];
-    }
+    #if PICO_UNIQUE_BOARD_ID_SIZE_BYTES <= SYS_INFO_DEVICE_ID_SIZE_BYTES
+        union {
+            uint32_t words[4];
+            uint8_t bytes[4 * 4];
+        } out;
+        int words_returned = rom_get_sys_info(out.words, 4, SYS_INFO_CHIP_INFO);
+        assert(words_returned == 4);
+        if (words_returned == count_of(out.words) && out.words[0] == SYS_INFO_CHIP_INFO) {
+            for (int i = 0; i < PICO_UNIQUE_BOARD_ID_SIZE_BYTES; i++) {
+                // The device ID is in words 3 and 4, so skip the first two words (i.e. the first 8 bytes)
+                retrieved_id.id[i] = out.bytes[PICO_UNIQUE_BOARD_ID_SIZE_BYTES - 1 + 2 * 4 - i];
+            }
+        }
+    #else
+        #error unique board ID size is greater than device unique ID size
+    #endif
 #endif
 }