-
Notifications
You must be signed in to change notification settings - Fork 3k
Altered Silabs RAIL wrapper to avoid parameter error #5742
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
Conversation
I think this could still have some issues - the interrupt handler/thread now can reference the device_driver before it's fully initialised, and rf_radio_driver_id before it's initialised at all. You should probably suppress the interrupts during initialisation - either in software or hardware. Also, I see your interrupt routine is calling malloc? Or is that case not called from interrupt? My recommendation for RX buffer allocation is to use Nanostacks ns_dyn_mem_temporary_alloc - that would then be useable from interrupt in the non-RTOS case. And for the RTOS case it should be part of the work deferred to the thread. |
Yeah, that's probably not ideal. I should be able to mask off the signals in software prior to there being a thread to catch them. Will have a go at that. And yes, there is a malloc at NanostackRfPhyEfr32.cpp#L966 which loads the message from the radio and is always in an interrupt routine. We have to load the packet to determine whether to ACK (or cancel the ACK as it were), so IMO it's appropriate the loading occurs there. I will note that it's not related to these changes, and I suspect it exists because previously RAIL was managing memory for pending packets. TBQH I prefer static allocation in /all/ cases, we could maybe adopt a static memory pool (@stevew817)? |
Automatic CI verification build not done, please verify manually. |
793f131
to
bcaa8cb
Compare
Wrapped signals so they're only emitted once a thread has been registered. |
Having a go with an OS MemoryPool instead of malloc here but I currently have both |
Yes, a static memory pool is probably in order, given that malloc is not officially IRQ-safe. I've made the quick-and-dirty implementation, which combined with your changes from this PR no longer throws errors in debug mode. |
@ryankurte Thoughts on @stevew817 comment? |
I'm still getting the errors mentioned earlier, have been working on debugging em.
Other thought is that it might be this line in rtx_evr.h:1495, but yeah, I haven't got my head around it or tried it yet.
As an aside, is there a reasonable way of teaching the debugger about syscalls / kernel space? Because debugging these things is at least for me a bit of a nightmare 😂. The error occurs in the kernel, and the only ways to trace I have found are to either get lucky and break before the occurrence of it, or rewrite state with he debugger until you return to application space. |
Well, when I said quick-and-dirty, I meant implementing a rudimentary static pool, not using the RTX Memory pool, which is probably why the issues were gone for me. As far as debugging goes, I don't know of any debugger other than uVision (which costs money) and DS5 (even more money) supporting RTX. Supposedly Segger's Ozone (free to use with all Silicon Labs kits) is extensible to support different RTOS'es, but AFAIK they only have plugins for embOS and FreeRTOS as of now. |
Updated to static memory allocated in the queue in my efr32-wip branch and am still getting the |
@kjbracey-arm @SeppoTakalo Do you all have any ideas on how to help @ryankurte move forward with the PR? |
@ryankurte, I take it you're still stuck with your last issue? |
Closing for now. Please reopen when updates are available. |
Fix for #5680, thread now initialised prior to interrupt handlers being enabled to ensure
osThreadFlagsSet
is not called with an invalid (uninitialised) thread ID.Could alternately guard the signal calls if that was preferred, but this seemed easier.