Skip to content

Commit

Permalink
[nrfconnect] Bump nRF Connect SDK to 2.2.0 (#24302)
Browse files Browse the repository at this point in the history
* [nrfconnect] Bump nRF Connect SDK to 2.2.0

Change the recommended nRF Connect SDK version to v2.2.0.

* Start using Zephyr WiFi net_mgmt API and events

- replace wpa_supplicant API calls with generic Zephyr net_mgmt API
- use net events to manage WiFi connection
- refactoring of the whole platform/nrfconnect/wifi code

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

* Implemented proper handling of WiFi security modes.

With the current net_mgmt API it is necessary to scan networks to get
the security mode supported by an AP which we want to connect with.
Also fixed the invalid handling of net_mgmt event life time.

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

* Aligned Matter SDK to Zephyr 0.15.x revision.

These changes were implied the the recent Zephyr upmerge:
- updates of Zephyr include paths
- removal of disabling of gpio1 in board DTS overlays
- fix for the possible dangling pointer compilation error
  after gcc got more picky about that (v10.3 vs. v12.1)

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

* Increased the max number of BLE connections.

This is a workaround for the non-unreferenced BLE connection object
when restarting advertising in BLE disconnect callback.

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

* WiFi fail-safe related fixes

Make sure the fail-safe works as expected with WiFi networking:
- disconnect when reverting the configuration
- always cleanup the provisioning data structures before connecting
  to avoid dummy buffer overwriting and data length issues

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

* Introduced a workaround to send Router Solicitation after connect

Router Solicitation is not sent after connecting to the Wi-Fi
network by the Wi-Fi driver, so in result Thread Border Router
doesn't send Router Advertisement to the device. As a workaround
sending RS was added in the Matter platform code.

* Forward the channel number and RSSI from WIFiManager.

We can now use this feature in spite of stats still
not being implemented.

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

* Minor fixes for heap usage

Fix build with CHIP_MALLOC_SYS_HEAP Kconfig option that
replaces default malloc/free with alternatives based on
Zephyr's sys_heap.

Signed-off-by: Damian Krolik <[email protected]>

* Wi-Fi status handling fixes.

* Increase the SYSTEM_WORKQUEUE_STACK_SIZE to match supplicant needs
* Decrease the connection timeout to be lower than failsafe (35s)
* Adapt WiFiRequestStatus to follow supplicant implementation
* All of above makes the failsafe more robust

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

* wifi: RevertConfiguration optimization.

Do not disconnect/reconnect to the already attached network.

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

* Define _DEFAULT_SOURCE

This commit updates the chip-module build configurations to define
`_DEFAULT_SOURCE` when compiling Matter because it uses non-standard
functions that are only available when `_DEFAULT_SOURCE` is defined.

Note that this used to be not necessary only because of a quirk in the
way Newlib handles the feature test macro, which resulted in Newlib
defining `_DEFAULT_SOURCE` when compiling with `-std=gnu`.

For more details, refer to the issue zephyrproject-rtos/zephyr#52739.

* Align examples with samples included in nRF Connect SDK 2.2.0

* Update remaining Docker images to 0.6.27

* Restyled by clang-format

* Restyled by shellharden

Signed-off-by: Marcin Kajor <[email protected]>
Signed-off-by: Damian Krolik <[email protected]>
Co-authored-by: Marcin Kajor <[email protected]>
Co-authored-by: Kamil Kasperczyk <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
5 people committed Mar 15, 2023
1 parent 76b3005 commit 755aba9
Show file tree
Hide file tree
Showing 64 changed files with 534 additions and 517 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
# TODO: update this to connectedhomeip/chip-build-vscode:0.6.30 once we can compile with latest NRF
image: connectedhomeip/chip-build-nrf-platform:0.6.18
image: connectedhomeip/chip-build-nrf-platform:0.6.30
options: --user root

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/examples-nrfconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Update nRF Connect SDK revision to the currently recommended.
- name: Check nRF Connect SDK revision.
timeout-minutes: 15
run: scripts/run_in_build_env.sh "python3 scripts/setup/nrfconnect/update_ncs.py --update --shallow"
run: scripts/run_in_build_env.sh "python3 scripts/setup/nrfconnect/update_ncs.py --check"
- name: Run unit tests of factory data generation script
timeout-minutes: 15
run: scripts/run_in_build_env.sh "./scripts/tools/nrfconnect/tests/test_generate_factory_data.py"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build:0.6.18
image: connectedhomeip/chip-build:0.6.27

steps:
- uses: Wandalen/[email protected]
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.1.1
v2.2.0
3 changes: 3 additions & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ set(CHIP_GN_ROOT_TARGET ${CHIP_ROOT}/config/nrfconnect/chip-gn)

# Prepare compiler flags

list(APPEND CHIP_CFLAGS -D_DEFAULT_SOURCE)

if (CONFIG_ARM)
list(APPEND CHIP_CFLAGS_C
--specs=nosys.specs
Expand Down Expand Up @@ -309,6 +311,7 @@ add_dependencies(chip-gn kernel)

zephyr_interface_library_named(chip)
target_compile_definitions(chip INTERFACE CHIP_HAVE_CONFIG_H)
target_compile_definitions(chip INTERFACE _DEFAULT_SOURCE)
target_include_directories(chip INTERFACE
${CHIP_ROOT}/src
${CHIP_ROOT}/src/include
Expand Down
18 changes: 9 additions & 9 deletions config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ config MAIN_STACK_SIZE
config INIT_STACKS
default y

# Disable certain parts of Zephyr IPv6 stack
config NET_IPV6_NBR_CACHE
default n

config NET_IPV6_MLD
default y

Expand Down Expand Up @@ -121,7 +117,9 @@ config BT_DEVICE_NAME_MAX
default 15

config BT_MAX_CONN
default 1
default 2 # a workaround for non-unreferenced BLE connection object
# when restaring the BLE advertising in disconnect callback
# TODO: analyze and revert to 1 if proper fix exists

config BT_L2CAP_TX_MTU
default 247
Expand Down Expand Up @@ -189,6 +187,11 @@ config NET_L2_OPENTHREAD

if NET_L2_OPENTHREAD

# Disable certain parts of Zephyr IPv6 stack
config NET_IPV6_NBR_CACHE
bool
default n

# Increase the default RX stack size
config IEEE802154_NRF5_RX_STACK_SIZE
default 1024
Expand All @@ -204,7 +207,7 @@ config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
default n

config SYSTEM_WORKQUEUE_STACK_SIZE
default 1120
default 2048

# align these numbers to match the OpenThread config
config NET_IF_UNICAST_IPV6_ADDR_COUNT
Expand Down Expand Up @@ -319,9 +322,6 @@ config MBEDTLS_GCM_C
config MBEDTLS_RSA_C
default n

config PSA_WANT_KEY_TYPE_ARIA
default n

config PSA_WANT_KEY_TYPE_CHACHA20
default n

Expand Down
1 change: 1 addition & 0 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ menuconfig CHIP
select CPLUSPLUS
imply LIB_CPLUSPLUS
imply REQUIRES_FULL_LIBC
imply NEWLIB_LIBC_NANO
imply CBPRINTF_LIBC_SUBSTS
imply POSIX_API if !ARCH_POSIX
imply EVENTFD if !ARCH_POSIX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
* limitations under the License.
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

&ipc0 {
zephyr,priority = <0 PRIO_COOP>;
};

/* Disable unused peripherals to reduce power consumption */
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#endif

#include <dk_buttons_and_leds.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
* limitations under the License.
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

&ipc0 {
zephyr,priority = <0 PRIO_COOP>;
};

/* Disable unused peripherals to reduce power consumption */
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#endif

#include <dk_buttons_and_leds.h>
#include <logging/log.h>
#include <zephyr.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
6 changes: 3 additions & 3 deletions examples/all-clusters-minimal-app/nrfconnect/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

#include "AppTask.h"

#include <logging/log.h>
#include <zephyr/logging/log.h>

#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart)
#include <drivers/uart.h>
#include <usb/usb_device.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/usb/usb_device.h>
#endif

LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL);
Expand Down
2 changes: 1 addition & 1 deletion examples/common/pigweed/nrfconnect/PigweedLoggerMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "PigweedLogger.h"
#include "pigweed/RpcService.h"
#include <kernel.h>
#include <zephyr/kernel.h>

namespace chip {
namespace rpc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
* limitations under the License.
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

&ipc0 {
zephyr,priority = <0 PRIO_COOP>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#endif

#include <dk_buttons_and_leds.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
Expand All @@ -34,7 +36,10 @@
pwms = < &pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};
};
};

&ipc0 {
zephyr,priority = <0 PRIO_COOP>;
};

&pwm0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
Expand All @@ -32,7 +31,7 @@
pwmleds {
compatible = "pwm-leds";
pwm_led1: pwm_led_1 {
pwms = < &pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
pwms = < &pwm0 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
#endif

#include <dk_buttons_and_leds.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
34 changes: 15 additions & 19 deletions examples/lighting-app/nrfconnect/main/include/AppConfig.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// Copyright (c) 2020 Project CHIP Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#pragma once

Expand All @@ -41,5 +39,3 @@
#define FACTORY_RESET_SIGNAL_LED DK_LED3
#define FACTORY_RESET_SIGNAL_LED1 DK_LED4
#endif
// Time it takes in ms for the simulated actuator to move from one state to another.
#define ACTUATOR_MOVEMENT_PERIOS_MS 2000
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
* limitations under the License.
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

&ipc0 {
zephyr,priority = <0 PRIO_COOP>;
};

/* Disable unused peripherals to reduce power consumption */
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
#endif

#include <dk_buttons_and_leds.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <lib/core/ClusterEnums.h>
#include <lib/support/ScopedBuffer.h>

#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>

#include <cstdint>

Expand Down
2 changes: 1 addition & 1 deletion examples/pigweed-app/nrfconnect/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "LEDWidget.h"
#include "PigweedLoggerMutex.h"
#include "pigweed/RpcService.h"
#include <kernel.h>
#include <zephyr/kernel.h>

#include "pw_rpc/echo_service_nanopb.h"
#include "pw_sys_io/sys_io.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#include <cinttypes>

#include "console/console.h"
#include "pw_sys_io/sys_io.h"
#include <cassert>
#include <zephyr/console/console.h>
#include <zephyr/zephyr.h>

#ifdef CONFIG_USB
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/nrfconnect/util/LEDWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "LEDWidget.h"

#include <dk_buttons_and_leds.h>
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>

static LEDWidget::LEDWidgetStateUpdateHandler sStateUpdateCallback;

Expand Down
2 changes: 1 addition & 1 deletion examples/platform/nrfconnect/util/PWMDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <lib/support/CodeUtils.h>

#include <zephyr/drivers/pwm.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
Loading

0 comments on commit 755aba9

Please sign in to comment.