Skip to content
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

Reduce RAM Usage for EFR32MG21 examples #7431

Merged
merged 1 commit into from
Jun 8, 2021

Conversation

jmartinez-silabs
Copy link
Member

@jmartinez-silabs jmartinez-silabs commented Jun 7, 2021

Problem

  1. Examples on MG21 fail to compile due to ram overflow again.
  2. In Lock_app example, zcl onoff command do not trigger the implemented emberAfPostAttributeChangeCallback

Change overview

Freed up ~4k of RAM

  • Reduce some memory pools in LWIP
  • Reduce OT CLI TX buffer from 1024B to 512B

Increase lighting app to 13k, like it was already done for Lock app, to prevent some CSR failures due to lack of free heap space.

Fix emberAfPostAttributeChangeCallback definition in lock_app, size argument didn't receive the type change and wasn't overwriting the WEAK declaration

Testing

Manual testing on EFR32MG21 wiht both Lighting and Lock example.
Both now compile

./scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ out/lock_app BRD4180A
./scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app BRD4180A

Validate the examples are still working using python controller :

connect -ble 3840 73141520 1234

zcl NetworkCommissioning AddThreadNetwork 1234 0 0 operationalDataset=hex:0e080000000000000000000300000b35060004001fffe00208dead00beef00cafe0708fddead00beef00000510f4ed320070e00e24a9297b5606f7ec55030a4f70656e5468726561640102d4af0410ac0f452e791654e26c2957a12075eb0a0c0402a0fff8 breadcrumb=0 timeoutMs=1000

zcl NetworkCommissioning EnableNetwork 1234 0 0 networkID=hex:dead00beef00cafe breadcrumb=0 timeoutMs=1000

close-ble

resolve 0 1234

zcl OnOff Toggle 1234 1 0

00> <detail> [DL] Thread packet RCVD: UDP, len 116
00> <detail> [DL]     src  FD11:22::F983:EFFB:8CBB:D3E7, port 11097
00> <detail> [DL]     dest FD11:22::C1C2:67D3:86B3:9371, port 11097
00> <info  > [IN] Secure transport received message destined to fabric 0, node 0x0000000000000015. Key ID 0
00> <info  > [EM] Received message of type 8 and protocolId 327680 on exchange 39024
00> <detail> [EM] ec id: 39024, Delegate: 0x200128d8
00> <detail> [DMG] ICR moving to [Initialize]
00> <detail> [ZCL] Received Cluster Command: Cluster=6 Command=hx Endpoint=hx
00> <info  > [ZCL] On/Off set value: 1 2
00> <info  > [ZCL] Toggle on/off from 0 to 1
00> <efr32 > Lock Action has been initiated
00> <detail> [DMG] ICR moving to [AddCommand]
00> <detail> [IN] Secure message was encrypted: Msg ID 7
00> <info  > [IN] Sending msg from 0x0000000000000015 to 0x000000000001B669 at utc time: ld msec
00> <info  > [IN] Sending secure msg on generic transport
00> <detail> [DL] Thread packet SENT: UDP, len 122
00> <detail> [DL]     src  FD11:22::C1C2:67D3:86B3:9371, port 11097
00> <detail> [DL]     dest FD11:22::F983:EFFB:8CBB:D3E7, port 11097
00> <info  > [IN] Secure msg send status No Error
00> <detail> [DMG] ICR moving to [   Sending]
00> <detail> [DMG] ICR moving to [Uninitiali]
00> <efr32 > Lock Action has been completed

Fixes #7336

Reduce OT CLI buffers size
Increase lighting app to 13k like it was already done for Lock app

fix zcl callback prototype, that wasn't overwriting the weak one
#define MEMP_SEPARATE_POOLS (1)
#define LWIP_PBUF_FROM_CUSTOM_POOLS (0)
#define MEMP_USE_CUSTOM_POOLS (0)
#define PBUF_POOL_SIZE (6)
#define PBUF_POOL_SIZE (5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty small to me, but maybe it's ok.... Need to support at least incoming message, outgoing message, retransmit buffer, standalone ack. That's for a single message exchange. And assuming that nothing else uses pbufs.

I suspect @tcarmelveilleux has thoughts on this.

@andy31415 andy31415 merged commit 2183830 into project-chip:master Jun 8, 2021
andy31415 pushed a commit that referenced this pull request Jun 8, 2021
Reduce OT CLI buffers size
Increase lighting app to 13k like it was already done for Lock app

fix zcl callback prototype, that wasn't overwriting the weak one
@jmartinez-silabs jmartinez-silabs deleted the mg21_tweaks branch June 9, 2021 12:13
doublemis1 pushed a commit to doublemis1/connectedhomeip that referenced this pull request Jul 7, 2021
Reduce OT CLI buffers size
Increase lighting app to 13k like it was already done for Lock app

fix zcl callback prototype, that wasn't overwriting the weak one
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
Reduce OT CLI buffers size
Increase lighting app to 13k like it was already done for Lock app

fix zcl callback prototype, that wasn't overwriting the weak one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build failure on the latest Master for EFR32 MG21 Lock-app
7 participants