Skip to content
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

ihex crc check breaks when crc is 0 #1

Closed
apage43 opened this issue May 21, 2015 · 1 comment
Closed

ihex crc check breaks when crc is 0 #1

apage43 opened this issue May 21, 2015 · 1 comment
Labels

Comments

@apage43
Copy link

apage43 commented May 21, 2015

crc = (0x100 - crc)

The line crc = (0x100 - crc) will give 0x100 instead of 0x00 for the two's complement of zero.

Try crc = (~crc + 1) & 0xff instead.

eerimoq added a commit that referenced this issue May 21, 2015
There was a bug in the intel hex crc algorithm when the crc is 0. Suggested fix is implemented.
@eerimoq
Copy link
Owner

eerimoq commented May 21, 2015

Thanks for the bug report. I corrected the code and added a unittest for ihex crc calculations.

@eerimoq eerimoq closed this as completed May 21, 2015
@eerimoq eerimoq added the bug label May 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants