Skip to content

Commit

Permalink
samples: matter: enable LTO by default for release and nRF70
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
maciejbaczmanski and kkasperczyk-no committed Feb 4, 2025
1 parent c4c374f commit dda3a7e
Show file tree
Hide file tree
Showing 27 changed files with 90 additions and 213 deletions.
4 changes: 4 additions & 0 deletions applications/matter_bridge/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@ CONFIG_CHIP_ENABLE_READ_CLIENT=y
# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

# Increase heap size to accommodate the memory required for additional bridged devices.
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=16384
16 changes: 7 additions & 9 deletions applications/matter_bridge/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tests:
tags:
- sysbuild
- ci_applications_matter
applications.matter_bridge.lto:
applications.matter_bridge:
sysbuild: true
build_only: true
extra_args:
Expand All @@ -37,7 +37,7 @@ tests:
tags:
- sysbuild
- ci_applications_matter
applications.matter_bridge.lto.br_ble:
applications.matter_bridge.br_ble:
sysbuild: true
build_only: true
extra_args:
Expand Down Expand Up @@ -74,7 +74,7 @@ tests:
tags:
- sysbuild
- ci_applications_matter
applications.matter_bridge.lto.br_ble.smp_dfu:
applications.matter_bridge.br_ble.smp_dfu:
sysbuild: true
build_only: true
extra_args:
Expand All @@ -88,7 +88,7 @@ tests:
tags:
- sysbuild
- ci_applications_matter
applications.matter_bridge.lto.nrf5340.wifi:
applications.matter_bridge.nrf5340.wifi:
sysbuild: true
build_only: true
extra_args:
Expand All @@ -105,7 +105,7 @@ tests:
tags:
- sysbuild
- ci_applications_matter
applications.matter_bridge.lto.br_ble.nrf54h20.wifi:
applications.matter_bridge.br_ble.nrf54h20.wifi:
sysbuild: true
build_only: true
extra_args:
Expand Down Expand Up @@ -134,7 +134,7 @@ tests:
tags:
- sysbuild
- ci_applications_matter
applications.matter_bridge.lto.br_ble.memory_profiling:
applications.matter_bridge.br_ble.memory_profiling:
sysbuild: true
build_only: true
extra_args:
Expand All @@ -145,17 +145,15 @@ tests:
- CONFIG_BRIDGE_MIGRATE_VERSION_1=n
- CONFIG_WIFI_NM_WPA_SUPPLICANT_WPA3=n
integration_platforms:
- nrf7002dk/nrf5340/cpuapp
- nrf5340dk/nrf5340/cpuapp
- nrf54h20dk/nrf54h20/cpuapp
platform_allow:
- nrf7002dk/nrf5340/cpuapp
- nrf5340dk/nrf5340/cpuapp
- nrf54h20dk/nrf54h20/cpuapp
tags:
- sysbuild
- ci_applications_matter
applications.matter_bridge.lto.smart_plug:
applications.matter_bridge.smart_plug:
sysbuild: true
build_only: true
extra_args:
Expand Down
4 changes: 4 additions & 0 deletions applications/matter_weather_station/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n
# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

# Enable Diagnostic Logs feature
CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS=y
CONFIG_NCS_SAMPLE_MATTER_DIAGNOSTIC_LOGS_CRASH_LOGS=y
Expand Down
17 changes: 0 additions & 17 deletions applications/matter_weather_station/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,6 @@ tests:
tags:
- sysbuild
- ci_applications_matter
applications.matter_weather_station.lto:
sysbuild: true
build_only: true
extra_args:
- OVERLAY_CONFIG=overlay-factory_data.conf
- FILE_SUFFIX=factory_data
- CONFIG_CHIP_FACTORY_DATA=y
- SB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y
- CONFIG_LTO=y
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
platform_allow: thingy53/nrf5340/cpuapp
platform_exclude: thingy53/nrf5340/cpuapp/ns
integration_platforms:
- thingy53/nrf5340/cpuapp
tags:
- sysbuild
- ci_applications_matter
applications.matter_weather_station.nrf7002eb:
sysbuild: true
build_only: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ You can reduce the memory usage of your Matter application by enabling Link Time

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.

LTO is enabled by default for:

- The :ref:`matter_bridge_app` application.
- The ``release`` configuration of the :ref:`matter_samples` and the :ref:`matter_weather_station_app`.
- The ``nrf7002dk/nrf5340/cpuapp`` build target in the :ref:`matter_samples`.


To enable LTO, set the :kconfig:option:`CONFIG_LTO` and :kconfig:option:`CONFIG_ISR_TABLES_LOCAL_DECLARATION` Kconfig options to ``y``.

.. _ug_matter_device_memory_profiling:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Matter Bridge

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

nRF5340 Audio
-------------
Expand Down Expand Up @@ -244,7 +245,7 @@ Serial LTE modem
Thingy:53: Matter weather station
---------------------------------

