[EFR32] Heap fragmentation issue cause AddOpCert request to fail #7727
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
EFR32 examples fail Secure session establisment with a failure when adding OpCert
The error happend when trying to store the OperationCertificate for this admin, the creation of a new
StorableAdminPairingInfo
does a malloc of 1976 that fails.The whole process does multiples mallocs of rather large size. #7695
After analysing the heap usage, There was enough free heap but not a big enough block for the StorableAdminPairingInfo
Change overview
Quick band AID fix: Adding 3k to the heap of efr32 examples helps with the current fragmentation issues.
Could Add more heap to the MG12 MCU family but MG21 is already starving for RAM.
TODO: refactor efr32 example to use heap4 for FreeRTOS and wrap all allocs to the freeRTOS api. Improve heap monitor and tracking to better analyse and optimize the heap usage.
Testing
Manual tests with python controller on the differents examples
connect -ble 3840 73141520 1234
confirm
Secure Session to Device Established
Fixes #7390