Skip to content

Conversation

@adamgreig
Copy link
Member

Per https://open-cmsis-pack.github.io/Open-CMSIS-Pack-Spec/main/html/algorithmFunc.html#Verify, the verify method should return a u32 where success is indicated by addr+size. I think probe-rs already gets this correct when using it, just the trait is wrong. It's a breaking change so we'd have to publish 0.7, along with the new blank_check.

@Yatekii
Copy link
Member

Yatekii commented Dec 31, 2025

Can we keep the Result on the trait and make it a Result<u32, u32> so we can keep Ok/Err semantics but still return the correct ok/error codes?

@adamgreig
Copy link
Member Author

We could have it be Result<(), u32>, where the error code is the location of the failure and must not be equal to address+size, and then have the C wrapper convert Ok to addr+size? But it won't niche optimise unlike the others (which are Result<(), NonZeroU32>), and can't be NonZero since 0 is a valid error location (if the first byte doesn't match), so we can't use the ErrorCode type alias either.

@adamgreig
Copy link
Member Author

I've updated to use Result<(), u32> and have the wrapper turn Ok(()) into addr + size.

@Yatekii
Copy link
Member

Yatekii commented Jan 2, 2026

Thanks!

@Yatekii Yatekii merged commit 71c51db into master Jan 2, 2026
1 check passed
@Yatekii Yatekii deleted the verify-return branch January 2, 2026 21:52
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.

3 participants