-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Silabs] Fixing hardfault issue with RS9116 ble manager #36167
[Silabs] Fixing hardfault issue with RS9116 ble manager #36167
Conversation
Review changes with SemanticDiff. |
PR #36167: Size comparison from d7abcbf to 980c798 Full report (65 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
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.
As a general comment, do we need to use a global variable for the bleEvent
?
osMessageQueuePut
copies the the buffer to the queue to not require the user of the API to maintain the initial event data.
We can just create a local variable each time we want to pass an event to the message queue.
@@ -294,6 +294,7 @@ void SilabsBleWrapper::rsi_ble_add_char_val_att(void * serv_handler, uint16_t ha | |||
|
|||
uint32_t SilabsBleWrapper::rsi_ble_add_matter_service(void) | |||
{ | |||
bleEvent.eventData = new SilabsBleWrapper::sl_wfx_msg_t(); |
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.
Instead of using dynamic allocation, we could just change the structure type to avoid using a pointer for the eventData. From i can tell, there doesn't seem to be an explicitly requirement and the variable is global.
@mkardous-silabs The reason it can't be saved as a local variable and passed through the queue is that we need the data which is saved in the same struct during the init/previous event data during the some of events. So instead of having multiple global variables it is better to have a single struct. |
@chirag-silabs From what i can see from the code, the only spot where the ble event is used differently is I'm not sure why this would require a global variable. Am i missing something? |
This change is not required |
Problem:
The Ble manager for Rs911x devices code refactored by below PR and in this no where the memory is not allocated for bleEvent.eventData member.
#35522
Due to which hardfault is coming when this struct member is getting defined.
Fix
Fixed the issue by allocating
Testing
Tested commissioning with 917 SoC, RS9116+EFR mg24.