-
Notifications
You must be signed in to change notification settings - Fork 6
Support different lenght of extended address #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support different lenght of extended address #2
Conversation
hi, many thanks for contribution. please check first, if unit tests passing, and add some test cases for this extended address feature. |
Test added, thank you for the awesome project! |
Hi @marcinbor85, |
_START_RECORD byte = 5 // Record with start linear address | ||
_DATA_RECORD byte = 0 // Record with data bytes | ||
_EOF_RECORD byte = 1 // Record with end of file indicator | ||
_EXTENDED_RECORD byte = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
althout this is extended record, but it differs from address record only by address size length (20 bits instead of 32).
so i suggest rename it to _ADDRESS_20_RECORD instead of _EXTENDED_RECORD. cause both are extended address in fact.
@@ -52,7 +52,7 @@ func getExtendedAddress(bytes []byte) (adr uint32, err error) { | |||
if binary.BigEndian.Uint16(bytes[1:3]) != 0 { | |||
return 0, errors.New("incorrect address field in extended linear address line") | |||
} | |||
adr = uint32(binary.BigEndian.Uint16(bytes[4:6])) << 16 | |||
adr = uint32(binary.BigEndian.Uint16(bytes[4:6])) << (1 << bytes[3]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1 << bytes[3]) is true only for record 2 (extended 20 bits). i think it isn't backward compatible. for record 4 (32 bits) what is the bytes[3] value?
Since marcinbor85/gohex#2 has been merged there is no more reason to keep the fork.
Since marcinbor85/gohex#2 has been merged there is no more reason to keep the fork.
Fixes arduino/arduino-cli#2842 and arduino/arduino-cli#1009