Skip to content

Commit d81b54b

Browse files
kkasperczyk-norlubos
authored andcommitted
samples: matter: Decreased memory usage in bridge and light bulb
Decreased memory usage in: * Light bulb by disabling Scenes cluster * Bridge by enabling LTO for debug build Signed-off-by: Kamil Kasperczyk <[email protected]>
1 parent 609bf2c commit d81b54b

File tree

13 files changed

+463
-1049
lines changed

13 files changed

+463
-1049
lines changed

applications/matter_bridge/prj.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ CONFIG_USE_SEGGER_RTT=n
4646
# Enable Factory Data feature
4747
CONFIG_CHIP_FACTORY_DATA=y
4848
CONFIG_CHIP_FACTORY_DATA_BUILD=y
49+
50+
# Enable LTO to decrease the flash usage.
51+
CONFIG_LTO=y
52+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

applications/matter_bridge/sample.yaml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ sample:
22
description: Matter Bridge
33
name: Matter Bridge application
44
tests:
5-
applications.matter_bridge.debug:
6-
sysbuild: true
7-
build_only: true
8-
extra_args: CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n
9-
CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y
10-
integration_platforms:
11-
- nrf7002dk/nrf5340/cpuapp
12-
platform_allow: nrf7002dk/nrf5340/cpuapp
13-
tags: sysbuild
145
applications.matter_bridge.release:
156
sysbuild: true
167
build_only: true
@@ -26,12 +17,11 @@ tests:
2617
build_only: true
2718
extra_args: CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n
2819
CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y
29-
CONFIG_LTO=y CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
3020
integration_platforms:
3121
- nrf7002dk/nrf5340/cpuapp
3222
platform_allow: nrf7002dk/nrf5340/cpuapp
3323
tags: sysbuild
34-
applications.matter_bridge.smp_dfu:
24+
applications.matter_bridge.lto.smp_dfu:
3525
sysbuild: true
3626
build_only: true
3727
extra_args: CONFIG_CHIP_DFU_OVER_BT_SMP=y
@@ -41,7 +31,7 @@ tests:
4131
- nrf7002dk/nrf5340/cpuapp
4232
platform_allow: nrf7002dk/nrf5340/cpuapp
4333
tags: sysbuild
44-
applications.matter_bridge.br_ble:
34+
applications.matter_bridge.lto.br_ble:
4535
sysbuild: true
4636
build_only: true
4737
extra_args: CONFIG_BRIDGED_DEVICE_BT=y
@@ -61,18 +51,7 @@ tests:
6151
- nrf7002dk/nrf5340/cpuapp
6252
platform_allow: nrf7002dk/nrf5340/cpuapp
6353
tags: sysbuild
64-
applications.matter_bridge.lto.br_ble:
65-
sysbuild: true
66-
build_only: true
67-
extra_args: CONFIG_BRIDGED_DEVICE_BT=y
68-
CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n
69-
CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y
70-
CONFIG_LTO=y CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
71-
integration_platforms:
72-
- nrf7002dk/nrf5340/cpuapp
73-
platform_allow: nrf7002dk/nrf5340/cpuapp
74-
tags: sysbuild
75-
applications.matter_bridge.nrf70ek:
54+
applications.matter_bridge.lto.nrf70ek:
7655
sysbuild: true
7756
build_only: true
7857
extra_args: matter_bridge_SHIELD=nrf7002ek SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y
@@ -83,7 +62,7 @@ tests:
8362
- nrf5340dk/nrf5340/cpuapp
8463
platform_allow: nrf5340dk/nrf5340/cpuapp
8564
tags: sysbuild
86-
applications.matter_bridge.memory_profiling:
65+
applications.matter_bridge.lto.memory_profiling:
8766
sysbuild: true
8867
build_only: true
8968
extra_args: CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n

samples/matter/light_bulb/src/light_bulb.matter

