Skip to content

Commit

Permalink
[nrfconnect] Update nRF Connect SDK version to 2.4.0 (#27010)
Browse files Browse the repository at this point in the history
* [nrfconnect] Updated nRF Connect SDK to 2.4.0

Bumped recommended nRF Connect SDK version to 2.4.0
and included several bug fixes and improvements:

1. Extend the connection request log with RSSI.

This comes in handy especially during tests related to TX/RX power.

Signed-off-by: Marcin Kajor <[email protected]>

2. Support disabling Wi-Fi LPM during the OTA DFU.

Added subclass of OTAImageProcessorImpl whcih implements Wi-Fi
specific optimization for LPM which should be disabled during OTA
due to the high throughput requirements. This allows applications
to use the OTAImageProcessorImplWiFi to do the job.

Signed-off-by: Marcin Kajor <[email protected]>

3. Provide configs for Matter NUS feature

Matter NUS feature allows to add of BLE Nordic UART Service and
register commands which allow controlling the Matter device via
BLE.

This can be useful when the device loses connection with a
Matter Controller but it should be controlled in another way
for e.g. a Door Lock.

4. FactoryDataProvider: align the fprotect memory block

Due to the smallest atomic SPU block (16k for nRF53)
which can be protected we need to calculate proper
offsets to include factory data partition.

Signed-off-by: Marcin Kajor <[email protected]>

5. nrfconnect: migrate to new MCUmgr Kconfig options

Migrate to new MCUmgr Kconfig options using:
$ZEPHYR_BASE/scripts/utils/migrate_mcumgr_kconfigs.py

Signed-off-by: Johann Fischer <[email protected]>

6. Added IMAGE_ACCESS_HOOKS config to nRF53 config set

CONFIG_IMAGE_ACCESS_HOOKS is required for nRF53 to confirm
image during DFU over BLE after the changes provided by the
recent Zephyr's upmerge.

Signed-off-by: Arkadiusz Balys <[email protected]>

7. Changed WPA SUPP logs level to error

* Changed default log level to error
* Changed WPA supplicant log levet to error. This is a workaround
and it will be removed once default log levels fix to Zephyr will
be merged.

Signed-off-by: Kamil Kasperczyk <[email protected]>

8. Fixed dependencies for CHIP_DFU_OVER_BT_SMP kconfig

Some Kconfigs selected by the CHIP_DFU_OVER_BT_SMP have unmet
dependencies.

Signed-off-by: Kamil Kasperczyk <[email protected]>

9. Set BLE connection to 1 for NUS

We decided to work with single BLE connection when NUS is active.

10. Repair a path within error messages in FD ptyhon script

Two paths were set wrongly in the factory data python script.

11. Fixed system workqueue stack overflow for Wi-Fi

After failing to connect to the Wi-Fi network (e.g. due to bad
password) the application falls into stack overflow.

Increased the stack size to handle the connection failure
properly.

Signed-off-by: Kamil Kasperczyk <[email protected]>

12. Disable bonding for NUS

Matter NUS should require providing a PIN code before each
pairing, so we do not want to store anything in persistent storage
and we should disable the Bluetooth LE bonding feature.

13. Disable unnecessary assert information

Limit assert information for Matter applications to file name and
file number.

Signed-off-by: Lukasz Duda <[email protected]>

14. Introduce workaround to Wi-Fi connection recovery

It was observed that sometimes WPA supplicant may stuck in the
reconnection process. This change introduces a workaround and
fixes for existing recovery mechanism:

* Changed is-Recovery-Aborted approach to is-Recovery-started.
* Distinguished disconnects requested by the application from the
disconnects coming from the supplicant.
* Added scheduling recovery procedure if supplicant was not able
to re-connect to the network for given amount of time (60 s).

Signed-off-by: Kamil Kasperczyk <[email protected]>

15. Adapt WiFiManager to the new wifi_ps_config API

The wifi_ps_config has been extended in Zephyr so this patch
is need to avoid build errors.

Signed-off-by: Marcin Kajor <[email protected]>

16. Integrated new Wi-Fi disconnect completed event

Integrated handling new Wi-Fi disconnect completed event,
what should fix occassional failures observed during connection
recovery.

Signed-off-by: Kamil Kasperczyk <[email protected]>

17. Fixed nRF7002 EK shield kconfig name

Due to introduction of new nRF7002 shields, the nRF7002 EK shield
kconfig name was changed and we have to align our configuration.

Signed-off-by: Kamil Kasperczyk <[email protected]>

18. [nrfconnect] Use default number of RTC channels

The default number of RTC channels on nRF5340 was increased
from 2 to 3 some time ago, but Matter applications are still
built with 2 user channels. This causes that CSL transmitter
does not work properly on Matter Thread Router devices.

19 Add a workaround to WiFi recovery

During the recovery procedure, if the net_mgmt function returns
the value "-16" the device cannot recover the WiFi network
until the reboot is called.

This workaround allows the device to try to rescan the WiFi
network even if the net_mgmt function returned an error.
This workaround works only, when the WiFi recovery mechanism
is active.

20. moved bt_fixed_passkey config to the features set

BT_FIXED_PASSKEY cannot be added to prj_release.conf file because
it causes a CMAKE warning. The config has been moved to
the Kconfig.feature file.

Fix the build warning in door-lock-server

This fixes the uninitialized variable warning appearing
when compiling the door lock app.

Signed-off-by: Marcin Kajor <[email protected]>

21. Fixed nrf7002 kconfig name again

nRF7002 EK kconfig name changed once again, so we need to align
our kconfigs to that.

Signed-off-by: Kamil Kasperczyk <[email protected]>

* [zephyr] Remove device argument from SYS_INIT() callbacks.

The SYS_INIT() callback API changed in Zephyr and Matter code
alignments were needed.

* [nrfconnect] Stop using Zephyr POSIX layer

After recent changes in Zephyr, the Zephyr POSIX layer
no longer includes missing POSIX definitions from the
standard library. Given that and that the Zephyr POSIX
layer is very incomplete, it is no longer possible to
build Matter samples using that layer.

Disable Zephyr socket layer, and use NET_SOCKETS_POSIX_NAMES
which only wraps the socket functions with POSIX names.
Make sure that proper headers are included when using this
configuration.

* [nrfconnect] Removed obsolete MCUMGR SMP BT config

Replaced CONFIG_MCUMGR_SMP_BT that is no longer supported
with the CONFIG_MCUMGR_TRANSPORT_BT

* Addressed review comments

* Added CHIP_NRF_PLATFORM symbol to conditionally modify generic
Zephyr configuration
* Updated docker versions for cloud builds
* Updated sdk-zephyr toolchain version to 0.16.0 in build scripts
for nrf platform.

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* Fixed chef CI workflow

* Fixed compilation errors

* Fixed typo in wake event
* Removed ifdef leading to compilation errors for Darwin and Linux
and added ifdef for usleep usage that is a root cause of problems
on Zephyr.

* Fix more compilation errors

* [chef] fixes to Zephyr environment variables

1. Use Zephyr SDK toolchain.
2. Use proper shell configuration.

---------

Signed-off-by: Kamil Kasperczyk <[email protected]>
Co-authored-by: Damian Krolik <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Sep 1, 2023
1 parent 9981941 commit 1001964
Show file tree
Hide file tree
Showing 64 changed files with 582 additions and 162 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build:0.7.3
image: connectedhomeip/chip-build:0.7.16
options: --user root

steps:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-esp32:0.7.3
image: connectedhomeip/chip-build-esp32:0.7.16
options: --user root

steps:
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-nrf-platform:0.7.3
image: connectedhomeip/chip-build-nrf-platform:0.7.16
options: --user root

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples-nrfconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-nrf-platform:0.7.3
image: connectedhomeip/chip-build-nrf-platform:0.7.16
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"

Expand Down
2 changes: 1 addition & 1 deletion config/nrfconnect/.nrfconnect-recommended-revision
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.3.0
v2.4.0
15 changes: 7 additions & 8 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,16 @@ include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn_args.cmake)
include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn.cmake)