|no_changes_yet_note|
* Enabled Link Time Optimization (LTO) by default for the ``release`` configuration.

Samples
=======
Expand Down Expand Up @@ -374,6 +375,7 @@ Matter samples
* 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.
* Enabled SUIT DFU support for the :ref:`matter_lock_sample`, and :ref:`matter_template_sample` samples.
Currently, only the Matter OTA protocol is fully supported for SUIT DFU purposes.
* Enabled Link Time Optimization (LTO) by default for the ``release`` configuration and ``nrf7002dk/nrf5340/cpuapp`` build target.

Networking samples
------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
4 changes: 4 additions & 0 deletions samples/matter/light_bulb/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y

# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
34 changes: 1 addition & 33 deletions samples/matter/light_bulb/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,6 @@ tests:
tags:
- sysbuild
- ci_samples_matter
sample.matter.light_bulb.lto:
sysbuild: true
build_only: true
extra_args:
- CONFIG_LTO=y
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
integration_platforms:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
platform_allow:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
tags:
- sysbuild
- ci_samples_matter
sample.matter.light_bulb.ffs:
sysbuild: true
build_only: true
Expand Down Expand Up @@ -114,24 +95,11 @@ tests:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
- nrf7002dk/nrf5340/cpuapp
integration_platforms:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
tags:
- sysbuild
- ci_samples_matter
sample.matter.light_bulb.lto.memory_profiling.persistent_subscriptions:
sysbuild: true
build_only: true
extra_args:
- CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS=y
- CONFIG_CHIP_MEMORY_PROFILING=y
- CONFIG_SHELL_MINIMAL=y
- CONFIG_LTO=y
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
platform_allow: nrf7002dk/nrf5340/cpuapp
integration_platforms:
- nrf7002dk/nrf5340/cpuapp
tags:
- sysbuild
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
4 changes: 4 additions & 0 deletions samples/matter/light_switch/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y

# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
19 changes: 0 additions & 19 deletions samples/matter/light_switch/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,6 @@ tests:
tags:
- sysbuild
- ci_samples_matter
sample.matter.light_switch.lto:
sysbuild: true
build_only: true
extra_args:
- CONFIG_LTO=y
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
integration_platforms:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
platform_allow:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
tags:
- sysbuild
- ci_samples_matter
sample.matter.light_switch.lit_icd:
sysbuild: true
build_only: true
Expand Down
4 changes: 4 additions & 0 deletions samples/matter/lock/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y

# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
2 changes: 1 addition & 1 deletion samples/matter/lock/prj_thread_wifi_switched.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CONFIG_BOOT_BANNER=n
CONFIG_CHIP_FACTORY_DATA=y
CONFIG_CHIP_FACTORY_DATA_BUILD=y

# Enable LTO
# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y

Expand Down
23 changes: 1 addition & 22 deletions samples/matter/lock/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,6 @@ tests:
tags:
- sysbuild
- ci_samples_matter
sample.matter.lock.lto:
sysbuild: true
build_only: true
extra_args:
- CONFIG_LTO=y
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
integration_platforms:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp/nrf7001
- nrf54l15dk/nrf54l15/cpuapp
platform_allow:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp
- nrf7002dk/nrf5340/cpuapp/nrf7001
- nrf54l15dk/nrf54l15/cpuapp
tags:
- sysbuild
- ci_samples_matter
sample.matter.lock.smp_dfu:
sysbuild: true
build_only: true
Expand Down Expand Up @@ -98,7 +77,7 @@ tests:
tags:
- sysbuild
- ci_samples_matter
sample.matter.lock.thread_wifi_switched.lto.smp_dfu:
sample.matter.lock.thread_wifi_switched.smp_dfu:
sysbuild: true
build_only: true
extra_args:
Expand Down
4 changes: 4 additions & 0 deletions samples/matter/smoke_co_alarm/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y

# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
19 changes: 0 additions & 19 deletions samples/matter/smoke_co_alarm/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,6 @@ tests:
tags:
- sysbuild
- ci_samples_matter
sample.matter.smoke_co_alarm.lto:
sysbuild: true
build_only: true
extra_args:
- CONFIG_LTO=y
- CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
integration_platforms:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
- nrf54l15dk/nrf54l10/cpuapp
platform_allow:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf54l15dk/nrf54l15/cpuapp
- nrf54l15dk/nrf54l10/cpuapp
tags:
- sysbuild
- ci_samples_matter
sample.matter.smoke_co_alarm.release.power_consumption:
sysbuild: true
build_only: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ CONFIG_CHIP_SPI_NOR=n
# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO
# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
9 changes: 9 additions & 0 deletions samples/matter/template/boards/nrf7002dk_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
4 changes: 4 additions & 0 deletions samples/matter/template/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y

# Enable Watchdog
CONFIG_NCS_SAMPLE_MATTER_WATCHDOG=y

# Enable LTO to decrease the flash usage.
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
Loading

0 comments on commit dda3a7e

Please sign in to comment.