Skip to content

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

Merged
merged 2 commits into from
Mar 8, 2021

Conversation

facchinm
Copy link
Contributor

@marcinbor85
Copy link
Owner

hi, many thanks for contribution.

please check first, if unit tests passing, and add some test cases for this extended address feature.

@facchinm
Copy link
Contributor Author

Test added, thank you for the awesome project!

@facchinm
Copy link
Contributor Author

facchinm commented Nov 3, 2020

Hi @marcinbor85,
is the test I added ok?

_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
Copy link
Owner

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])
Copy link
Owner

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?

@marcinbor85 marcinbor85 merged commit cd2cf3d into marcinbor85:master Mar 8, 2021
cmaglie added a commit to cmaglie/arduino-cli that referenced this pull request Mar 8, 2021
Since marcinbor85/gohex#2 has been merged there
is no more reason to keep the fork.
cmaglie added a commit to arduino/arduino-cli that referenced this pull request Mar 8, 2021
Since marcinbor85/gohex#2 has been merged there
is no more reason to keep the fork.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.hex file with bootloader is incorrect for ATmega2560 targets (Arduino Mega2560)
2 participants