Skip to content

Commit dda3a7e

Browse files
samples: matter: enable LTO by default for release and nRF70
Enable LTO by default for release configuration in all samples and applications and for nRF70. Signed-off-by: Maciej Baczmanski <[email protected]> Co-authored-by: Kamil Kasperczyk <[email protected]>
1 parent c4c374f commit dda3a7e

File tree

27 files changed

+90
-213
lines changed

27 files changed

+90
-213
lines changed

applications/matter_bridge/prj_release.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,9 @@ CONFIG_CHIP_ENABLE_READ_CLIENT=y
5656
# Enable Watchdog
5757
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y
5858

59+
# Enable LTO to decrease the flash usage.
60+
CONFIG_LTO=y
61+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
62+
5963
# Increase heap size to accommodate the memory required for additional bridged devices.
6064
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=16384

applications/matter_bridge/sample.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tests:
2020
tags:
2121
- sysbuild
2222
- ci_applications_matter
23-
applications.matter_bridge.lto:
23+
applications.matter_bridge:
2424
sysbuild: true
2525
build_only: true
2626
extra_args:
@@ -37,7 +37,7 @@ tests:
3737
tags:
3838
- sysbuild
3939
- ci_applications_matter
40-
applications.matter_bridge.lto.br_ble:
40+
applications.matter_bridge.br_ble:
4141
sysbuild: true
4242
build_only: true
4343
extra_args:
@@ -74,7 +74,7 @@ tests:
7474
tags:
7575
- sysbuild
7676
- ci_applications_matter
77-
applications.matter_bridge.lto.br_ble.smp_dfu:
77+
applications.matter_bridge.br_ble.smp_dfu:
7878
sysbuild: true
7979
build_only: true
8080
extra_args:
@@ -88,7 +88,7 @@ tests:
8888
tags:
8989
- sysbuild
9090
- ci_applications_matter
91-
applications.matter_bridge.lto.nrf5340.wifi:
91+
applications.matter_bridge.nrf5340.wifi:
9292
sysbuild: true
9393
build_only: true
9494
extra_args:
@@ -105,7 +105,7 @@ tests:
105105
tags:
106106
- sysbuild
107107
- ci_applications_matter
108-
applications.matter_bridge.lto.br_ble.nrf54h20.wifi:
108+
applications.matter_bridge.br_ble.nrf54h20.wifi:
109109
sysbuild: true
110110
build_only: true
111111
extra_args:
@@ -134,7 +134,7 @@ tests:
134134
tags:
135135
- sysbuild
136136
- ci_applications_matter
137-
applications.matter_bridge.lto.br_ble.memory_profiling:
137+
applications.matter_bridge.br_ble.memory_profiling:
138138
sysbuild: true
139139
build_only: true
140140
extra_args:
@@ -145,17 +145,15 @@ tests:
145145
- CONFIG_BRIDGE_MIGRATE_VERSION_1=n
146146
- CONFIG_WIFI_NM_WPA_SUPPLICANT_WPA3=n
147147
integration_platforms:
148-
- nrf7002dk/nrf5340/cpuapp
149148
- nrf5340dk/nrf5340/cpuapp
150149
- nrf54h20dk/nrf54h20/cpuapp
151150
platform_allow:
152-
- nrf7002dk/nrf5340/cpuapp
153151
- nrf5340dk/nrf5340/cpuapp
154152
- nrf54h20dk/nrf54h20/cpuapp
155153
tags:
156154
- sysbuild
157155
- ci_applications_matter
158-
applications.matter_bridge.lto.smart_plug:
156+
applications.matter_bridge.smart_plug:
159157
sysbuild: true
160158
build_only: true
161159
extra_args:

applications/matter_weather_station/prj_release.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n
6969
# Enable Watchdog
7070
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y
7171

72+
# Enable LTO
73+
CONFIG_LTO=y
74+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
75+
7276
# Enable Diagnostic Logs feature
7377
CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS=y
7478
CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_CRASH_LOGS=y

applications/matter_weather_station/sample.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,6 @@ tests:
4545
tags:
4646
- sysbuild
4747
- ci_applications_matter
48-
applications.matter_weather_station.lto:
49-
sysbuild: true
50-
build_only: true
51-
extra_args:
52-
- OVERLAY_CONFIG=overlay-factory_data.conf
53-
- FILE_SUFFIX=factory_data
54-
- CONFIG_CHIP_FACTORY_DATA=y
55-
- SB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y
56-
- CONFIG_LTO=y
57-
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
58-
platform_allow: thingy53/nrf5340/cpuapp
59-
platform_exclude: thingy53/nrf5340/cpuapp/ns
60-
integration_platforms:
61-
- thingy53/nrf5340/cpuapp
62-
tags:
63-
- sysbuild
64-
- ci_applications_matter
6548
applications.matter_weather_station.nrf7002eb:
6649
sysbuild: true
6750
build_only: true

