Skip to content

Commit

Permalink
Reduce Lwip memory pool counts and size for MG21 (#7431)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jmartinez-silabs authored and pull[bot] committed Aug 9, 2021
1 parent e4be71d commit 3424223
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ efr32_sdk("sdk") {
defines = [
"BOARD_ID=${efr32_board}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"SL_HEAP_SIZE=(12 * 1024)",
"SL_HEAP_SIZE=(13 * 1024)",
]

if (chip_enable_pw_rpc) {
Expand Down
6 changes: 1 addition & 5 deletions examples/lock-app/efr32/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@
#include "AppConfig.h"
#include "BoltLockManager.h"

#include <app/chip-zcl-zpro-codec.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>
#include <app/util/af-types.h>
#include <app/util/attribute-storage.h>
#include <app/util/util.h>

using namespace ::chip;

void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value)
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
{
if (clusterId != ZCL_ON_OFF_CLUSTER_ID)
{
Expand Down
2 changes: 2 additions & 0 deletions examples/platform/efr32/project_include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
// conserve RAM for this Series 2 part.
#if defined(EFR32MG21)
#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 512
#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
#endif

#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
Expand Down
17 changes: 7 additions & 10 deletions src/lwip/efr32/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@

#define LWIP_FREERTOS_USE_STATIC_TCPIP_TASK 1

// TODO: seems like this is unnecessary on Thread-only platforms
#define LWIP_RAW 1
#define MEMP_NUM_RAW_PCB (5)
#define MEMP_NUM_RAW_PCB (4)

// TODO: verify count
#define MEMP_NUM_UDP_PCB (7)
#define MEMP_NUM_UDP_PCB (5)

#define LWIP_HAVE_LOOPIF (0)

Expand Down Expand Up @@ -94,11 +92,11 @@
#define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT (0)
#define LWIP_ND6_TCP_REACHABILITY_HINTS (0)

#ifdef CHIP_CONFIG_EFR32MG21_PBUF_POOLS
#if defined(EFR32MG21)
#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)
#define PBUF_POOL_BUFSIZE (1280)
#define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL)
#define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE)
Expand All @@ -121,7 +119,7 @@
#define PBUF_LINK_HLEN (0)

#if defined(EFR32MG21)
#define TCPIP_THREAD_STACKSIZE (1300)
#define TCPIP_THREAD_STACKSIZE (1536)
#else
#define TCPIP_THREAD_STACKSIZE (2048)
#endif
Expand All @@ -142,9 +140,7 @@
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6

#ifndef LWIP_DEBUG
#define LWIP_DEBUG 1
#endif
#ifdef LWIP_DEBUG

#define MEMP_OVERFLOW_CHECK (0)
#define MEMP_SANITY_CHECK (0)
Expand Down Expand Up @@ -176,6 +172,7 @@
#define TCP_QLEN_DEBUG (LWIP_DBG_OFF)
#define TCP_RST_DEBUG (LWIP_DBG_OFF)
#define PPP_DEBUG (LWIP_DBG_OFF)
#endif

#define LWIP_DBG_TYPES_ON \
(LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */
Expand Down

0 comments on commit 3424223

Please sign in to comment.