Skip to content

Commit

Permalink
[icd] Introduced gn flags to allow conditional code compilation (#31795)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kkasperczyk-no authored and pull[bot] committed Apr 24, 2024
1 parent d3db7d4 commit 1593cce
Show file tree
Hide file tree
Showing 24 changed files with 345 additions and 169 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
"clang") GN_ARGS='is_clang=true';;
"mbedtls") GN_ARGS='chip_crypto="mbedtls"';;
"rotating_device_id") GN_ARGS='chip_crypto="boringssl" chip_enable_rotating_device_id=true';;
"icd") GN_ARGS='chip_enable_icd_server=true';;
"icd") GN_ARGS='chip_enable_icd_server=true chip_enable_icd_lit=true';;
*) ;;
esac
Expand Down
6 changes: 4 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {

if (enable_linux_lit_icd_app_build) {
group("linux_lit_icd_app") {
deps =
[ "${chip_root}/examples/lit-icd-app/linux(${standalone_toolchain})" ]
lit_icd_standalone_toolchain =
"${chip_root}/config/standalone/toolchain:lit_icd"

deps = [ "${chip_root}/examples/lit-icd-app/linux(${lit_icd_standalone_toolchain})" ]
}

extra_build_deps += [ ":linux_lit_icd_app" ]
Expand Down
6 changes: 6 additions & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_EN
matter_add_gn_arg_bool ("chip_enable_factory_data" CONFIG_CHIP_FACTORY_DATA)
matter_add_gn_arg_bool ("chip_enable_read_client" CONFIG_CHIP_ENABLE_READ_CLIENT)

if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT)
matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT)
matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT)
endif()

if (CONFIG_CHIP_FACTORY_DATA OR CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND)
matter_add_gn_arg_bool("chip_use_transitional_commissionable_data_provider" FALSE)
matter_add_gn_arg_bool("chip_use_transitional_device_instance_info_provider" FALSE)
Expand Down
9 changes: 9 additions & 0 deletions config/standalone/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ gcc_toolchain("standalone") {
import("${chip_root}/config/standalone/args.gni")
}
}

gcc_toolchain("lit_icd") {
toolchain_args = {
current_os = host_os
current_cpu = host_cpu
is_clang = false
import("${chip_root}/examples/lit-icd-app/linux/args.gni")
}
}
6 changes: 6 additions & 0 deletions config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_
matter_add_gn_arg_bool ("chip_automation_logging" FALSE)
matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT)

if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT)
matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT)
matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT)
endif()

if (CONFIG_CHIP_FACTORY_DATA)
matter_add_gn_arg_bool ("chip_use_transitional_commissionable_data_provider" "false")
matter_add_gn_arg_bool ("chip_enable_factory_data" "true")
Expand Down
39 changes: 32 additions & 7 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ if CHIP_ENABLE_ICD_SUPPORT

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

config CHIP_ICD_IDLE_MODE_INTERVAL
int "Intermittently Connected Device idle mode interval (s)"
config CHIP_ICD_IDLE_MODE_DURATION
int "Intermittently Connected Device idle mode duration (s)"
default 300 if CHIP_ICD_LIT_SUPPORT
default 120
help
Provides the Intermittently Connected Device idle mode interval in seconds.
Provides the Intermittently Connected Device idle mode duration in seconds.
It determines the maximum amount of time the device can stay in the idle mode, which means the
device may be unreachable and not able to receive messages.

config CHIP_ICD_ACTIVE_MODE_INTERVAL
int "Intermittently Connected Device active mode interval (ms)"
config CHIP_ICD_ACTIVE_MODE_DURATION
int "Intermittently Connected Device active mode duration (ms)"
default 300
help
Provides the Intermittently Connected Device active mode interval in milliseconds.
Provides the Intermittently Connected Device active mode duration in milliseconds.
It determines the minimum amount of time the device shall stay in the active mode.

config CHIP_ICD_ACTIVE_MODE_THRESHOLD
int "Intermittently Connected Device active mode threshold (ms)"
default 5000 if CHIP_ICD_LIT_SUPPORT
default 300
help
Provides the Intermittently Connected Device active mode threshold in milliseconds.
It determines the minimum amount of time the device shall stay in the active mode after the network activity.
For LIT devices it cannot be set to a value smaller than 5000 ms.

config CHIP_ICD_LIT_SUPPORT
bool "Intermittenly Connected Device Long Idle Time support"
imply CHIP_ICD_CHECK_IN_SUPPORT
imply CHIP_ICD_UAT_SUPPORT
help
Enables the Intermittently Connected Device Long Idle Time support in Matter.
It also implies the ICD Check-In and UAT features support that are mandatory for LIT device.

config CHIP_ICD_CHECK_IN_SUPPORT
bool "Intermittenly Connected Device Check-In protocol support"
help
Enables the Check-In protocol support in Matter. It allows an ICD device to notify the registered
ICD clients that it is available for communication.

config CHIP_ICD_UAT_SUPPORT
bool "Intermittenly Connected Device User Active Mode Trigger support"
help
Enables the User Active Mode Trigger (UAT) support in Matter. It allows the User to use application specific
means (e.g. button press) to trigger an ICD device to enter the active mode and become responsive.

config CHIP_ICD_CLIENTS_PER_FABRIC
int "Intermittently Connected Device number of clients per fabric"
default 2
depends on CHIP_ICD_CHECK_IN_SUPPORT
help
Provides the Intermittently Connected Device number of clients per fabric. It determines the maximum number
of clients per fabric that can be registered to receive notification from a device if their subscription is lost.
Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/qpg/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ chip_enable_ota_requestor = true
chip_openthread_ftd = false
enable_sleepy_device = true
chip_enable_icd_server = true
chip_enable_icd_lit = true

# Disable lock tracking, since our FreeRTOS configuration does not set
# INCLUDE_xSemaphoreGetMutexHolder
Expand Down
1 change: 1 addition & 0 deletions examples/lit-icd-app/linux/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ matter_enable_tracing_support = true
chip_enable_icd_server = true
chip_subscription_timeout_resumption = false
chip_icd_report_on_active_mode = true
chip_enable_icd_lit = true
1 change: 1 addition & 0 deletions examples/lit-icd-app/silabs/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ chip_enable_icd_server = true
chip_subscription_timeout_resumption = false
sl_use_subscription_synching = true
icd_enforce_sit_slow_poll_limit = true
chip_enable_icd_lit = true

# ICD Matter Configuration flags
sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration
Expand Down
1 change: 1 addition & 0 deletions examples/lit-icd-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ chip_subscription_timeout_resumption = false
sl_use_subscription_synching = true
icd_enforce_sit_slow_poll_limit = true
chip_icd_report_on_active_mode = true
chip_enable_icd_lit = true

# Openthread Configuration flags
sl_ot_idle_interval_ms = 3600000 # 60mins Idle Polling Interval
Expand Down
2 changes: 2 additions & 0 deletions examples/smoke-co-alarm-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Power Management
CONFIG_PM=y

CONFIG_CHIP_ICD_LIT_SUPPORT=y
Loading

0 comments on commit 1593cce

Please sign in to comment.