doc/nrf/protocols/matter/getting_started/memory_optimization.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ You can reduce the memory usage of your Matter application by enabling Link Time
4646

4747
LTO is an advanced compilation technique that performs optimization across all compiled units of an application at the link stage, rather than within each unit separately.
4848

49+
LTO is enabled by default for:
50+
51+
- The :ref:`matter_bridge_app` application.
52+
- The ``release`` configuration of the :ref:`matter_samples` and the :ref:`matter_weather_station_app`.
53+
- The ``nrf7002dk/nrf5340/cpuapp`` build target in the :ref:`matter_samples`.
54+
55+
4956
To enable LTO, set the :kconfig:option:`CONFIG_LTO` and :kconfig:option:`CONFIG_ISR_TABLES_LOCAL_DECLARATION` Kconfig options to ``y``.
5057

5158
.. _ug_matter_device_memory_profiling:

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ Matter Bridge
207207

208208
* Enabled SUIT DFU support for the :ref:`matter_bridge_app` application.
209209
Currently, only the Matter OTA protocol is fully supported for SUIT DFU purposes.
210+
* Enabled Link Time Optimization (LTO) by default for the ``release`` configuration.
210211

211212
nRF5340 Audio
212213
-------------
@@ -244,7 +245,7 @@ Serial LTE modem
244245
Thingy:53: Matter weather station
245246
---------------------------------
246247

247-
|no_changes_yet_note|
248+
* Enabled Link Time Optimization (LTO) by default for the ``release`` configuration.
248249

249250
Samples
250251
=======
@@ -374,6 +375,7 @@ Matter samples
374375
* Updated the :ref:`matter_template_sample` sample document with the instructions on how to build the sample on the nRF54L15 DK with support for Matter OTA DFU and DFU over Bluetooth SMP, and using internal MRAM only.
375376
* Enabled SUIT DFU support for the :ref:`matter_lock_sample`, and :ref:`matter_template_sample` samples.
376377
Currently, only the Matter OTA protocol is fully supported for SUIT DFU purposes.
378+
* Enabled Link Time Optimization (LTO) by default for the ``release`` configuration and ``nrf7002dk/nrf5340/cpuapp`` build target.
377379

378380
Networking samples
379381
------------------
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
# Enable LTO to decrease the flash usage.
8+
CONFIG_LTO=y
9+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

samples/matter/light_bulb/prj_release.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y
5050

5151
# Enable Watchdog
5252
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y
53+
54+
# Enable LTO to decrease the flash usage.
55+
CONFIG_LTO=y
56+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

samples/matter/light_bulb/sample.yaml

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,6 @@ tests:
4040
tags:
4141
- sysbuild
4242
- ci_samples_matter
43-
sample.matter.light_bulb.lto:
44-
sysbuild: true
45-
build_only: true
46-
extra_args:
47-
- CONFIG_LTO=y
48-
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
49-
integration_platforms:
50-
- nrf52840dk/nrf52840
51-
- nrf5340dk/nrf5340/cpuapp
52-
- nrf7002dk/nrf5340/cpuapp
53-
- nrf54l15dk/nrf54l15/cpuapp
54-
platform_allow:
55-
- nrf52840dk/nrf52840
56-
- nrf5340dk/nrf5340/cpuapp
57-
- nrf7002dk/nrf5340/cpuapp
58-
- nrf54l15dk/nrf54l15/cpuapp
59-
tags:
60-
- sysbuild
61-
- ci_samples_matter
6243
sample.matter.light_bulb.ffs:
6344
sysbuild: true
6445
build_only: true
@@ -114,24 +95,11 @@ tests:
11495
- nrf52840dk/nrf52840
11596
- nrf5340dk/nrf5340/cpuapp
11697
- nrf54l15dk/nrf54l15/cpuapp
98+
- nrf7002dk/nrf5340/cpuapp
11799
integration_platforms:
118100
- nrf52840dk/nrf52840
119101
- nrf5340dk/nrf5340/cpuapp
120102
- nrf54l15dk/nrf54l15/cpuapp
121-
tags:
122-
- sysbuild
123-
- ci_samples_matter
124-
sample.matter.light_bulb.lto.memory_profiling.persistent_subscriptions:
125-
sysbuild: true
126-
build_only: true
127-
extra_args:
128-
- CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS=y
129-
- CONFIG_CHIP_MEMORY_PROFILING=y
130-
- CONFIG_SHELL_MINIMAL=y
131-
- CONFIG_LTO=y
132-
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
133-
platform_allow: nrf7002dk/nrf5340/cpuapp
134-
integration_platforms:
135103
- nrf7002dk/nrf5340/cpuapp
136104
tags:
137105
- sysbuild
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
# Enable LTO to decrease the flash usage.
8+
CONFIG_LTO=y
9+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

0 commit comments

Comments
 (0)