-
Notifications
You must be signed in to change notification settings - Fork 212
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 for esp8266 and esp32 when LMIC_USE_INTERRUPTS is used #556
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks for this. It's about to become relevant, because the pending changes for time and interrupt handling will make all this work much better.
What does ICACHE_RAM_ATTR
expand to? Other function attributes (on other compilers) generally appear after the type, before the function, and may need to be on the prototype. We may want to use this in a way that's portable across compilers. (Some times you need annotation on the prototype, sometimes on the definition, sometimes both... this is why LMIC_DECLARE_FUNCTION_WEAK() is done the way it is.)
Also, this should be done via the lmic_env.h
file, and documented similarly to LMIC_ABI_STD
or LMIC_DECLARE_FUNCTION_WEAK()
.
Thanks for the review.
This attribute can indeed be placed elsewhere in the declaration. |
Thanks, Before you spend too much time, let me take a look at how TCM is handled on ARM with a couple of other compilers; that's the same kind of attribute. I think it wants to be on the prototype. With static in this file, there isn't a prototype, but of course that's easy to change. (It's often convenient to wrap this kind of thing in a |
Yeah, as I thought, placements on some compilers show up at the end of a declaration -- i.e., the way to declare this would be: static void isr0(void) LMIC_PLACEMENT_ATTRIBUTE_ISR;
static void isr0(void) {
// body
} Since some compilers may want different orders, if I were doing a general notation, I probably should use something like #ifndef LMIC_DECLARE_FUNCTION_PLACEMENT
# define LMIC_DECLARE_FUNCTION_PLACEMENT(a_StorageClass, a_Placement, a_ReturnType, a_FunctionName, a_Params) \
a_StorageClass a_ReturnType a_Placement a_ReturnType a_FunctionName a_Params
#endif Then we'd write: LMIC_DECLARE_FUNCTION_PLACEMENT(static, LMIC_PLACEMENT_ISR, void, hal_isrPin0, (void));
LMIC_DECLARE_FUNCTION_PLACEMENT(static, LMIC_PLACEMENT_ISR, void, hal_isrPin1, (void));
LMIC_DECLARE_FUNCTION_PLACEMENT(static, LMIC_PLACEMENT_ISR, void, hal_isrPin2, (void)); But maybe that's overkill for this. We could have (in #ifndef LMIC_DECLARE_ISR
# if defined(/* whatever for ESP32 */)
# define LMIC_DECLARE_ISR(a_StorageClass, a_Name) a_StorageClass ICACHE_RAM_ATTR a_Name(void)
# else
# define LMIC_DECLARE_ISR(a_StorageClass, a_Name) a_StorageClass a_Name(void)
# endif
#endif // ndef LMIC_DECLARE_ISR Then we'd write (in LMIC_DECLARE_ISR(static, hal_isrPin0);
LMIC_DECLARE_ISR(static, hal_isrPin1);
LMIC_DECLARE_ISR(static, hal_isrPin2); I think the last is best, because it's easy to understand, and we're not likely to need other placement strategies. |
@terrillmoore I ran into the same problem using MCCI LMIC on ESP32 with arduino-esp32 framework. Would be great if this could be merged soon, to make it safe using interrupt DIOs on ESP32.
|
@d-a-v Note: as far as i unterstand, for ESP32 it's |
IRAM_ATTR also exists for esp8266 ! :) (I added it a while ago) |
@d-a-v Don't we need some more ATTR in hal.cpp for ESP32?
|
No description provided.