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.

Reduce size of z-stack

Other Parts Discussed in Thread: CC2531, Z-STACK

Hi all!!

I am working with IAR EW and CC2531- 256 KB. I would like to know how I could reduce the size of the z-stack of my zigbee application. The question is that we want to implement the OAD funcionality too and we don't have an external flash. So the size of the resulting binary should be the half size of the internal flash of the CC2531,  128 KB, instead of 159 KB.

I have realized when I take a look at the file .map, that modules like OSAL_Nv, AddrMgr, mac_beacon or nwk, take a lot of memory. So I would like to know if there is any possibility some modification to reduce the size of them. Below, it is shown the size of each module of the application.

Module                                                      CODE             DATA            XDATA        IDATA       BIT       CONST
----------                                                      ---------             --------            ----------        ---------       ----       -----------
                                                                     (Rel)         (Rel)  (Abs)          (Rel)           (Rel)       (Rel)        (Rel)
?ADD_XSTACK_DISP8                            27
?ALLOC_XSTACK8                                   22
?BANKED_CODE_SUPPORT                 66
?BANKED_ENTER_XDATA                   102
?BANKED_LEAVE_XDATA                      62
?CALL_IND                                                    2
?CHECKSUM                                                2
?C_GPTR_LOAD                                       26
?DEALLOC_XSTACK8                             26
?FILLER_BYTES                                  8 495
  + common                                                134
?FLT_ADD                                                572
?FLT_DIV                                                  486
?FLT_EQ                                                      44
?FLT_GE                                                      79
?FLT_LT                                                       76
?FLT_MUL                                                 384
?FLT_TEST_INF                                         21
?FLT_TEST_INF_R1                                 21
?FLT_TEST_NAN                                      15
?FLT_TEST_NAN_R1                               15
?FLT_TEST_ZERO                                    10
?FLT_TEST_ZERO_R1                            10
?FLT_TO_L                                               143
?INTERRUPT_ENTER_XSP                   95
?INTERRUPT_LEAVE_XSP                    80
?L_ADD                                                       19
?L_ADD_TO_X                                           19
?L_ADD_X                                                  19
?L_AND                                                       19
?L_AND_TO_X                                           19
?L_AND_X                                                  19
?L_DIV_MOD                                              87
?L_EQ_X                                                     21
?L_IOR                                                         19
?L_MOV_TO_X                                          15
?L_MOV_X                                                  15
?L_MUL                                                     128
?L_NEG                                                       20
?L_NEG_R1                                               17
?L_NOT                                                       16
?L_SHL                                                       31
?L_SUB_FROM_X                                    20
?L_TO_FLT                                              120
?MOVE_LONG8_XDATA_CODE          34
?MOVE_LONG8_XDATA_IDATA          13
?MOVE_LONG8_XDATA_XDATA        33
?POP_BIT_ISP                                          19
?PUSH_XSTACK8_C                              45
?PUSH_XSTACK8_X                               49
?PUSH_XSTACK_I                                   27
?SL_GT                                                       21
?SL_GT_X                                                  21
?SS_SHR                                                   16
?S_DIV_MOD                                          154
?S_SHL                                                       19
?UC_JMP_IF_IN_RANGE                       31
?UC_JMP_IF_VALUE                              22
?UC_SWITCH_DENSE                           54
?UC_SWITCH_SPARSE                         42
?UL_DIV_MOD                                       112
?UL_GT                                                       16
?UL_GT_X                                                  16
?UL_SHR                                                   25
?US_JMP_IF_IN_RANGE                       63
?US_JMP_IF_VALUE                              43
?US_SHR                                                   15
?US_SWITCH_DENSE                            70
?US_SWITCH_SPARSE                         76
?XSTACK_DISP8                                      10
?atoi                                                           153
?cexit                                                              5
?cmain                                                         88
?ctype                                                        129
?largewr                                                 4 217                                             89
?memcmp                                                    95
?memcpy                                                     78
?memset                                                      53
?sprintf                                                       172
?strcat                                                           60
?strchr                                                           50
?strcmp                                                         87
?strcpy                                                          46
?strlen                                                          36
AF                                                            2 532                                              3
APS                                                         8 513                                            47
AddrMgr                                               18 136                                            52
CSTARTUP                                                 16
  + common                                                    3
OSAL                                                      1 837                                               2
  + shared                                                                                     1
OSAL_Clock                                             333                                            10
  + shared                                                                                                                                                             12
OSAL_Memory                                         546                                       2 054
OSAL_Nv                                             16 615                                             27
OSAL_PwrMgr                                            44                                               7
OSAL_SSLFAppOAD                          4 638                           2             413                                                182
  + shared                                                                                    6                                                                       28
OSAL_Timers                                           990                                               6
OnBoard                                                    157                                               8
  + shared                                                                                    1
SSLFAppOAD                                    10 243                                             17                                                 338
  + shared                                                                                                                                                                8
VIRTUAL_REGISTERS                                                2                                                                8
ZDApp                                                    2 694                                             31
  + shared                                                                                     1
ZDConfig                                                   105                                             15
ZDNwkMgr                                                                                                    10
ZDObject                                                6 513                                             56
ZDProfile                                                3 851                                             86
ZDSecMgr                                                   34
ZGlobals                                                    537                                             64
ZMain                                                         585                                                                                                       8
  + shared                                                                                     4
hal_adc                                                      356                           6
  + shared                                                                                     1
hal_assert                                                  465                                                1                                                     4
  + shared                                                                                     1
hal_dma                                                       23                           4                 40
hal_drivers                                                 142                                                1
hal_flash                                                     369                          2                 35
  + shared                                                                                     1
hal_led                                                     1 051                                             39
  + shared                                                                                                                                                                 4
hal_oad                                                    1 173                         2                                                                        12
  + shared                                                                                                                                                                 4
hal_sleep                                                         7                         6
  + shared                                                      46                          2                                                                          4
  + common
hal_startup                                                    11
hal_timer                                                     421                        11                 30
  + common                                                 102
hal_uart                                                         32
mac_autopend                                       1 263                                                 4
mac_backoff_timer                                   576                                                 9                                                    4
  + shared                                                                                     3
mac_beacon                                        15 472                                             246                                                   4
mac_cfg                                                           5                                                                                                       5
mac_csp_tx                                                762                           1
  + shared                                                                                      7
mac_low_level                                          152
mac_mcu                                                1 198                            7                    8                                                   4
  + shared                                                   134                            1
  + common
mac_mem                                                  179                            1
mac_radio                                                  735                                                  7
mac_radio_defs                                        106
mac_rx                                                     2 206                                                19
mac_rx_onoff                                             377                                                  2
mac_sleep                                                    71                                                  1
mac_tx                                                         992                                                  8
nwk                                                         24 270                                             176                                                   8
nwk_globals                                               351                                          1 362
oad_app                                                  3 959                                                41                                                22
saddr                                                           280
sslcom-parser                                         2 971                                             905                                                32
sslcom-rx                                                     914                                             484                                                  4
zmac                                                         1 033                                                  6
zmac_cb                                                      958                                                  2
N/A (command line)                                                     24                             640          192
N/A (alignment)
-------------------------------                     -----------          -----       ------        ----------         -------          --------      ------
Total:                                                    159 618           26          71            7 063          192                8           687
  + common                                                 134

 


 151 257 bytes of CODE  memory (+             8 495 range fill )
      26       bytes of DATA  memory (+ 71 absolute )
   7 063     bytes of XDATA memory
     192      bytes of IDATA memory
       8       bits  of BIT   memory
     687     bytes of CONST memory

 

Regards,

Arantxa