Z-STACK中XDATA数据占用情况分析

时间:2022-09-07 08:55:58

下面的例子是针对TIZStack-CC2530-2.5.0中的SerialApp例程(非官方例程)进行编译剖析,通过查看编译输出的MAP文件来了解XDATA的大致情况。

我们知道CC25308K的内存,这部分就是XDATA的大小,官方例程编译完成已经用了7K左右的内存了,剩余给我们使用的内存并不多。一旦我们想要扩大部分参数的时候,这点内存就显得捉襟见肘了。

XDATA是用于静态变量,包括全局变量和本地变量,如全局变量中的路由表,绑定表,以及协议栈使用的内存堆等,以及本地变量如ZDP_BUF等。下面罗列出几个占用XDATA较多的静态变量,开发者如果想要节省出部分XDATA用于自己的程序,需要评估自己的应用情况,酌情减少一些静态变量,不要影响到自己原来功能的稳定性。

 

1.theHeap 2600 bytes.

  Relative segment, address: XDATA 000011D3 - 00001BFA (0xa28 bytes), align: 0

  Segment part 7.             Intra module refs:   osal_mem_alloc

                                                   osal_mem_free

                                                   osal_mem_init

           LOCAL                   ADDRESS         

           =====                   =======         

           theHeap                 000011D3 

 

2.ZDP_Buf 80 bytes.

  Relative segment, address: XDATA 000005DB - 0000062A (0x50 bytes), align: 0

  Segment part 8.             Intra module refs:   ?Subroutine52

                                                   Segment part 10

                                                   ZDP_MgmtNwkUpdateNotify

                                                   ZDP_MgmtRtgRsp

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           ZDP_Buf                 000005DB 

 

3. app_AtProcess::buf 这是函数中的静态缓冲 180 bytes.

  Relative segment, address: XDATA 00000671 - 00000724 (0xb4 bytes), align: 0

  Segment part 160.           Intra module refs:   ?Subroutine34

                                                   app_AtProcess

           LOCAL                   ADDRESS         

           =====                   =======         

           app_AtProcess::buf      00000671 

 

4.SerialApp_TxBuf  81 bytes.

  Relative segment, address: XDATA 0000072A - 0000077A (0x51 bytes), align: 0

  Segment part 23.            Intra module refs:   app_AuxDataSend

           LOCAL                   ADDRESS         

           =====                   =======         

           SerialApp_TxBuf         0000072A 

 

5.SerialApp_ChildBuf 44 bytes.

  Relative segment, address: XDATA 000007CB - 000007F6 (0x2c bytes), align: 0

  Segment part 30.            Intra module refs:   ?Subroutine25

                                                   app_MgrChildQuery

           LOCAL                   ADDRESS         

           =====                   =======         

           SerialApp_ChildBuf      000007CB 

 

6. dmaCh1234 32 bytes.

  Relative segment, address: XDATA 00000807 - 00000826 (0x20 bytes), align: 0

  Segment part 16.            Intra module refs:   HalDmaInit

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           dmaCh1234               00000807        AesDmaSetup (hal_aes)

                                                   HalUARTInitDMA (hal_uart)

                                                   HalUARTPollDMA (hal_uart)

                                                   Segment part 17 (hal_aes)

                                                   aesDmaInit (hal_aes)

 

7. HalLedStatusControl 37 bytes.

  Relative segment, address: XDATA 00000831 - 00000855 (0x25 bytes), align: 0

  Segment part 10.            Intra module refs:   ?Subroutine0

                                                   HalLedBlink

                                                   HalLedSet

                                                   HalLedUpdate

           LOCAL                   ADDRESS         

           =====                   =======         

           HalLedStatusControl     00000831 

 

8.dmaCfg 这边用于串口缓冲等 529 bytes.

  Relative segment, address: XDATA 00000867 - 00000A77 (0x211 bytes), align: 0

  Segment part 26.            Intra module refs:   ?Subroutine10

                                                   ?Subroutine14

                                                   ?Subroutine16

                                                   ?Subroutine18

                                                   ?Subroutine4

                                                   ?Subroutine7

                                                   HalUARTInitDMA

                                                   HalUARTIoctl

                                                   HalUARTIsrDMA

                                                   HalUARTOpenDMA

                                                   HalUARTPollDMA

                                                   HalUARTReadDMA

                                                   HalUARTRxAvailDMA

                                                   HalUARTWriteDMA

                                                   Segment part 59

           LOCAL                   ADDRESS         

           =====                   =======         

           dmaCfg                  00000867 

 

