From ab17129a44f1404b917307df711b20ab99ef1f4d Mon Sep 17 00:00:00 2001 From: Jeremy Grosser Date: Thu, 28 Dec 2023 17:56:04 -0800 Subject: [PATCH] Reverse the order of bytes returned by RP.Flash.Unique_Id to match pico-sdk. Avoid use of an Address clause in the implementation. --- src/drivers/rp-flash.adb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/drivers/rp-flash.adb b/src/drivers/rp-flash.adb index f03e4f5..59abded 100644 --- a/src/drivers/rp-flash.adb +++ b/src/drivers/rp-flash.adb @@ -218,17 +218,14 @@ package body RP.Flash is Data_Length : constant := 8; Length : constant := 1 + Dummy_Length + Data_Length; Tx, Rx : UInt8_Array (1 .. Length); + Id : UInt64 := 0; begin Tx (1) := FLASH_RUID_CMD; Flash_Do_Cmd (Tx, Rx); - declare - Data : constant UInt8_Array (1 .. Data_Length) := Rx (Rx'Last - (Data_Length - 1) .. Rx'Last) - with Alignment => 8; - Id : UInt64 - with Address => Data'Address; - begin - return Id; - end; + for I in Rx'Last - 7 .. Rx'Last loop + Id := Shift_Left (Id, 8) or UInt64 (Rx (I)); + end loop; + return Id; end Unique_Id; end RP.Flash;