This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: Reduce Flash usage on ZStack3.0

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Hello,

I was trying to port an old product (CC2530) to the new stack zigbee 3.0 HA but I'm running into some issues because of insufficient flash space.

Is there any way to reduce the stack flash usage? Maybe removing some features?

When I try to compile the "genericApp" with no added code and the folowing simbols enabled it already occupies 244 570 bytes of code space.

OSALMEM_METRICS
BDB_REPORTING
OTA_CLIENT=TRUE
OTA_HA
ISR_KEYINTERRUPT
SECURE=1
TC_LINKKEY_JOIN
NV_INIT
NV_RESTORE
MULTICAST_ENABLED=FALSE
ZCL_READ
ZCL_WRITE
ZCL_BASIC
ZCL_IDENTIFY
ZCL_DISCOVER
ZCL_ON_OFF
ZCL_SCENES
ZCL_GROUPS

I've been looking around on the header files for features to disable and haven't had much success so far.

  • Hi,

    If you intend to go through Zigbee 3.0 certification with whatever device you are porting to Z-Stack 3.0, there are some features you will not be able to remove depending on which device type you are developing.

    However, if you are doing a proprietary solution with Z-Stack 3.0, here are some compile flags you can add/remove to save code space:

    Add:
    DISABLE_GREENPOWER_BASIC_PROXY
    HAL_LCD=FALSE
    HAL_ADC=FALSE
    HAL_UART=FALSE

    Remove (if present):
    OSALMEM_METRICS
    BDB_REPORTING
    LCD_SUPPORTED=DEBUG
    LEGACY_LCD_DEBUG
    OTA_CLIENT=TRUE
    OTA_HA
    ZTOOL_P1
    Any MT_*** modules you are not using (e.g. MT_TASK)
    Any ZCL_*** clusters you are not using (e.g. ZCL_READ)

    You can also increase the default number of Virtual Registers from 16 to 24 (Project settings > general options > Target > Number of virtual registers). Any number greater than 24 caused linking errors due to IDATA stack size and also generated larger code.