Lines changed: 0 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,155 +1645,6 @@ cluster GroupKeyManagement = 63 {
16451645
fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4;
16461646
}
16471647

1648-
/** Attributes and commands for scene configuration and manipulation. */
1649-
provisional cluster ScenesManagement = 98 {
1650-
revision 1;
1651-
1652-
bitmap CopyModeBitmap : bitmap8 {
1653-
kCopyAllScenes = 0x1;
1654-
}
1655-
1656-
bitmap Feature : bitmap32 {
1657-
kSceneNames = 0x1;
1658-
}
1659-
1660-
struct AttributeValuePair {
1661-
attrib_id attributeID = 0;
1662-
int32u attributeValue = 1;
1663-
}
1664-
1665-
struct ExtensionFieldSet {
1666-
cluster_id clusterID = 0;
1667-
AttributeValuePair attributeValueList[] = 1;
1668-
}
1669-
1670-
fabric_scoped struct SceneInfoStruct {
1671-
int8u sceneCount = 0;
1672-
fabric_sensitive int8u currentScene = 1;
1673-
fabric_sensitive group_id currentGroup = 2;
1674-
fabric_sensitive boolean sceneValid = 3;
1675-
int8u remainingCapacity = 4;
1676-
fabric_idx fabricIndex = 254;
1677-
}
1678-
1679-
readonly attribute optional nullable node_id lastConfiguredBy = 0;
1680-
readonly attribute int16u sceneTableSize = 1;
1681-
readonly attribute SceneInfoStruct fabricSceneInfo[] = 2;
1682-
readonly attribute command_id generatedCommandList[] = 65528;
1683-
readonly attribute command_id acceptedCommandList[] = 65529;
1684-
readonly attribute event_id eventList[] = 65530;
1685-
readonly attribute attrib_id attributeList[] = 65531;
1686-
readonly attribute bitmap32 featureMap = 65532;
1687-
readonly attribute int16u clusterRevision = 65533;
1688-
1689-
request struct AddSceneRequest {
1690-
group_id groupID = 0;
1691-
int8u sceneID = 1;
1692-
int32u transitionTime = 2;
1693-
char_string sceneName = 3;
1694-
ExtensionFieldSet extensionFieldSets[] = 4;
1695-
}
1696-
1697-
response struct AddSceneResponse = 0 {
1698-
status status = 0;
1699-
group_id groupID = 1;
1700-
int8u sceneID = 2;
1701-
}
1702-
1703-
request struct ViewSceneRequest {
1704-
group_id groupID = 0;
1705-
int8u sceneID = 1;
1706-
}
1707-
1708-
response struct ViewSceneResponse = 1 {
1709-
status status = 0;
1710-
group_id groupID = 1;
1711-
int8u sceneID = 2;
1712-
optional int32u transitionTime = 3;
1713-
optional char_string sceneName = 4;
1714-
optional ExtensionFieldSet extensionFieldSets[] = 5;
1715-
}
1716-
1717-
request struct RemoveSceneRequest {
1718-
group_id groupID = 0;
1719-
int8u sceneID = 1;
1720-
}
1721-
1722-
response struct RemoveSceneResponse = 2 {
1723-
status status = 0;
1724-
group_id groupID = 1;
1725-
int8u sceneID = 2;
1726-
}
1727-
1728-
request struct RemoveAllScenesRequest {
1729-
group_id groupID = 0;
1730-
}
1731-
1732-
response struct RemoveAllScenesResponse = 3 {
1733-
status status = 0;
1734-
group_id groupID = 1;
1735-
}
1736-
1737-
request struct StoreSceneRequest {
1738-
group_id groupID = 0;
1739-
int8u sceneID = 1;
1740-
}
1741-
1742-
response struct StoreSceneResponse = 4 {
1743-
status status = 0;
1744-
group_id groupID = 1;
1745-
int8u sceneID = 2;
1746-
}
1747-
1748-
request struct RecallSceneRequest {
1749-
group_id groupID = 0;
1750-
int8u sceneID = 1;
1751-
optional nullable int32u transitionTime = 2;
1752-
}
1753-
1754-
request struct GetSceneMembershipRequest {
1755-
group_id groupID = 0;
1756-
}
1757-
1758-
response struct GetSceneMembershipResponse = 6 {
1759-
status status = 0;
1760-
nullable int8u capacity = 1;
1761-
group_id groupID = 2;
1762-
optional int8u sceneList[] = 3;
1763-
}
1764-
1765-
request struct CopySceneRequest {
1766-
CopyModeBitmap mode = 0;
1767-
group_id groupIdentifierFrom = 1;
1768-
int8u sceneIdentifierFrom = 2;
1769-
group_id groupIdentifierTo = 3;
1770-
int8u sceneIdentifierTo = 4;
1771-
}
1772-
1773-
response struct CopySceneResponse = 64 {
1774-
status status = 0;
1775-
group_id groupIdentifierFrom = 1;
1776-
int8u sceneIdentifierFrom = 2;
1777-
}
1778-
1779-
/** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
1780-
fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
1781-
/** Retrieves the requested scene entry from its Scene table. */
1782-
fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
1783-
/** Removes the requested scene entry, corresponding to the value of the GroupID field, from its Scene Table */
1784-
fabric command access(invoke: manage) RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2;
1785-
/** Remove all scenes, corresponding to the value of the GroupID field, from its Scene Table */
1786-
fabric command access(invoke: manage) RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3;
1787-
/** Adds the scene entry into its Scene Table along with all extension field sets corresponding to the current state of other clusters on the same endpoint */
1788-
fabric command access(invoke: manage) StoreScene(StoreSceneRequest): StoreSceneResponse = 4;
1789-
/** Set the attributes and corresponding state for each other cluster implemented on the endpoint accordingly to the resquested scene entry in the Scene Table */
1790-
fabric command RecallScene(RecallSceneRequest): DefaultSuccess = 5;
1791-
/** Get an unused scene identifier when no commissioning tool is in the network, or for a commissioning tool to get the used scene identifiers within a certain group */
1792-
fabric command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6;
1793-
/** Allows a client to efficiently copy scenes from one group/scene identifier pair to another group/scene identifier pair. */
1794-
fabric command CopyScene(CopySceneRequest): CopySceneResponse = 64;
1795-
}
1796-
17971648
endpoint 0 {
17981649
device type ma_rootdevice = 22, version 2;
17991650

@@ -2206,33 +2057,6 @@ endpoint 1 {
22062057
callback attribute featureMap;
22072058
callback attribute clusterRevision;
22082059
}
2209-
2210-
server cluster ScenesManagement {
2211-
ram attribute lastConfiguredBy;
2212-
ram attribute sceneTableSize default = 16;
2213-
callback attribute fabricSceneInfo;
2214-
callback attribute generatedCommandList;
2215-
callback attribute acceptedCommandList;
2216-
callback attribute eventList;
2217-
callback attribute attributeList;
2218-
ram attribute featureMap default = 1;
2219-
ram attribute clusterRevision default = 1;
2220-
2221-
handle command AddScene;
2222-
handle command AddSceneResponse;
2223-
handle command ViewScene;
2224-
handle command ViewSceneResponse;
2225-
handle command RemoveScene;
2226-
handle command RemoveSceneResponse;
2227-
handle command RemoveAllScenes;
2228-
handle command RemoveAllScenesResponse;
2229-
handle command StoreScene;
2230-
handle command StoreSceneResponse;
2231-
handle command RecallScene;
2232-
handle command GetSceneMembership;
2233-
handle command GetSceneMembershipResponse;
2234-
handle command CopyScene;
2235-
}
22362060
}
22372061

22382062

0 commit comments

Comments
 (0)