-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix inconsistency between mbed crc and psoc6 crc implementations. #12324
Fix inconsistency between mbed crc and psoc6 crc implementations. #12324
Conversation
@dustin-crossman, thank you for your changes. |
// significant than width are dropped. | ||
static uint32_t reverse(uint8_t width, uint32_t in) | ||
{ | ||
MBED_ASSERT(width <= 32); |
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.
Personally, I wouldn't bother with the assert - this is internal, and you've already cleared the HAL_CRC_IS_SUPPORTED
check, and there are a squillion uint32_t
s around here. 32-bit or less is kind of assumed.
Actually though, having this after HAL_CRC_IS_SUPPORTED
means the compiler should hopefully skip putting in the assert anyway. So maybe I shouldn't be worrying about code size.
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.
Has this newly shown up due to the extra Greentea tests? Good. I did recently add some to try to catch this possible error - it was clear the reversal of XOR and init values wasn't being exercised fully.
@kjbracey-arm Yep! The crc test cases you added was exactly what was failing for us. |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
This PR does not contain release version label after merging. |
I've fixed the version: Set to 6.0.0-alpha-2 |
Summary of changes
There is an incongruity between what MBeds CRC spec expects and what PSoC6 hardware actually performs when it comes to the final XOR and remainder reversal: MBed expects the final remainder to be reversed then XORed while PSoC6s CRC, however, performs the final XOR then reverses the resulting value.
This fixes this by reversing the final XOR value before feeding it to the PSoC6 hardware. This works because
Rev(A) XOR B == Rev( A XOR Rev(B) )
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
CY8CKIT_062_WIFI_BT-GCC_ARM_GT.txt
CY8CPROTO_062_4343W-GCC_ARM_GT.txt
Reviewers