9.macPib 60 bytes.

  Relative segment, address: XDATA 00000A97 - 00000AD2 (0x3c bytes), align: 0

  Segment part 9.             Intra module refs:   MAC_MlmeGetReq

                                                   MAC_MlmeSetReq

                                                   macPibReset

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           macPib                  00000A97    MAC_MlmeResetReq (mac_beacon很多,不列了

 

10. AssociatedDevList 414 bytes.

  Relative segment, address: XDATA 00000AF7 - 00000C94 (0x19e bytes), align: 0

  Segment part 23.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           AssociatedDevList       00000AF7        AssocFindEmpty (AddrMgr)

                                                   AssocGetNextNode (AddrMgr)

                                                   AssocGetWithAddress (AddrMgr)

                                                   AssocInit (AddrMgr)

                                                 AssocMatchDeviceStatus (AddrMgr)

                                                   AssocWriteNV (AddrMgr)

                                                   RTG_BcastAdd (AddrMgr)

                                                   Segment part 165 (AddrMgr)

                                                   Segment part 199 (AddrMgr)

                                                   Segment part 201 (AddrMgr)

                                                   Segment part 208 (AddrMgr)

                                                   Segment part 209 (AddrMgr)

                                                   Segment part 620 (nwk)

                                                   Segment part 625 (AddrMgr)

                                                   Segment part 738 (nwk)

                                                   Segment part 743 (nwk)

                                                   nwkNeighborFindRandom (nwk)

 

11.neighborTable 368 bytes.

  Relative segment, address: XDATA 00000C95 - 00000E04 (0x170 bytes), align: 0

  Segment part 30.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           neighborTable           00000C95      AssocCheckDupNeighbors (AddrMgr)

                                                   RTG_AddRtgEntry (AddrMgr)

                                                   RTG_BcastAdd (AddrMgr)

                                                   Segment part 618 (nwk)

                                                   Segment part 633 (AddrMgr)

                                                   Segment part 695 (nwk)

                                                   Segment part 714 (nwk)

                                                   Segment part 719 (nwk)

                                                   Segment part 740 (nwk)

                                                   Segment part 748 (nwk)

                                                   Segment part 761 (nwk)

                                                   Segment part 762 (nwk)

                                                   Segment part 765 (nwk)

                                                   fun_printNBT (app_at)

                                                 nwkNeighborChangePANID (nwk)

                                                 nwkNeighborFindEmptySlot (nwk)

                                                 nwkNeighborFindRandom (nwk)

                                                 nwkNeighborUpdateNwkAddr (nwk)

 

12.rtgTable 280 bytes.

  Relative segment, address: XDATA 00000E05 - 00000F1C (0x118 bytes), align: 0

  Segment part 35.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           rtgTable                00000E05        ?Subroutine33 (app_at)

                                                   NLME_GetRequest (AddrMgr)

                                                   RTG_AddRtgEntry (AddrMgr)

                                                   RTG_GetRtgEntry (AddrMgr)

                                                   RTG_TimerEvent (AddrMgr)

                                                   RTG_initRtgTable (AddrMgr)

                                                   RTG_nextHopIsBad (AddrMgr)

 

 

13.rtgSrcTable 72 bytes.

  Relative segment, address: XDATA 00000F1D - 00000F64 (0x48 bytes), align: 0

  Segment part 36.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           rtgSrcTable             00000F1D        RTG_AddSrcRtgEntry (AddrMgr)

                                                   RTG_GetRtgSrcIndex (AddrMgr)

                                                   Segment part 472 (AddrMgr)

                                                   Segment part 533 (AddrMgr)

                                                   Segment part 548 (AddrMgr)

 

14.rtgSrcRelayList 源路由转发路径 24 bytes.

  Relative segment, address: XDATA 00000F65 - 00000F7C (0x18 bytes), align: 0

  Segment part 37.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           rtgSrcRelayList         00000F65        NLDE_ParseMsg (nwk)

                                                  RTG_ProcessRrec (AddrMgr)

 

15.rtDiscTable 64 bytes.

  Relative segment, address: XDATA 00000F7D - 00000FBC (0x40 bytes), align: 0

  Segment part 38.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           rtDiscTable             00000F7D      RTG_CheckRtDiscEntry (AddrMgr)

                                                   RTG_GetPrevHop (AddrMgr)

                                                   RTG_GetRtDiscEntry (AddrMgr)

                                                   RTG_TimerEvent (AddrMgr)

                                                 RTG_UpdateRtDiscEntry (AddrMgr)

                                                   Segment part 470 (AddrMgr)

16.bcastTable 168 bytes.

  Relative segment, address: XDATA 00000FBD - 00001064 (0xa8 bytes), align: 0

  Segment part 39.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           bcastTable              00000FBD        RTG_BcastAdd (AddrMgr)

                                                   RTG_BcastChk (AddrMgr)

                                                RTG_BcastTimerHandler (AddrMgr)

                                                   RTG_Init (AddrMgr)

17.bcastHoldHandle 21 bytes.

  Relative segment, address: XDATA 00001065 - 00001079 (0x15 bytes), align: 0

  Segment part 40.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           bcastHoldHandle         00001065        Segment part 600 (AddrMgr)

                                                   Segment part 636 (AddrMgr)

18.bcastHoldAckMask 84 bytes.

  Relative segment, address: XDATA 0000107A - 000010CD (0x54 bytes), align: 0

  Segment part 41.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           bcastHoldAckMask        0000107A        RTG_DataReq (AddrMgr)

                                                   Segment part 640 (AddrMgr)

 

19.BindingTable 56 bytes.

  Relative segment, address: XDATA 000010CE - 00001105 (0x38 bytes), align: 0

  Segment part 54.

           ENTRY                   ADDRESS         REF BY

           =====                   =======         ======

           BindingTable            000010CE        ?Subroutine15 (BindingTable)

                                                   ?Subroutine16 (BindingTable)

                                                   ?Subroutine22 (BindingTable)

                                                   ?Subroutine23 (BindingTable)

                                                   ?Subroutine24 (BindingTable)

                                                   ?Subroutine27 (BindingTable)

                                        GetBindingTableEntry(BindingTable)

                                                   InitBindingTable (BindingTable)

                                                   Segment part 54 (BindingTable)

                                                   Segment part 64 (BindingTable)

                                                   bindAddEntry (BindingTable)

                                                   bindFind (BindingTable)

                                                   bindFindExisting (BindingTable)

                                                   bindNumOfEntries (BindingTable)