From 105a07685923723b4e837fce8ac9edcd937d6764 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Tue, 20 Jun 2023 11:57:20 +0200 Subject: [PATCH 01/11] build: bump embassy-sync version --- btmesh-device/Cargo.toml | 11 ++--- btmesh-driver/Cargo.toml | 74 +++++++++++++------------------- btmesh-nrf-softdevice/Cargo.toml | 71 +++++++++++++++--------------- 3 files changed, 69 insertions(+), 87 deletions(-) diff --git a/btmesh-device/Cargo.toml b/btmesh-device/Cargo.toml index 9094a50..8d01e76 100644 --- a/btmesh-device/Cargo.toml +++ b/btmesh-device/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" [dependencies] heapless = "0.7" -btmesh-common = { path = "../btmesh-common"} -btmesh-models = { path = "../btmesh-models"} -embassy-sync = { version = "0.1.0", default-features = false } +btmesh-common = { path = "../btmesh-common" } +btmesh-models = { path = "../btmesh-models" } +embassy-sync = { version = "0.2.0", default-features = false } embassy-time = { version = "0.1.0", default-features = false } embassy-futures = { version = "0.1.0", default-features = false } futures = { version = "0.3.21", default-features = false } @@ -19,7 +19,4 @@ log = { version = "0.4", optional = true } defmt = { version = "0.3", optional = true } [features] -defmt = [ - "dep:defmt", - "heapless/defmt-impl", -] +defmt = ["dep:defmt", "heapless/defmt-impl"] diff --git a/btmesh-driver/Cargo.toml b/btmesh-driver/Cargo.toml index 2a5c89e..6905f58 100644 --- a/btmesh-driver/Cargo.toml +++ b/btmesh-driver/Cargo.toml @@ -10,10 +10,12 @@ btmesh-common = { path = "../btmesh-common" } btmesh-pdu = { path = "../btmesh-pdu" } btmesh-bearer = { path = "../btmesh-bearer" } btmesh-device = { path = "../btmesh-device" } -btmesh-models = { path = "../btmesh-models", features = [ "serde" ] } -btmesh-macro = { path = "../btmesh-macro"} +btmesh-models = { path = "../btmesh-models", features = ["serde"] } +btmesh-macro = { path = "../btmesh-macro" } embassy-time = { version = "0.1.0", default-features = false } -embassy-sync = { version = "0.1.0", default-features = false, features = ["nightly"] } +embassy-sync = { version = "0.2.0", default-features = false, features = [ + "nightly", +] } embassy-futures = { version = "0.1.0", default-features = false } heapless = "0.7" hash32 = "0.2.1" @@ -26,53 +28,39 @@ p256 = { version = "0.10.0", default-features = false, features = ["ecdh"] } rand_core = { version = "0.6.2", default-features = false } embedded-storage-async = { version = "0.3.0", optional = true } embedded-storage = { version = "0.3.0", optional = true } -postcard = { version = "1.0.1", default-features = false, features = ["heapless"], optional = true } +postcard = { version = "1.0.1", default-features = false, features = [ + "heapless", +], optional = true } defmt = { version = "0.3", optional = true } [dev-dependencies] -rand_core = { version = "0.6.2", default-features = false, features = ["getrandom"] } +rand_core = { version = "0.6.2", default-features = false, features = [ + "getrandom", +] } [features] -default = [ - "flash", - "memory", - "relay", - "std", -] -std = [ - "embassy-time/std" -] +default = ["flash", "memory", "relay", "std"] +std = ["embassy-time/std"] flash = [ - "embedded-storage", - "embedded-storage-async", - "postcard", - "postcard/use-defmt", - "serde/derive", - "btmesh-common/serde", - "btmesh-pdu/serde" -] -memory = [ - + "embedded-storage", + "embedded-storage-async", + "postcard", + "postcard/use-defmt", + "serde/derive", + "btmesh-common/serde", + "btmesh-pdu/serde", ] +memory = [] defmt = [ - "dep:defmt", - "btmesh-common/defmt", - "btmesh-bearer/defmt", - "btmesh-device/defmt", - "btmesh-models/defmt", - "btmesh-pdu/defmt", + "dep:defmt", + "btmesh-common/defmt", + "btmesh-bearer/defmt", + "btmesh-device/defmt", + "btmesh-models/defmt", + "btmesh-pdu/defmt", ] -relay = [ - "btmesh-common/relay", - "btmesh-models/relay", -] -proxy = [ - "btmesh-common/proxy", -] -friend = [ - "btmesh-common/friend", -] -low_power = [ - "btmesh-common/low_power", -] +relay = ["btmesh-common/relay", "btmesh-models/relay"] +proxy = ["btmesh-common/proxy"] +friend = ["btmesh-common/friend"] +low_power = ["btmesh-common/low_power"] diff --git a/btmesh-nrf-softdevice/Cargo.toml b/btmesh-nrf-softdevice/Cargo.toml index e9e4198..4c9c9a5 100644 --- a/btmesh-nrf-softdevice/Cargo.toml +++ b/btmesh-nrf-softdevice/Cargo.toml @@ -12,64 +12,61 @@ edition = "2021" btmesh-common = { path = "../btmesh-common", default-features = false } btmesh-pdu = { path = "../btmesh-pdu", default-features = false } btmesh-bearer = { path = "../btmesh-bearer", default-features = false } -btmesh-driver = { path = "../btmesh-driver", default-features = false, features = [ "flash" ] } +btmesh-driver = { path = "../btmesh-driver", default-features = false, features = [ + "flash", +] } btmesh-device = { path = "../btmesh-device", default-features = false } heapless = "0.7" atomic-polyfill = { version = "1", default-features = false } rand_core = { version = "0.6.2", default-features = false } -embassy-sync = { version = "0.1.0", default-features = false, features = ["nightly" ] } +embassy-sync = { version = "0.2.0", default-features = false, features = [ + "nightly", +] } embassy-futures = { version = "0.1.0", default-features = false } -nrf-softdevice = { version = "0.1.0", default-features = false, features = ["ble-peripheral", "ble-gatt-server"] } -nrf-softdevice-s140 = { version = "0.1.0", optional=true } +nrf-softdevice = { version = "0.1.0", default-features = false, features = [ + "ble-peripheral", + "ble-gatt-server", +] } +nrf-softdevice-s140 = { version = "0.1.0", optional = true } nrf-softdevice-macro = { version = "0.1.0" } defmt = { version = "0.3", optional = true } -embassy-nrf = { version = "0.1.0", default-features = false, features = ["time-driver-rtc1", "gpiote"], optional = true } +embassy-nrf = { version = "0.1.0", default-features = false, features = [ + "time-driver-rtc1", + "gpiote", +], optional = true } embassy-time = { version = "0.1.0", default-features = false } [features] -default = [ - "nrf52840" -] +default = ["nrf52840"] nrf52840 = [ - "embassy-nrf/nrf52840", - "nrf-softdevice/nrf52840", - "nrf-softdevice/ble-central", - "nrf-softdevice/s140", - "nrf-softdevice-s140", + "embassy-nrf/nrf52840", + "nrf-softdevice/nrf52840", + "nrf-softdevice/ble-central", + "nrf-softdevice/s140", + "nrf-softdevice-s140", ] nrf52833 = [ - "embassy-nrf/nrf52833", - "nrf-softdevice/nrf52833", - "nrf-softdevice/ble-central", - "nrf-softdevice/s140", - "nrf-softdevice-s140", + "embassy-nrf/nrf52833", + "nrf-softdevice/nrf52833", + "nrf-softdevice/ble-central", + "nrf-softdevice/s140", + "nrf-softdevice-s140", ] defmt = [ - "dep:defmt", - "btmesh-driver/defmt", -# "nrf-softdevice/defmt", + "dep:defmt", + "btmesh-driver/defmt", + # "nrf-softdevice/defmt", ] -gatt = [ -] +gatt = [] -relay = [ - "btmesh-common/relay", - "btmesh-driver/relay", -] -proxy = [ - "btmesh-common/proxy", - "gatt", -] -friend = [ - "btmesh-common/friend" -] -low_power = [ - "btmesh-common/low_power" -] +relay = ["btmesh-common/relay", "btmesh-driver/relay"] +proxy = ["btmesh-common/proxy", "gatt"] +friend = ["btmesh-common/friend"] +low_power = ["btmesh-common/low_power"] [patch.crates-io] embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-executor-v0.1.1" } From bfe954c7e2f34a146017aa82bab9172c0b6361b1 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Tue, 20 Jun 2023 14:54:19 +0200 Subject: [PATCH 02/11] build: add feature impl_trait_in_assoc_type We also upgraded the toolchain to the latest nightly. --- btmesh-driver/src/lib.rs | 1 + rust-toolchain.toml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/btmesh-driver/src/lib.rs b/btmesh-driver/src/lib.rs index 9bb152c..530b311 100644 --- a/btmesh-driver/src/lib.rs +++ b/btmesh-driver/src/lib.rs @@ -6,6 +6,7 @@ #![allow(dead_code)] #![allow(clippy::await_holding_refcell_ref)] #![feature(async_closure)] +#![feature(impl_trait_in_assoc_type)] use btmesh_bearer::beacon::Beacon; use btmesh_common::address::{Address, UnicastAddress}; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index ed377c2..b9b28c0 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,6 @@ # Before upgrading check that everything is available on all tier1 targets here: # https://rust-lang.github.io/rustup-components-history [toolchain] -channel = "nightly-2022-11-22" -components = [ "rust-src", "rustfmt" ] -targets = [ "thumbv7em-none-eabi", "thumbv7em-none-eabihf" ] +channel = "nightly-2023-06-20" +components = ["rust-src", "rustfmt"] +targets = ["thumbv7em-none-eabi", "thumbv7em-none-eabihf"] From 6f2291bd21bb29f7be5d16d107f89417de69d2ca Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Tue, 20 Jun 2023 15:05:28 +0200 Subject: [PATCH 03/11] build: bump embassy-nrf and nrf-softdevice versions --- btmesh-nrf-softdevice/Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/btmesh-nrf-softdevice/Cargo.toml b/btmesh-nrf-softdevice/Cargo.toml index 4c9c9a5..857f5eb 100644 --- a/btmesh-nrf-softdevice/Cargo.toml +++ b/btmesh-nrf-softdevice/Cargo.toml @@ -69,7 +69,7 @@ friend = ["btmesh-common/friend"] low_power = ["btmesh-common/low_power"] [patch.crates-io] -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-executor-v0.1.1" } -nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } -nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } -nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } +nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } +nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } From 610a5c239b0358e47ee5772896996dd46c1673b9 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Tue, 20 Jun 2023 16:06:21 +0200 Subject: [PATCH 04/11] build: bump embedded-storage-async version --- btmesh-driver/Cargo.toml | 2 +- btmesh-driver/src/storage/flash.rs | 8 ++++---- btmesh-nrf-softdevice/Cargo.toml | 1 + btmesh-nrf-softdevice/src/lib.rs | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/btmesh-driver/Cargo.toml b/btmesh-driver/Cargo.toml index 6905f58..40b8899 100644 --- a/btmesh-driver/Cargo.toml +++ b/btmesh-driver/Cargo.toml @@ -26,7 +26,7 @@ cmac = { version = "0.6.0", default-features = false } aes = { version = "0.7", default-features = false } p256 = { version = "0.10.0", default-features = false, features = ["ecdh"] } rand_core = { version = "0.6.2", default-features = false } -embedded-storage-async = { version = "0.3.0", optional = true } +embedded-storage-async = { version = "0.4.0", optional = true } embedded-storage = { version = "0.3.0", optional = true } postcard = { version = "1.0.1", default-features = false, features = [ "heapless", diff --git a/btmesh-driver/src/storage/flash.rs b/btmesh-driver/src/storage/flash.rs index d87420a..e30c2ca 100644 --- a/btmesh-driver/src/storage/flash.rs +++ b/btmesh-driver/src/storage/flash.rs @@ -2,7 +2,7 @@ use crate::storage::{BackingStore, StorageError}; use crate::util::hash::hash_of; use crate::ProvisionedConfiguration; use core::future::Future; -use embedded_storage_async::nor_flash::AsyncNorFlash; +use embedded_storage_async::nor_flash::NorFlash; use postcard::{from_bytes, to_slice}; #[repr(align(4))] @@ -14,7 +14,7 @@ pub enum LatestLoad { Provisioned { hash: u64, sequence: u32 }, } -pub struct FlashBackingStore { +pub struct FlashBackingStore { flash: F, base_address: u32, extra_base_address: Option, @@ -23,7 +23,7 @@ pub struct FlashBackingStore { buffer: AlignedBuffer, } -impl FlashBackingStore { +impl FlashBackingStore { pub fn new( flash: F, base_address: u32, @@ -77,7 +77,7 @@ impl FlashBackingStore { const USEFUL_BUFFER_SIZE: usize = 2048; -impl BackingStore for FlashBackingStore { +impl BackingStore for FlashBackingStore { type LoadFuture<'m> = impl Future> + 'm where Self: 'm; diff --git a/btmesh-nrf-softdevice/Cargo.toml b/btmesh-nrf-softdevice/Cargo.toml index 857f5eb..e90e921 100644 --- a/btmesh-nrf-softdevice/Cargo.toml +++ b/btmesh-nrf-softdevice/Cargo.toml @@ -24,6 +24,7 @@ embassy-sync = { version = "0.2.0", default-features = false, features = [ ] } embassy-futures = { version = "0.1.0", default-features = false } nrf-softdevice = { version = "0.1.0", default-features = false, features = [ + "nightly", "ble-peripheral", "ble-gatt-server", ] } diff --git a/btmesh-nrf-softdevice/src/lib.rs b/btmesh-nrf-softdevice/src/lib.rs index 1a43f78..5a9c5ee 100644 --- a/btmesh-nrf-softdevice/src/lib.rs +++ b/btmesh-nrf-softdevice/src/lib.rs @@ -3,6 +3,7 @@ #![feature(associated_type_defaults)] #![feature(future_join)] #![allow(dead_code)] +#![feature(impl_trait_in_assoc_type)] #[cfg(not(any(feature = "nrf52833", feature = "nrf52840",)))] compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52833, nrf52840"); From f3b074df8825619b2805752239135fa5ac5df143 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Tue, 20 Jun 2023 16:06:49 +0200 Subject: [PATCH 05/11] fix: remove ok() from DisconnectedError --- btmesh-nrf-softdevice/src/gatt.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/btmesh-nrf-softdevice/src/gatt.rs b/btmesh-nrf-softdevice/src/gatt.rs index 389cf6c..1519ed7 100644 --- a/btmesh-nrf-softdevice/src/gatt.rs +++ b/btmesh-nrf-softdevice/src/gatt.rs @@ -87,7 +87,6 @@ impl SoftdeviceGattBearer { }, ) .await - .ok() }; let reset_fut = RESET_SIGNAL.wait(); From dfaee1546c9599dfa33cc891dc957a33fc414d6f Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Wed, 21 Jun 2023 12:33:28 +0200 Subject: [PATCH 06/11] refactor: format examples cargo.toml files --- .../examples/microbit/basic/Cargo.toml | 38 +++++++++++++------ .../examples/nrf52840-dk/basic/Cargo.toml | 38 +++++++++++++------ 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml index 96f2694..6ad99b5 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml @@ -1,13 +1,13 @@ [package] authors = [ - "Ulf Lilleengen ", - "Bob McWhirter " + "Ulf Lilleengen ", + "Bob McWhirter ", ] edition = "2018" name = "basic" version = "0.1.0" description = "microbit Bluetooth Mesh example" -keywords = ["ble", "bluetooth", "mesh", "nrf", "nrf52" ] +keywords = ["ble", "bluetooth", "mesh", "nrf", "nrf52"] resolver = "2" [workspace] @@ -17,18 +17,34 @@ defmt = { version = "0.3" } defmt-rtt = { version = "0.3" } panic-probe = { version = "0.3", features = ["print-defmt"] } -embassy-executor = { version = "0.1.1", default-features = false, features = [ "defmt", "nightly", "integrated-timers" ] } -embassy-time = { version = "0.1.0", default-features = false, features = [ "defmt", "defmt-timestamp-uptime" ] } -embassy-nrf = { version = "0.1.0", default-features = false, features = ["nrf52833", "gpiote", "time-driver-rtc1"]} +embassy-executor = { version = "0.1.1", default-features = false, features = [ + "defmt", + "nightly", + "integrated-timers", +] } +embassy-time = { version = "0.1.0", default-features = false, features = [ + "defmt", + "defmt-timestamp-uptime", +] } +embassy-nrf = { version = "0.1.0", default-features = false, features = [ + "nrf52833", + "gpiote", + "time-driver-rtc1", +] } embassy-futures = { version = "0.1.0", default-features = false } cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } cortex-m-rt = "0.7" -btmesh-models = { path = "../../../../btmesh-models"} -btmesh-device = { path = "../../../../btmesh-device"} -btmesh-macro = { path = "../../../../btmesh-macro"} -btmesh-nrf-softdevice = { path = "../../../", default-features = false, features = ["defmt", "nrf52833", "proxy", "relay"] } +btmesh-models = { path = "../../../../btmesh-models" } +btmesh-device = { path = "../../../../btmesh-device" } +btmesh-macro = { path = "../../../../btmesh-macro" } +btmesh-nrf-softdevice = { path = "../../../", default-features = false, features = [ + "defmt", + "nrf52833", + "proxy", + "relay", +] } [features] @@ -61,7 +77,7 @@ overflow-checks = false codegen-units = 8 debug = 0 debug-assertions = false -opt-level = 1 +opt-level = 1 overflow-checks = false [patch.crates-io] diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml index 395e52d..0698d54 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml @@ -1,13 +1,13 @@ [package] authors = [ - "Ulf Lilleengen ", - "Bob McWhirter " + "Ulf Lilleengen ", + "Bob McWhirter ", ] edition = "2018" name = "basic" version = "0.1.0" description = "nrf52840-dk Bluetooth Mesh example" -keywords = ["ble", "bluetooth", "mesh", "nrf", "nrf52" ] +keywords = ["ble", "bluetooth", "mesh", "nrf", "nrf52"] resolver = "2" [workspace] @@ -17,18 +17,34 @@ defmt = { version = "0.3" } defmt-rtt = { version = "0.3" } panic-probe = { version = "0.3", features = ["print-defmt"] } -embassy-executor = { version = "0.1.1", default-features = false, features = [ "defmt", "nightly", "integrated-timers" ] } -embassy-time = { version = "0.1.0", default-features = false, features = [ "defmt", "defmt-timestamp-uptime" ] } -embassy-nrf = { version = "0.1.0", default-features = false, features = ["nrf52840", "gpiote", "time-driver-rtc1"]} +embassy-executor = { version = "0.1.1", default-features = false, features = [ + "defmt", + "nightly", + "integrated-timers", +] } +embassy-time = { version = "0.1.0", default-features = false, features = [ + "defmt", + "defmt-timestamp-uptime", +] } +embassy-nrf = { version = "0.1.0", default-features = false, features = [ + "nrf52840", + "gpiote", + "time-driver-rtc1", +] } embassy-futures = { version = "0.1.0", default-features = false } cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } cortex-m-rt = "0.7" -btmesh-models = { path = "../../../../btmesh-models"} -btmesh-device = { path = "../../../../btmesh-device"} -btmesh-macro = { path = "../../../../btmesh-macro"} -btmesh-nrf-softdevice = { path = "../../../", features = ["defmt", "nrf52840", "proxy", "relay"] } +btmesh-models = { path = "../../../../btmesh-models" } +btmesh-device = { path = "../../../../btmesh-device" } +btmesh-macro = { path = "../../../../btmesh-macro" } +btmesh-nrf-softdevice = { path = "../../../", features = [ + "defmt", + "nrf52840", + "proxy", + "relay", +] } [features] @@ -61,7 +77,7 @@ overflow-checks = false codegen-units = 8 debug = 0 debug-assertions = false -opt-level = 1 +opt-level = 1 overflow-checks = false [patch.crates-io] From 2fbacbf9889bf207a0651591c1702aaba5651724 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Wed, 21 Jun 2023 12:36:33 +0200 Subject: [PATCH 07/11] build: bump dependencies versions for examples --- .../examples/microbit/basic/Cargo.toml | 16 ++++++++-------- .../examples/nrf52840-dk/basic/Cargo.toml | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml index 6ad99b5..8016e46 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml @@ -81,14 +81,14 @@ opt-level = 1 overflow-checks = false [patch.crates-io] -embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-executor-v0.1.1" } -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -embassy-time = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } -nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } -nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } +nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } +nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } #nrf-softdevice = { path = "../../../../../nrf-softdevice/nrf-softdevice" } #nrf-softdevice-s140 = { path = "../../../../../nrf-softdevice/nrf-softdevice-s140" } diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml index 0698d54..e00dd95 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml @@ -81,11 +81,11 @@ opt-level = 1 overflow-checks = false [patch.crates-io] -embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-executor-v0.1.1" } -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -embassy-time = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", tag = "embassy-time-v0.1.0" } -nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } -nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } -nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "e8ee783fdd9674a061c2479d0a29e87e4e2a6d2f" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } +nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } +nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } From d275be6b90e209fba9648af677c5a889ee4b10a1 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Wed, 21 Jun 2023 12:41:13 +0200 Subject: [PATCH 08/11] fix: change pdu arg type to ref in data_out_notify --- btmesh-nrf-softdevice/src/gatt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btmesh-nrf-softdevice/src/gatt.rs b/btmesh-nrf-softdevice/src/gatt.rs index 1519ed7..6449036 100644 --- a/btmesh-nrf-softdevice/src/gatt.rs +++ b/btmesh-nrf-softdevice/src/gatt.rs @@ -139,7 +139,7 @@ impl GattBearer<66> for SoftdeviceGattBearer { Some(ConnectionChannel::Proxy) => { self.server .proxy - .data_out_notify(connection, pdu.clone()) + .data_out_notify(connection, &pdu) .map_err(|_| BearerError::TransmissionFailure)?; } _ => {} From 3f0191446782921928d76cf6c268833c80abb050 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Thu, 22 Jun 2023 19:07:52 +0200 Subject: [PATCH 09/11] build: bump embassy crates version --- btmesh-nrf-softdevice/Cargo.toml | 2 +- .../examples/microbit/basic/Cargo.toml | 10 +++++----- .../examples/nrf52840-dk/basic/Cargo.toml | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/btmesh-nrf-softdevice/Cargo.toml b/btmesh-nrf-softdevice/Cargo.toml index e90e921..985f4a8 100644 --- a/btmesh-nrf-softdevice/Cargo.toml +++ b/btmesh-nrf-softdevice/Cargo.toml @@ -70,7 +70,7 @@ friend = ["btmesh-common/friend"] low_power = ["btmesh-common/low_power"] [patch.crates-io] -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml index 8016e46..481547e 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml @@ -81,11 +81,11 @@ opt-level = 1 overflow-checks = false [patch.crates-io] -embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml index e00dd95..ed38d83 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml @@ -81,11 +81,11 @@ opt-level = 1 overflow-checks = false [patch.crates-io] -embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "37a1e9f971214c11a614b06b230be27c688fff1d" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "1f2be2dac5eeed739d2866b9b63ca06fdd84c276" } nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b3eabb5383ae16a7772924f5301e6a79d0a591f" } From a4ca5a0c2b85a2db630342e341d9d98f337e77d9 Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Thu, 22 Jun 2023 19:08:33 +0200 Subject: [PATCH 10/11] fix: enable rt feature This commit enables the `rt` feature gate in the Embassy HALs, which was introduced in commit 8c93805. This feature gate provides access to the reset and runtime code necessary for ARM Cortex-M microcontrollers, allowing for low-level functionality such as exception handling and interrupt handling. --- btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml | 1 + btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml index 481547e..48ab138 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml @@ -27,6 +27,7 @@ embassy-time = { version = "0.1.0", default-features = false, features = [ "defmt-timestamp-uptime", ] } embassy-nrf = { version = "0.1.0", default-features = false, features = [ + "rt", "nrf52833", "gpiote", "time-driver-rtc1", diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml index ed38d83..c79b0c5 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml @@ -27,6 +27,7 @@ embassy-time = { version = "0.1.0", default-features = false, features = [ "defmt-timestamp-uptime", ] } embassy-nrf = { version = "0.1.0", default-features = false, features = [ + "rt", "nrf52840", "gpiote", "time-driver-rtc1", From c02f44bb2d09dd2488e1782db6c4f20c52e490ca Mon Sep 17 00:00:00 2001 From: Badr Bouslikhin Date: Fri, 23 Jun 2023 16:04:55 +0200 Subject: [PATCH 11/11] test(driver): fix tests by using critical-section --- btmesh-driver/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/btmesh-driver/Cargo.toml b/btmesh-driver/Cargo.toml index 40b8899..9a9a5d1 100644 --- a/btmesh-driver/Cargo.toml +++ b/btmesh-driver/Cargo.toml @@ -16,6 +16,7 @@ embassy-time = { version = "0.1.0", default-features = false } embassy-sync = { version = "0.2.0", default-features = false, features = [ "nightly", ] } +critical-section = { version = "1.1.1", default-features = false, optional = true } embassy-futures = { version = "0.1.0", default-features = false } heapless = "0.7" hash32 = "0.2.1" @@ -40,7 +41,7 @@ rand_core = { version = "0.6.2", default-features = false, features = [ [features] default = ["flash", "memory", "relay", "std"] -std = ["embassy-time/std"] +std = ["embassy-time/std", "critical-section/std"] flash = [ "embedded-storage", "embedded-storage-async",