-
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
Matter RAM Requirements #9261
Comments
|
As described in project-chip#9261 several SRAM optimizations were needed: * decrease the number of Fabrics to 4 (from 16); * use OT MTD lib for the E-Lock App (which is an SED); * decrease the number of OT message buffers to 22(FTD)/10(MTD) - (from 44); * disable LWIP TCP/RAW/Debug/packet buffers. Also, fix a bug in KVS where the deletion of some keys was not done properly. Signed-off-by: Doru Gucea <[email protected]>
As described in project-chip#9261 several SRAM optimizations were needed: * decrease the number of Fabrics to 4 (from 16); * use OT MTD lib for the E-Lock App (which is an SED); * disable LWIP TCP/RAW/Debug/packet buffers. Also, fix a bug in KVS where the deletion of some keys was not done properly. Signed-off-by: Doru Gucea <[email protected]>
As described in #9261 several SRAM optimizations were needed: * decrease the number of Fabrics to 4 (from 16); * use OT MTD lib for the E-Lock App (which is an SED); * disable LWIP TCP/RAW/Debug/packet buffers. Also, fix a bug in KVS where the deletion of some keys was not done properly. Signed-off-by: Doru Gucea <[email protected]>
As described in #9261 several SRAM optimizations were needed: * decrease the number of Fabrics to 4 (from 16); * use OT MTD lib for the E-Lock App (which is an SED); * disable LWIP TCP/RAW/Debug/packet buffers. Also, fix a bug in KVS where the deletion of some keys was not done properly. Signed-off-by: Doru Gucea <[email protected]>
As described in project-chip#9261 several SRAM optimizations were needed: * decrease the number of Fabrics to 4 (from 16); * use OT MTD lib for the E-Lock App (which is an SED); * disable LWIP TCP/RAW/Debug/packet buffers. Also, fix a bug in KVS where the deletion of some keys was not done properly. Signed-off-by: Doru Gucea <[email protected]>
- CHIPDeviceEvent has had a historical `InternetConnectivityChange` event that embeds a 46 byte string (instead of a 16 byte IPAddress) and is *only used for logging* in examples.= - This event is in a union and is the largest of all the sub-structs, therefore forcing max-sized events to that event. Issue project-chip#9261 This PR: - Changes the `address` from a string to an IPAddress - Renames to `ipAddress` to break external clients using this struct so that they notice on the next roll to master (usage change is trivial). - Updates all examples to no longer log the address, since it was only logged for IPv4 and not IPv6, and IPv6 is the standard, so if it was good enough for IPv6 not to log, it's good enough for IPv4. - Make IPAddress trivially copyable by removing a non-trivial `operator=` that was actually implementing the trivial copy. Upstream OpenWeave code that was the basis for the IPAddress.h file removed it already in late 2021, > 1.5 years after import (see openweave/openweave-core@fbbb01c#diff-33121ed998c085b8dc0026f30f24aaadb8b8b36042e38b449cec15c32c8ba86e) - Update all platforms that populated the address to use the actual address, not the string Testing done: - All cert tests pass - All unit tests pass
* Reduce RAM usage from CHIPDeviceEvent - CHIPDeviceEvent has had a historical `InternetConnectivityChange` event that embeds a 46 byte string (instead of a 16 byte IPAddress) and is *only used for logging* in examples.= - This event is in a union and is the largest of all the sub-structs, therefore forcing max-sized events to that event. Issue #9261 This PR: - Changes the `address` from a string to an IPAddress - Renames to `ipAddress` to break external clients using this struct so that they notice on the next roll to master (usage change is trivial). - Updates all examples to no longer log the address, since it was only logged for IPv4 and not IPv6, and IPv6 is the standard, so if it was good enough for IPv6 not to log, it's good enough for IPv4. - Make IPAddress trivially copyable by removing a non-trivial `operator=` that was actually implementing the trivial copy. Upstream OpenWeave code that was the basis for the IPAddress.h file removed it already in late 2021, > 1.5 years after import (see openweave/openweave-core@fbbb01c#diff-33121ed998c085b8dc0026f30f24aaadb8b8b36042e38b449cec15c32c8ba86e) - Update all platforms that populated the address to use the actual address, not the string Testing done: - All cert tests pass - All unit tests pass * Restyled by clang-format * Fix CI on newer compilers * Restyled by clang-format Co-authored-by: Restyled.io <[email protected]>
Issue project-chip#9261 - K32W platform ran out of BSS last week - Current usage is default max 100 events in queue. PR project-chip#17959 already reduced the size of each event and saved approx 600 bytes. This PR should reduce it further. - This PR moves max queue size from 100 to 75, which is 25% reduction and much larger than some platforms which use 25 (which seems low to me) - Other Thread platforms like QPG and EFR32 run on 25, so not worried here Testing done: - Sanity check on K32W via @doru91
Issue #9261 - K32W platform ran out of BSS last week - Current usage is default max 100 events in queue. PR #17959 already reduced the size of each event and saved approx 600 bytes. This PR should reduce it further. - This PR moves max queue size from 100 to 75, which is 25% reduction and much larger than some platforms which use 25 (which seems low to me) - Other Thread platforms like QPG and EFR32 run on 25, so not worried here Testing done: - Sanity check on K32W via @doru91
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
On NXP K32W061 (Thread + BLE) I reached a high level of RAM consumption, around 141.5K (Thread FTD). This is distributed as follows:
.heap 61440
bss 75240
.data 1796
HEAP
The main problem is that immediately after I start the device (no BLE/Thread communication available yet) another 30K (!) of RAM are allocated (see the picture below).
At a first glance, the main consumer is the
InitServer()
function, specifically the initialization of each fabrics requires around ~ 1.4K and there are 16 Fabrics (CHIP_CONFIG_MAX_DEVICE_ADMINS
). I guess we don't need 16 Fabrics/device, so I believe this number can be lowered to a more realistic value like 4 Fabrics/device (and we save around 17K of RAM - I see that Qorvo already operated this change). Even with this number:BSS
here are the main consumers:
SECTION: .bss
SECTION: .bss
100% 75240 total
├── 18% 13280 _ZN2ot12gInstanceRawE
├── 14% 10371 memp_memory_PBUF_POOL_base
├── 6% 4620 rwip_heap_non_ret
├── 5% 4096 au8PDM_InternalFlashDataBuffer
├── 5% 4096 au8PDM_SegmentDataBuffer
├── 4% 3080 _ZN4chip3app23sInteractionModelEngineE
├── 4% 2960 _ZN12_GLOBAL__N_18gFabricsE
├── 3% 2128 memHeap
├── 3% 2120 _ZN12_GLOBAL__N_19gSessionsE
If the device is downgraded to SED (from FTD) then .bss decreases with around 5K;
OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS is set to the default 44. Each 10 buffers requires ~1.3K of RAM. I believe it really depends on the Thread device used. For an SED, I see that some vendors choose to set this variable to 10 (so _ZN2ot12gInstanceRawE was decreased with around 4K):
In the end, I believe that the current minimal RAM requirements are pretty high for a Matter device and we need to understand better where each byte of memory is consumed.
The text was updated successfully, but these errors were encountered: