Skip to content

Commit e36671f

Browse files
[icd] Introduced gn flags to allow conditional code compilation
The ICD implementation is compiled with a full set of features, even if the device uses SIT configuration. It results in a big flash memory waste on a functionalities that cannot be used by certain configuration. Introduced new gn flags corresponding to the ICD features - LIT, CIP and UAT. Modified the ICD Manager implementation and icd-management-server code to use created defines and cut off unused code by the preprocessor.
1 parent 61724ee commit e36671f

File tree

24 files changed

+336
-167
lines changed

24 files changed

+336
-167
lines changed

.github/workflows/unit_integration_test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
"clang") GN_ARGS='is_clang=true';;
6666
"mbedtls") GN_ARGS='chip_crypto="mbedtls"';;
6767
"rotating_device_id") GN_ARGS='chip_crypto="boringssl" chip_enable_rotating_device_id=true';;
68-
"icd") GN_ARGS='chip_enable_icd_server=true';;
68+
"icd") GN_ARGS='chip_enable_icd_server=true chip_enable_icd_lit=true';;
6969
*) ;;
7070
esac
7171

BUILD.gn

+4-2
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
614614

615615
if (enable_linux_lit_icd_app_build) {
616616
group("linux_lit_icd_app") {
617-
deps =
618-
[ "${chip_root}/examples/lit-icd-app/linux(${standalone_toolchain})" ]
617+
lit_icd_standalone_toolchain =
618+
"${chip_root}/config/standalone/toolchain:lit_icd"
619+
620+
deps = [ "${chip_root}/examples/lit-icd-app/linux(${lit_icd_standalone_toolchain})" ]
619621
}
620622

621623
extra_build_deps += [ ":linux_lit_icd_app" ]

config/nrfconnect/chip-module/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_EN
139139
matter_add_gn_arg_bool ("chip_enable_factory_data" CONFIG_CHIP_FACTORY_DATA)
140140
matter_add_gn_arg_bool ("chip_enable_read_client" CONFIG_CHIP_ENABLE_READ_CLIENT)
141141

142+
if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
143+
matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT)
144+
matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT)
145+
matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT)
146+
endif()
147+
142148
if (CONFIG_CHIP_FACTORY_DATA OR CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND)
143149
matter_add_gn_arg_bool("chip_use_transitional_commissionable_data_provider" FALSE)
144150
matter_add_gn_arg_bool("chip_use_transitional_device_instance_info_provider" FALSE)

config/standalone/toolchain/BUILD.gn

+9
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ gcc_toolchain("standalone") {
2525
import("${chip_root}/config/standalone/args.gni")
2626
}
2727
}
28+
29+
gcc_toolchain("lit_icd") {
30+
toolchain_args = {
31+
current_os = host_os
32+
current_cpu = host_cpu
33+
is_clang = false
34+
import("${chip_root}/examples/lit-icd-app/linux/args.gni")
35+
}
36+
}

config/telink/chip-module/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_
104104
matter_add_gn_arg_bool ("chip_automation_logging" FALSE)
105105
matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT)
106106

107+
if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
108+
matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT)
109+
matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT)
110+
matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT)
111+
endif()
112+
107113
if (CONFIG_CHIP_FACTORY_DATA)
108114
matter_add_gn_arg_bool ("chip_use_transitional_commissionable_data_provider" "false")
109115
matter_add_gn_arg_bool ("chip_enable_factory_data" "true")

config/zephyr/Kconfig

+32-7
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ if CHIP_ENABLE_ICD_SUPPORT
334334

335335
config CHIP_ICD_SLOW_POLL_INTERVAL
336336
int "Intermittently Connected Device slow polling interval (ms)"
337+
default 30000 if CHIP_ICD_LIT_SUPPORT
337338
default 1000
338339
help
339340
Provides the Intermittently Connected Device slow polling interval in milliseconds while the
@@ -347,33 +348,57 @@ config CHIP_ICD_FAST_POLLING_INTERVAL
347348
Provides the Intermittently Connected Device fast polling interval in milliseconds while the
348349
device is in the active mode. It determines the fastest frequency at which the device will be able
349350
to receive the messages in the active mode. The CHIP_ICD_FAST_POLLING_INTERVAL shall be smaller than
350-
CHIP_ICD_ACTIVE_MODE_INTERVAL.
351+
CHIP_ICD_ACTIVE_MODE_DURATION.
351352

