- Notifications
You must be signed in to change notification settings - Fork173
Differentiate comparator 0 as the only one capable of cycle compare#377
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
rust-highfive commentedJan 2, 2022
(rust-highfive has picked a reviewer for you, use r? to override) |
🏷️@tmplt |
I tested the cycle count comparison functionality on HW to make sure this all worked as expected. I'm not sure how to test the address compare functionality on HW so didn't check that. |
I don't see any outstanding issues reviewing from a phone at the moment. I'll go over it in detail when I'm back in my office next week. |
Thoughts@tmplt ? |
I'll go over it tomorrow. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
/// Comparator | ||
pub comp: RW<u32>, | ||
/// Comparator Mask | ||
pub mask: RW<u32>, | ||
/// Comparator Function | ||
pub function: RW<Function>, | ||
reserved: u32, | ||
_supported_functions: core::marker::PhantomData<SupportedFunctions>, |
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.
What effect does this have?
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.
I'm not 100% sure what you mean so I'll take a stab at what I think you're asking. We need to "cary" around the generic argumentSupportedFunctions
, but it's zero sized so we usePhantomData
. As the tests show, it does not increase the size of theRegisterBlock
(addresses forcomp0
and more importantlycomp[0]
remained the same)
assert_eq!(address(&dwt.comp[0].comp), 0xE000_1020); | ||
assert_eq!(address(&dwt.comp[0].mask), 0xE000_1024); | ||
assert_eq!(address(&dwt.comp[0].function), 0xE000_1028); | ||
} |
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.
Can we testconfigure
here?
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.
I don't think so unfortunately. These tests run on the native host so the best we can do is make sure these things are pointing to the right address. If we dereferenced them and tried to check behavior, we'd crash and burn
c8a4fdb
to0dc7047
CompareTDHolmes commentedJan 6, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I made all of the edit: Looks like this was originally how it was implemented, but then you changed it in#342. Let me know if there was a good reason, but I think it makes sense to go back to associated functions. |
TDHolmes commentedJan 6, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I also tried to be fancy by wrapping these two slightly different comparators in a unified struct which then vended the right one by implementing the |
TDHolmes commentedJan 6, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Actually.. I suppose I could still implement enumComparatorTypes{NoCycleCount(Comparator<NoCycleCompare>),WithCycleCount(Comparator<HasCycleCompare>), thoughts? |
At the time I thought it was relics from an older implementation which I refactored just to remove the As for |
In that case this should be ready to review and merge |
Uh oh!
There was an error while loading.Please reload this page.
CHANGELOG.md Outdated
@@ -20,6 +25,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
### Fixed | |||
- Fixed `singleton!()` statics sometimes ending up in `.data` instead of `.bss` (#364, #380). | |||
- Corrected `SCB.ICSR.VECTACTIVE`/`SCB::vect_active()` to be 9 bits instead of 8. | |||
Also fixes `VectActive::from` to take a `u16` and subtract `16` for | |||
`VectActive::Interrupt`s to match `SBC::vect_active()` (#373). |
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.
Transient changes from another PR?
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.
I failed to update the changelog in my original PR so sneaking it in here
Uh oh!
There was an error while loading.Please reload this page.
I want to try this out on hardware before I sign off on it. Hopefully I'll have it done by next week. |
Sounds good, thanks! |
I've been testing this PR with a in
With the patch I get a very confusing trace. I doubt this PR is at fault, but to make sure I need to handle#392 and#383 first. |
Statically enforces that only comparator 0 on `armv7m` can be configuredfor cycle comparison by introducing a marker trait differentiatingcomparator 0 and the rest of them, and only implementing the ability forthis configuration on comparator 0.Closesrust-embedded#376
…unction & some cleanup
b666289
to457864d
Comparerebased onto latest master |
a41ceeb
toef728e8
Compare
Statically enforces that only comparator 0 on
armv7m
can be configured for cycle comparison by introducing a marker trait differentiating comparator 0 and the rest of them, and only implementing the ability for this configuration on comparator 0.Closes#376