In zcl_options.h:
/* Create a shared device - a container for clusters shared between multiple
* endpoints, including basic, identify, power configuration, commissioning etc.
*/
#define SHARED_CLUSTERS
#define BASIC_SHARED
#define POWER_CONFIGURATION_SHARED
#define COMMISSIONING_SHARED
In your application, dont forget if you need to reset the cluster using 'memset' like
in various NXP examples, dont forget to set/preserve the devices pointer to the shared cluster instance...
memset(&sDevices.sTemperatureDevice,0,sizeof(tsHA_TemperatureSensorDevice));
#if (defined SHARED_CLUSTERS) && (defined POWER_CONFIGURATION_SHARED )
sDevices.sTemperatureDevice.psPowerConfigServerCluster = &sShared.sPowerConfigServerCluster;
#endif
Apart from the small gotcha above, it works really well.
Using shared clusters are an option, reduce overall flash size and memory size, and saves work because
now you don't need to populate identical clusters on other endpoints. Everything else works as normal.
If you don't want to use shared clusters just remove the define statements from zcl_options mentioned
above and it will work as originally intended by NXP.
I've included a .zip containing a directory structure for JN-SW-4170/Components. It includes the
small Shared.h file and modified NXP temperature_sensor.h/.c files as examples.
Components\ZCL\Clusters\General\Include\Shared.h
Components\ZCL\Devices\ZHA\HVAC\Include\temperature_sensor.h
Components\ZCL\Devices\ZHA\HVAC\Source\temperature_sensor.c
Hope it helps!