352-
config CHIP_ICD_IDLE_MODE_INTERVAL
353-
int "Intermittently Connected Device idle mode interval (s)"
353+
config CHIP_ICD_IDLE_MODE_DURATION
354+
int "Intermittently Connected Device idle mode duration (s)"
355+
default 300 if CHIP_ICD_LIT_SUPPORT
354356
default 120
355357
help
356-
Provides the Intermittently Connected Device idle mode interval in seconds.
358+
Provides the Intermittently Connected Device idle mode duration in seconds.
357359
It determines the maximum amount of time the device can stay in the idle mode, which means the
358360
device may be unreachable and not able to receive messages.
359361

360-
config CHIP_ICD_ACTIVE_MODE_INTERVAL
361-
int "Intermittently Connected Device active mode interval (ms)"
362+
config CHIP_ICD_ACTIVE_MODE_DURATION
363+
int "Intermittently Connected Device active mode duration (ms)"
362364
default 300
363365
help
364-
Provides the Intermittently Connected Device active mode interval in milliseconds.
366+
Provides the Intermittently Connected Device active mode duration in milliseconds.
365367
It determines the minimum amount of time the device shall stay in the active mode.
366368

367369
config CHIP_ICD_ACTIVE_MODE_THRESHOLD
368370
int "Intermittently Connected Device active mode threshold (ms)"
371+
default 5000 if CHIP_ICD_LIT_SUPPORT
369372
default 300
370373
help
371374
Provides the Intermittently Connected Device active mode threshold in milliseconds.
372375
It determines the minimum amount of time the device shall stay in the active mode after the network activity.
376+
For LIT devices it cannot be set to a value smaller than 5000 ms.
377+
378+
config CHIP_ICD_LIT_SUPPORT
379+
bool "Intermittenly Connected Device Long Idle Time support"
380+
imply CHIP_ICD_CHECK_IN_SUPPORT
381+
imply CHIP_ICD_UAT_SUPPORT
382+
help
383+
Enables the Intermittently Connected Device Long Idle Time support in Matter.
384+
It also implies the ICD Check-In and UAT features support that are mandatory for LIT device.
385+
386+
config CHIP_ICD_CHECK_IN_SUPPORT
387+
bool "Intermittenly Connected Device Check-In protocol support"
388+
help
389+
Enables the Check-In protocol support in Matter. It allows an ICD device to notify the registered
390+
ICD clients that it is available for communication.
391+
392+
config CHIP_ICD_UAT_SUPPORT
393+
bool "Intermittenly Connected Device User Active Mode Trigger support"
394+
help
395+
Enables the User Active Mode Trigger (UAT) support in Matter. It allows the User to use application specific
396+
means (e.g. button press) to trigger an ICD device to enter the active mode and become responsive.
373397

374398
config CHIP_ICD_CLIENTS_PER_FABRIC
375399
int "Intermittently Connected Device number of clients per fabric"
376400
default 2
401+
depends on CHIP_ICD_CHECK_IN_SUPPORT
377402
help
378403
Provides the Intermittently Connected Device number of clients per fabric. It determines the maximum number
379404
of clients per fabric that can be registered to receive notification from a device if their subscription is lost.

examples/light-switch-app/qpg/args.gni

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ chip_enable_ota_requestor = true
2323
chip_openthread_ftd = false
2424
enable_sleepy_device = true
2525
chip_enable_icd_server = true
26+
chip_enable_icd_lit = true
2627

2728
# Disable lock tracking, since our FreeRTOS configuration does not set
2829
# INCLUDE_xSemaphoreGetMutexHolder

examples/lit-icd-app/linux/args.gni

+1
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ matter_enable_tracing_support = true
3030
chip_enable_icd_server = true
3131
chip_subscription_timeout_resumption = false
3232
chip_icd_report_on_active_mode = true
33+
chip_enable_icd_lit = true

examples/lit-icd-app/silabs/build_for_wifi_args.gni

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ chip_enable_icd_server = true
2828
chip_subscription_timeout_resumption = false
2929
sl_use_subscription_synching = true
3030
icd_enforce_sit_slow_poll_limit = true
31+
chip_enable_icd_lit = true
3132

3233
# ICD Matter Configuration flags
3334
sl_idle_mode_interval_s = 3600 # 60min Idle Mode Interval

examples/lit-icd-app/silabs/openthread.gni

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ chip_subscription_timeout_resumption = false
3232
sl_use_subscription_synching = true
3333
icd_enforce_sit_slow_poll_limit = true
3434
chip_icd_report_on_active_mode = true
35+
chip_enable_icd_lit = true
3536

3637
# Openthread Configuration flags
3738
sl_ot_idle_interval_ms = 3600000 # 60mins Idle Polling Interval

examples/smoke-co-alarm-app/telink/prj.conf

+2
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n
5050

5151
# Enable Power Management
5252
CONFIG_PM=y
53+
54+
CONFIG_CHIP_ICD_LIT_SUPPORT=y

0 commit comments

Comments
 (0)