# Prepare compiler flags
matter_add_flags(-D_DEFAULT_SOURCE)

if (CHIP_CFLAGS)
matter_add_flags("${CHIP_CFLAGS}")
endif()

matter_add_flags(-D_POSIX_C_SOURCE=200809)

if (CONFIG_ARM)
matter_add_cflags(--specs=nosys.specs)
endif()

if (CONFIG_POSIX_API)
matter_add_flags(-D_SYS__PTHREADTYPES_H_)
matter_add_flags(-isystem${ZEPHYR_BASE}/include/zephyr/posix)
endif()

if (CONFIG_NORDIC_SECURITY_BACKEND)
zephyr_include_directories($<TARGET_PROPERTY:mbedtls_external,INTERFACE_INCLUDE_DIRECTORIES>)
zephyr_include_directories($<TARGET_PROPERTY:mbedcrypto_common,INTERFACE_INCLUDE_DIRECTORIES>)
Expand Down Expand Up @@ -197,8 +192,12 @@ matter_build(chip
DEVICE_INFO_EXAMPLE_PROVIDER ${CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER}
GN_DEPENDENCIES kernel
)

set_property(GLOBAL APPEND PROPERTY ZEPHYR_INTERFACE_LIBS chip)
target_compile_definitions(chip INTERFACE _DEFAULT_SOURCE)
# Enable visibility of POSIX.1-2008 functions, such as strnlen
target_compile_definitions(chip INTERFACE _POSIX_C_SOURCE=200809)
# Make sure that kernel symbols that are only referenced by the Matter libraries are resolved.
target_link_libraries(chip INTERFACE $<TARGET_FILE:kernel>)

