Cluster List是z-stack中一个RAM开销大户,能否把Cluster List建立在Code区?
Yue TANG:
定义cluster时都有使用const,显然是放在code区。
const cId_t ipdInClusterList[IPD_MAX_INCLUSTERS] =
{ ZCL_CLUSTER_ID_GEN_BASIC, ZCL_CLUSTER_ID_GEN_IDENTIFY, ZCL_CLUSTER_ID_GEN_TIME, ZCL_CLUSTER_ID_SE_PRICING, ZCL_CLUSTER_ID_SE_MESSAGE};
#define IPD_MAX_OUTCLUSTERS 5const cId_t ipdOutClusterList[IPD_MAX_OUTCLUSTERS] ={ ZCL_CLUSTER_ID_GEN_BASIC, ZCL_CLUSTER_ID_GEN_IDENTIFY, ZCL_CLUSTER_ID_GEN_TIME, ZCL_CLUSTER_ID_SE_PRICING, ZCL_CLUSTER_ID_SE_MESSAGE};
Aries Lord:
回复 Yue TANG:
IAR 8051里面,const不等于code区,应该是CONST才是定义在code区。
Yue TANG:
回复 Aries Lord:
Static and global objects declared const and located in memories using the memory
attributes __code, __far_code, and __huge_codeare allocated in ROM. For all other memory attributes, the objects are allocated in RAM and initialized by the runtime system at startup.
const只是表示不可变,但仍然放在RAM中