From 3424223935b8980636e3ac45303b6181173e757a Mon Sep 17 00:00:00 2001 From: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com> Date: Tue, 8 Jun 2021 10:30:50 -0400 Subject: [PATCH] Reduce Lwip memory pool counts and size for MG21 (#7431) 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 --- examples/lighting-app/efr32/BUILD.gn | 2 +- examples/lock-app/efr32/src/ZclCallbacks.cpp | 6 +----- .../efr32/project_include/OpenThreadConfig.h | 2 ++ src/lwip/efr32/lwipopts.h | 17 +++++++---------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 3e445d48791f6d..b9b80e40c2167e 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -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) { diff --git a/examples/lock-app/efr32/src/ZclCallbacks.cpp b/examples/lock-app/efr32/src/ZclCallbacks.cpp index d788323e27c0ce..1ed3b13965a7b6 100644 --- a/examples/lock-app/efr32/src/ZclCallbacks.cpp +++ b/examples/lock-app/efr32/src/ZclCallbacks.cpp @@ -23,18 +23,14 @@ #include "AppConfig.h" #include "BoltLockManager.h" -#include #include #include -#include #include -#include -#include 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) { diff --git a/examples/platform/efr32/project_include/OpenThreadConfig.h b/examples/platform/efr32/project_include/OpenThreadConfig.h index 422e71d9160934..1569c08558848a 100644 --- a/examples/platform/efr32/project_include/OpenThreadConfig.h +++ b/examples/platform/efr32/project_include/OpenThreadConfig.h @@ -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 diff --git a/src/lwip/efr32/lwipopts.h b/src/lwip/efr32/lwipopts.h index 4bf3cdedd246c6..46f1624e8a23d7 100644 --- a/src/lwip/efr32/lwipopts.h +++ b/src/lwip/efr32/lwipopts.h @@ -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) @@ -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) @@ -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 @@ -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) @@ -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) */