if (CONFIG_CHIP_MALLOC_SYS_HEAP_OVERRIDE)
target_link_options(chip INTERFACE
Expand Down
24 changes: 23 additions & 1 deletion config/nrfconnect/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ rsource "../../zephyr/Kconfig"

if CHIP

config CHIP_NRF_PLATFORM
bool
default y
help
States that the configuration uses Matter nRF platform,
what can be used to conditionally deviate from Zephyr generic configuration
for nRF platform related purposes.

# See config/zephyr/Kconfig for full definition
config CHIP_DEVICE_VENDOR_NAME
default "Nordic Semiconductor ASA"
Expand Down Expand Up @@ -94,7 +102,7 @@ config CHIP_MALLOC_SYS_HEAP
config CHIP_FACTORY_DATA
bool "Factory data provider"
select ZCBOR
select FPROTECT
imply FPROTECT
help
Enables the default nRF Connect factory data provider implementation that
supports reading the factory data encoded in the CBOR format from the
Expand Down Expand Up @@ -134,6 +142,20 @@ config CHIP_FACTORY_DATA_ROTATING_DEVICE_UID_MAX_LEN
help
Maximum acceptable length of rotating device ID unique ID in bytes.

config CHIP_FACTORY_DATA_WRITE_PROTECT
bool "Enable Factory Data write protection"
select FPROTECT
depends on CHIP_FACTORY_DATA
default y if CHIP_FACTORY_DATA
help
Enables the write protection of the Factory Data partition in the flash memory.
This is a recommended feature, but it requires the Settings partition size to be
a multiple of FPROTECT_BLOCK_SIZE and the Factory Data partition to be placed
right after the application partition in the address space (the Factory Data
partition offset must be equal to the last address of the application partition).
The second requirement is valid only when the FPROTECT_BLOCK_SIZE is bigger than
the flash memory page size.

if CHIP_FACTORY_DATA_BUILD

# Factory data definitions
Expand Down
26 changes: 18 additions & 8 deletions config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ config CHIP_APP_LOG_LEVEL
default 4 # debug

config LOG_DEFAULT_LEVEL
default 2 # warning
default 1 # error

config CHIP_LOG_SIZE_OPTIMIZATION
default y
Expand All @@ -50,6 +50,12 @@ config PRINTK_SYNC
config ASSERT
default y

config ASSERT_NO_COND_INFO
default y

config ASSERT_NO_MSG_INFO
default y

config HW_STACK_PROTECTION
default y

Expand All @@ -63,9 +69,9 @@ config PTHREAD_IPC
bool
default n

# Generic networking options
config NET_SOCKETS_POSIX_NAMES
default n
config POSIX_MAX_FDS
int
default 16

# Application stack size
config MAIN_STACK_SIZE
Expand Down Expand Up @@ -216,14 +222,18 @@ endif

if CHIP_WIFI

choice WPA_SUPP_LOG_LEVEL_CHOICE
default WPA_SUPP_LOG_LEVEL_ERR
endchoice

config NRF_WIFI_LOW_POWER
default n

config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
default n

config SYSTEM_WORKQUEUE_STACK_SIZE
default 2048
default 2560

# align these numbers to match the OpenThread config
config NET_IF_UNICAST_IPV6_ADDR_COUNT
Expand All @@ -232,9 +242,6 @@ config NET_IF_UNICAST_IPV6_ADDR_COUNT
config NET_IF_MCAST_IPV6_ADDR_COUNT
default 8

config NET_SOCKETS_POSIX_NAMES
default n

config NET_SOCKETS_POLL_MAX
default 4

Expand Down Expand Up @@ -436,6 +443,9 @@ endif # SOC_SERIES_NRF52X

if SOC_SERIES_NRF53X

config BOOT_IMAGE_ACCESS_HOOKS
default y

config UPDATEABLE_IMAGE_NUMBER
default 2

Expand Down
83 changes: 71 additions & 12 deletions config/nrfconnect/chip-module/Kconfig.features
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if CHIP

config CHIP_WIFI
bool "Enable nrfconnect Wi-Fi support"
default y if SHIELD_NRF7002_EK || BOARD_NRF7002DK_NRF5340_CPUAPP
default y if SHIELD_NRF7002EK || BOARD_NRF7002DK_NRF5340_CPUAPP
select WIFI_NRF700X
select WIFI
select WPA_SUPP
Expand Down Expand Up @@ -73,29 +73,88 @@ config SPI_NOR_FLASH_LAYOUT_PAGE_SIZE

endif # CHIP_SPI_NOR

config CHIP_NUS
bool "Enable Nordic UART service for Matter purposes"
select BT_NUS
select BT_SMP
select BT_NUS_AUTHEN
help
Enables Nordic UART service (NUS) for Matter samples.
Using NUS service you can control a Matter sample using pre-defined BLE commands
and do defined operations. The CHIP NUS service can be useful to keep communication
with a smart home device when a connection within Matter network is lost.

if CHIP_NUS

# Requires providing a PIN for each pair request
config BT_BONDABLE
default n

config BT_RX_STACK_SIZE
default 1536

config SYSTEM_WORKQUEUE_STACK_SIZE
default 2048

config BT_DEVICE_APPEARANCE
default 833

if !LOG

config BT_FIXED_PASSKEY
default y

endif

config CHIP_NUS_MAX_COMMAND_LEN
int "Maximum length of single command in Bytes"
default 10
help
Maximum length of single command. This command will be send via Bluetooth LE to
a paired smart home device.

config CHIP_NUS_FIXED_PASSKEY
int "Define the default passkey for NUS"
depends on BT_FIXED_PASSKEY
default 123456
help
Define the default password for pairing with the Bluetooth LE device.

config CHIP_NUS_MAX_COMMANDS
int "Define maximum NUS commands amount"
default 2
help
Define the maximum number of NUS commands to declare by user.

endif


config CHIP_DFU_OVER_BT_SMP
bool "Enable DFU over Bluetooth LE SMP feature set"
imply CHIP_QSPI_NOR if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840
imply CHIP_SPI_NOR if BOARD_NRF7002DK_NRF5340_CPUAPP
imply BOOTLOADER_MCUBOOT
select MCUMGR
select MCUMGR_SMP_BT
select MCUMGR_CMD_IMG_MGMT
select MCUMGR_CMD_OS_MGMT
select MCUMGR_TRANSPORT_BT
select IMG_MANAGER
select STREAM_FLASH
select ZCBOR
select MCUMGR_GRP_IMG
select MCUMGR_GRP_OS
# Enable custom SMP request to erase settings partition.
select MCUMGR_GRP_ZEPHYR_BASIC
select MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE
select MCUMGR_GRP_ZBASIC
select MCUMGR_GRP_ZBASIC_STORAGE_ERASE
help
Enables Device Firmware Upgrade over Bluetooth LE with SMP and configures
the set of options related to that feature.

if CHIP_DFU_OVER_BT_SMP

# MCU Manager and SMP configuration
config MCUMGR_SMP_BT_AUTHEN
config MCUMGR_TRANSPORT_BT_AUTHEN
default n

config MCUMGR_BUF_COUNT
config MCUMGR_TRANSPORT_NETBUF_COUNT
default 6

config MCUMGR_MGMT_NOTIFICATION_HOOKS
Expand All @@ -117,8 +176,8 @@ config BT_L2CAP_TX_MTU
config BT_BUF_ACL_RX_SIZE
default 502

# Increase MCUMGR_BUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B
config MCUMGR_BUF_SIZE
# Increase MCUMGR_TRANSPORT_NETBUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B
config MCUMGR_TRANSPORT_NETBUF_SIZE
default 1024

# Increase system workqueue size, as SMP is processed within it
Expand All @@ -128,10 +187,10 @@ config SYSTEM_WORKQUEUE_STACK_SIZE
if SOC_SERIES_NRF53X

# Enable custom SMP request to erase settings partition.
config MCUMGR_GRP_ZEPHYR_BASIC
config MCUMGR_GRP_ZBASIC
default y

config MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE
config MCUMGR_GRP_ZBASIC_STORAGE_ERASE
default y

endif # SOC_SERIES_NRF53X
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,5 @@ config EXCEPTION_STACK_TRACE
config NRF_802154_SER_RADIO
default y

config NRF_RTC_TIMER_USER_CHAN_COUNT
default 2

config NRF_802154_ENCRYPTION
default y
3 changes: 2 additions & 1 deletion config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ menuconfig CHIP
imply REQUIRES_FULL_LIBC
imply NEWLIB_LIBC_NANO
imply CBPRINTF_LIBC_SUBSTS
imply POSIX_API if !ARCH_POSIX
imply POSIX_API if !ARCH_POSIX && !CHIP_NRF_PLATFORM
imply EVENTFD if !ARCH_POSIX
imply REBOOT
imply ENTROPY_GENERATOR
imply NET_UDP
imply NET_IPV6
imply NET_CONFIG_NEED_IPV6
imply NET_SOCKETS
imply NET_SOCKETS_POSIX_NAMES if !ARCH_POSIX && CHIP_NRF_PLATFORM
imply NETWORKING
imply HWINFO
imply FLASH
Expand Down
14 changes: 7 additions & 7 deletions config/zephyr/chip-module/Kconfig.features
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ config MCUMGR
bool
default y

config MCUMGR_CMD_IMG_MGMT
config MCUMGR_GRP_IMG
bool
default y

config MCUMGR_CMD_OS_MGMT
config MCUMGR_GRP_OS
bool
default y

config MCUMGR_SMP_BT
config MCUMGR_TRANSPORT_BT
bool
default y

config MCUMGR_SMP_BT_AUTHEN
config MCUMGR_TRANSPORT_BT_AUTHEN
bool
default n

config MCUMGR_BUF_COUNT
config MCUMGR_TRANSPORT_NETBUF_COUNT
int
default 6

Expand All @@ -53,8 +53,8 @@ config BT_BUF_ACL_RX_SIZE
int
default 502

# Increase MCUMGR_BUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B
config MCUMGR_BUF_SIZE
# Increase MCUMGR_TRANSPORT_NETBUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B
config MCUMGR_TRANSPORT_NETBUF_SIZE
int
default 1024

Expand Down
Loading

0 comments on commit 1001964

Please sign in to comment.