-
Notifications
You must be signed in to change notification settings - Fork 134
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 ADC shared interrupt generation error and fail loudly on bad IRQ names in MODM_ISR #685
Conversation
Oops, I forgot about this bug: #663 (comment) |
|
Then let's add perhaps another macro: |
See what you think of what I just committed. I don't love MODM_ISR_UNCHECKED; I'd rather get the error if the CAN (or any other) driver mistakenly generates the wrong interrupt. |
Yeah, much better to fix this for real than hack around it.
This is also good enough for C even if it won't fail gracefully. Still better than nothing! |
Another failing platform:
It seems like what's happening here is that the instance ID is empty for some (all?) lxxx series devices. Probably because the XML doesn't have an instance tag under the adc:
The correct interrupt for this platform is ADC1, but in this case I don't think it's trying to do the combined IRQ, I think it just didn't get a valid instance. The C version works well. The C++ version is giving me trouble. Something about the preprocessor is breaking it; interrupts which are in the list still fail. E.g. MODM_ISR(ADC), passed through the macros fails, but if I just
The output of the C++ isn't so much better than the C. |
There's something about recursive macro resolving, try using MODM_STRINGIFY(name) instead of #name.
Try something like this? #define MODM_ISR_VALIDATE_ERROR_MESSAGE " is not a valid IRQ name."
#define IRQ_ASSERT(name) static_assert(modm::platform::isValidIrqName(MODM_STRINGIFY(name)), MODM_STRINGIFY(name) MODM_ISR_VALIDATE_ERROR_MESSAGE) |
ST is weird and calls this peripheral just ADC not ADC1. hence there is no instance, therefore we only have Edit: Actually I think your right, this seems to be a bug in modm-devices… |
Nice! I've been trying to finish something else up before coming back to this. |
babc147
to
62f10b7
Compare
Co-authored-by: Niklas Hauser <niklas.hauser@rwth-aachen.de>
62f10b7
to
afee956
Compare
Co-authored-by: Jeff McBride <mcbridejc@gmail.com>
afee956
to
6057873
Compare
The
shared_irq_ids
was being populated with strings, e.g.['1']
, but was being tested with integers (e.g.if any (i in props["shared_irq_ids"] for i in props["instances"])
).I also went ahead and included the invalid IRQ check that led me to find this. If you see any issue with that though, I can drop it from the PR.
What's not entirely clear to me is if this worked on some platform? Perhaps on some platform the instance IDs come in as ints, either because the XML attribute is an int or something in modm-devices converts them.
Thanks!