Skip to content

Commit

Permalink
Reverse the order of bytes returned by RP.Flash.Unique_Id to match pi…
Browse files Browse the repository at this point in the history
…co-sdk. Avoid use of an Address clause in the implementation.
  • Loading branch information
JeremyGrosser committed Dec 29, 2023
1 parent 11cca4e commit ab17129
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/drivers/rp-flash.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit ab17129

Please sign in to comment.