summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-08-12 23:04:33 +0700
committerhathach <[email protected]>2026-08-12 23:04:33 +0700
commit853cbff468cde5821447ecc92063acf11d3e696e (patch)
tree8a2bb3d590b78f8fa1d8a2b1c390b19f480900d6
parentf3021b337fcea154b898489c417d428c92f88e92 (diff)
hw/bsp/lpc55: implement board_get_unique_id from flash PFR UUID
Read the 128-bit device UUID from the flash PFR region at 0x0009FC70 (UM11126 rev 2.1, section 48.8) rather than falling back to the fixed weak default in hw/bsp/board.c. Verified on lpcxpresso55s69: cdc_msc enumerates with SerialNumber E059C3E208F9B955B3BA4C5CC7F3D13D, matching the uid already recorded for that board in test/hil/local.json.
-rw-r--r--hw/bsp/lpc55/family.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/bsp/lpc55/family.c b/hw/bsp/lpc55/family.c
index e021caf35..11bf86827 100644
--- a/hw/bsp/lpc55/family.c
+++ b/hw/bsp/lpc55/family.c
@@ -170,6 +170,14 @@ uint32_t board_button_read(void) {
return BUTTON_STATE_ACTIVE == GPIO_PinRead(GPIO, BUTTON_PORT, BUTTON_PIN);
}
+size_t board_get_unique_id(uint8_t id[], size_t max_len) {
+ // 128-bit UUID in the flash PFR region at 0x0009FC70 (UM11126 rev 2.1 section 48.8)
+ const uint8_t* uuid = (const uint8_t*) 0x0009FC70;
+ size_t const len = tu_min32(max_len, 16);
+ memcpy(id, uuid, len);
+ return len;
+}
+
int board_uart_read(uint8_t* buf, int len) {
(void) buf;
(void) len;