diff --git a/README.md b/README.md index e6c1844..edaf8a2 100644 --- a/README.md +++ b/README.md @@ -16,29 +16,62 @@ Firmware for Pinetime based on [Embassy](https://embassy.dev). The goal is to pr * Automatically synchronizes time with using BLE standard Current Time Service. * Rollback to previous firmware if reset or crashing before new firmware is validated in watch UI. * Compatible with existing InfiniTime bootloader. - -NOTE: Some features that has been removed after recent switch to mcuboot, but will be added again soon: - * DFU: Implements Nordic DFU protocol so you can update from a phone app such as nRF Connect to perform firmware updates. - ## Getting started If you have InfiniTime running already, it's easy to try out Watchful. You can use the same app you use to update InfiniTime to try out Watchful (such as GadgetBridge). Pick the `watchful-dfu.zip` from the [latest release](https://github.com/lulf/watchful/releases) and upload it to your watch. To revert back to InfiniTime, head into the menu -> settings -> reset, and mcuboot will do the rest. +To permanently mark Watchful as your OS, go to settings -> firmware and press `validate`. If you want to move back to InfiniTime later, you can use the DFU mechanism with the standard InfiniTime DFU image. + ## Developing The recommended way to develop Watchful is to get a [PineTime Development Kit](https://pine64.com/product/pinetime-dev-kit/), to which you can connect a debug probe. For flashing and running with the debug probe, `probe-rs` is recommended. -To run Watchful: + +### Running without MCUBoot + +While developing, running without the bootloader is the quickest way to iterate: ``` 4d cd firmware cargo run --release --features panic-probe,baremetal ``` +### Building an image + +To build an MCUBoot compatible image: + +``` +cd firmware +cargo build --release +cargo objcopy --release -- -O binary watchful.bin +../tools/mcuboot/imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header watchful.bin watchful-image.bin +``` + +You can also download the latest non-released image from the CI. + +### Flashing MCUBoot + +Flashing MCUBoot requires the mcuboot image: + +``` +probe-rs erase --chip nRF52832_xxAA +probe-rs download tools/mcuboot/mcuboot.bin --binary-format Binary --chip nRF52832_xxAA +``` + +You can also build the MCUBoot image yourself from the [pinetime-mcuboot-bootloader](https://github.com/InfiniTimeOrg/pinetime-mcuboot-bootloader). + +### Flashing Watchful Image + +To flash the watchful image, use the artifact from your own build, CI or a release: + +``` +probe-rs download watchful-image.bin --binary-format Binary --base-address 0x8000 --chip nRF52832_xxAA +``` + ## Recovering from older versions of Watchful NOTE: If you've used watchful before, it now has switched from using `embassy-boot` to `mcuboot` as provided by default on InfiniTime. To achieve that, the [nrf-softdevice](https://github.com/embassy-rs/nrf-softdevice/) has been replaced with [trouble](https://github.com/embassy-rs/trouble). diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock index 2ee0b22..df70592 100644 --- a/firmware/Cargo.lock +++ b/firmware/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -118,6 +118,20 @@ name = "bt-hci" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d69e2db053409c36c45a403da58072b8bf75bdc962746c0a12df9dec0fce92d2" +dependencies = [ + "defmt", + "embassy-sync", + "embedded-io", + "embedded-io-async", + "futures-intrusive", + "heapless", +] + +[[package]] +name = "bt-hci" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69c6b9d78fe4db539449fc8782dd2554fd4baee27f6e6dbf2e4757fcbc36139" dependencies = [ "defmt", "embassy-sync", @@ -370,11 +384,12 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "embassy-embedded-hal" -version = "0.2.0" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +version = "0.3.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "defmt", "embassy-futures", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e)", "embassy-sync", "embassy-time", "embedded-hal 0.2.7", @@ -387,22 +402,20 @@ dependencies = [ [[package]] name = "embassy-executor" -version = "0.6.3" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +version = "0.7.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "cortex-m 0.7.7", "critical-section", "defmt", "document-features", "embassy-executor-macros", - "embassy-time-driver", - "embassy-time-queue-driver", ] [[package]] name = "embassy-executor-macros" version = "0.6.2" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "darling", "proc-macro2", @@ -413,7 +426,7 @@ dependencies = [ [[package]] name = "embassy-futures" version = "0.1.1" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" [[package]] name = "embassy-hal-internal" @@ -427,7 +440,7 @@ dependencies = [ [[package]] name = "embassy-hal-internal" version = "0.2.0" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "cortex-m 0.7.7", "critical-section", @@ -437,8 +450,8 @@ dependencies = [ [[package]] name = "embassy-nrf" -version = "0.2.0" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +version = "0.3.1" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -448,10 +461,11 @@ dependencies = [ "defmt", "document-features", "embassy-embedded-hal", - "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f)", + "embassy-hal-internal 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e)", "embassy-sync", "embassy-time", "embassy-time-driver", + "embassy-time-queue-utils", "embassy-usb-driver", "embedded-hal 0.2.7", "embedded-hal 1.0.0", @@ -467,8 +481,8 @@ dependencies = [ [[package]] name = "embassy-sync" -version = "0.6.0" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +version = "0.6.2" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "cfg-if", "critical-section", @@ -481,39 +495,41 @@ dependencies = [ [[package]] name = "embassy-time" -version = "0.3.2" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +version = "0.4.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "cfg-if", "critical-section", "defmt", "document-features", "embassy-time-driver", - "embassy-time-queue-driver", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", "futures-util", - "heapless", ] [[package]] name = "embassy-time-driver" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +version = "0.2.0" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "document-features", ] [[package]] -name = "embassy-time-queue-driver" +name = "embassy-time-queue-utils" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" +dependencies = [ + "embassy-executor", + "heapless", +] [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy.git?rev=fe79af56141adfeacb3cfcefc4400da0c5aabb5f#fe79af56141adfeacb3cfcefc4400da0c5aabb5f" +source = "git+https://github.com/embassy-rs/embassy.git?rev=bcebe4c4d5b597da0b8741916e450c46e6fef06e#bcebe4c4d5b597da0b8741916e450c46e6fef06e" dependencies = [ "defmt", ] @@ -960,9 +976,9 @@ dependencies = [ [[package]] name = "nrf-dfu-target" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f9ac7f9a8086a92b33b741b8de8691b95d01b3c0ac3abdce8a3359da07b943" +checksum = "48ae7d3263cee8bf1a2f9256f4c9d67fe30c142ca78a64512bcaa194e78496ea" dependencies = [ "defmt", "embedded-storage-async", @@ -971,7 +987,7 @@ dependencies = [ [[package]] name = "nrf-mpsl" version = "0.1.0" -source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=1dd59a3bc60309cb7f12ca2ba52566d63225a394#1dd59a3bc60309cb7f12ca2ba52566d63225a394" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=551a95436e999b4290b4a33383aa3d6747b63dd9#551a95436e999b4290b4a33383aa3d6747b63dd9" dependencies = [ "cortex-m 0.7.7", "critical-section", @@ -987,7 +1003,7 @@ dependencies = [ [[package]] name = "nrf-mpsl-sys" version = "0.1.0" -source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=1dd59a3bc60309cb7f12ca2ba52566d63225a394#1dd59a3bc60309cb7f12ca2ba52566d63225a394" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=551a95436e999b4290b4a33383aa3d6747b63dd9#551a95436e999b4290b4a33383aa3d6747b63dd9" dependencies = [ "bindgen", "doxygen-rs", @@ -996,7 +1012,8 @@ dependencies = [ [[package]] name = "nrf-pac" version = "0.1.0" -source = "git+https://github.com/embassy-rs/nrf-pac?rev=12e2461859acb0bfea9b2ef5cd73f1283c139ac0#12e2461859acb0bfea9b2ef5cd73f1283c139ac0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d334027d6703534f2a80de0794ae435c0e029358d28278533d3935e69b221b01" dependencies = [ "cortex-m 0.7.7", "cortex-m-rt", @@ -1005,9 +1022,9 @@ dependencies = [ [[package]] name = "nrf-sdc" version = "0.1.0" -source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=1dd59a3bc60309cb7f12ca2ba52566d63225a394#1dd59a3bc60309cb7f12ca2ba52566d63225a394" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=551a95436e999b4290b4a33383aa3d6747b63dd9#551a95436e999b4290b4a33383aa3d6747b63dd9" dependencies = [ - "bt-hci", + "bt-hci 0.2.0", "critical-section", "defmt", "embassy-hal-internal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1023,7 +1040,7 @@ dependencies = [ [[package]] name = "nrf-sdc-sys" version = "0.1.0" -source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=1dd59a3bc60309cb7f12ca2ba52566d63225a394#1dd59a3bc60309cb7f12ca2ba52566d63225a394" +source = "git+https://github.com/alexmoon/nrf-sdc.git?rev=551a95436e999b4290b4a33383aa3d6747b63dd9#551a95436e999b4290b4a33383aa3d6747b63dd9" dependencies = [ "bindgen", "doxygen-rs", @@ -1046,26 +1063,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_enum" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "num_threads" version = "0.1.7" @@ -1460,27 +1457,24 @@ dependencies = [ [[package]] name = "trouble-host" version = "0.1.0" -source = "git+https://github.com/embassy-rs/trouble.git?rev=07fa452e836f07a302596edb6a61e060d242e4ea#07fa452e836f07a302596edb6a61e060d242e4ea" +source = "git+https://github.com/embassy-rs/trouble.git?rev=54cd0465ca497495b5890d896fc1f048f0a0f1ee#54cd0465ca497495b5890d896fc1f048f0a0f1ee" dependencies = [ - "bt-hci", + "bt-hci 0.2.0", "defmt", "embassy-futures", "embassy-sync", "embassy-time", "embedded-io", - "embedded-io-async", "futures", "heapless", - "num_enum", "static_cell 2.1.0", - "thiserror", "trouble-host-macros", ] [[package]] name = "trouble-host-macros" version = "0.1.0" -source = "git+https://github.com/embassy-rs/trouble.git?rev=07fa452e836f07a302596edb6a61e060d242e4ea#07fa452e836f07a302596edb6a61e060d242e4ea" +source = "git+https://github.com/embassy-rs/trouble.git?rev=54cd0465ca497495b5890d896fc1f048f0a0f1ee#54cd0465ca497495b5890d896fc1f048f0a0f1ee" dependencies = [ "Inflector", "darling", @@ -1561,7 +1555,7 @@ dependencies = [ name = "watchful" version = "0.2.6" dependencies = [ - "bt-hci", + "bt-hci 0.1.2", "byte-slice-cast", "cortex-m 0.7.7", "cortex-m-rt", diff --git a/firmware/Cargo.toml b/firmware/Cargo.toml index 12e58f6..2a37bff 100644 --- a/firmware/Cargo.toml +++ b/firmware/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "watchful" -version = "0.2.6" +version = "0.3.0" license = "MIT OR Apache-2.0" build = "build.rs" resolver = "2" @@ -9,11 +9,11 @@ resolver = "2" [dependencies] embassy-futures = { version = "0.1" } futures = { version = "0.3", default-features = false, features = ["async-await"]} -embassy-embedded-hal = { version = "0.2", default-features = false } +embassy-embedded-hal = { version = "0.3", default-features = false } embassy-sync = { version = "0.6" } -embassy-executor = { version = "0.6", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers", "nightly"] } -embassy-time = { version = "0.3", features = ["defmt", "defmt-timestamp-uptime"] } -embassy-nrf = { version = "0.2", features = ["defmt", "nrf52832", "time-driver-rtc1", "rt", "gpiote", "unstable-pac", "time", "nfc-pins-as-gpio"] } +embassy-executor = { version = "0.7", features = ["arch-cortex-m", "executor-thread", "defmt", "nightly"] } +embassy-time = { version = "0.4", features = ["defmt", "defmt-timestamp-uptime"] } +embassy-nrf = { version = "0.3", features = ["defmt", "nrf52832", "time-driver-rtc1", "rt", "gpiote", "unstable-pac", "time", "nfc-pins-as-gpio"] } embedded-io = "0.6" embedded-io-async = "0.6" embedded-storage = "0.3" @@ -21,7 +21,7 @@ embedded-storage-async = "0.4" embedded-hal = "1.0" embedded-hal-async = "1.0" embedded-hal-bus = "0.2" -nrf-dfu-target = { version = "0.3.1", features = ["defmt"] } +nrf-dfu-target = { version = "0.3.2", features = ["defmt"] } pinetime-flash = { version = "0.1.0", path = "../pinetime-flash", features = ["defmt"] } watchful-ui = { version = "0.1.0", path = "../watchful-ui", features = ["defmt"] } cst816s = "0.1.4" @@ -57,19 +57,19 @@ vergen = { version = "8", features = ["build", "git", "gitcl"] } [patch.crates-io] hrs3300 = { git = "https://github.com/lulf/hrs3300-rs.git", branch = "hal-1.0" } -nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "1dd59a3bc60309cb7f12ca2ba52566d63225a394" } -nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "1dd59a3bc60309cb7f12ca2ba52566d63225a394" } -trouble-host = { git = "https://github.com/embassy-rs/trouble.git", rev = "07fa452e836f07a302596edb6a61e060d242e4ea" } +nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "551a95436e999b4290b4a33383aa3d6747b63dd9" } +nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev = "551a95436e999b4290b4a33383aa3d6747b63dd9" } +trouble-host = { git = "https://github.com/embassy-rs/trouble.git", rev = "54cd0465ca497495b5890d896fc1f048f0a0f1ee" } +#nrf-dfu-target = { path = "../../nrf-dfu" } #trouble-host = { path = "../../trouble/host" } -embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } -embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } -embassy-time-queue-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } -embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } -embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "fe79af56141adfeacb3cfcefc4400da0c5aabb5f" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "bcebe4c4d5b597da0b8741916e450c46e6fef06e" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "bcebe4c4d5b597da0b8741916e450c46e6fef06e" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "bcebe4c4d5b597da0b8741916e450c46e6fef06e" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "bcebe4c4d5b597da0b8741916e450c46e6fef06e" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "bcebe4c4d5b597da0b8741916e450c46e6fef06e" } +embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "bcebe4c4d5b597da0b8741916e450c46e6fef06e" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy.git", rev = "bcebe4c4d5b597da0b8741916e450c46e6fef06e" } [profile.release] debug = 2 diff --git a/firmware/src/ble.rs b/firmware/src/ble.rs index 5d5df73..8c3c5b7 100644 --- a/firmware/src/ble.rs +++ b/firmware/src/ble.rs @@ -158,8 +158,9 @@ pub const L2CAP_RXQ: u8 = 10; const CONNECTIONS_MAX: usize = 1; const L2CAP_CHANNELS_MAX: usize = 2; // Signal + att -type BleResources = HostResources; +type BleResources = HostResources; static RESOURCES: StaticCell = StaticCell::new(); +static STACK: StaticCell> = StaticCell::new(); fn ble_addr() -> Address { let ficr = embassy_nrf::pac::FICR; @@ -168,13 +169,13 @@ fn ble_addr() -> Address { Address::random(unwrap!(addr.to_le_bytes()[..6].try_into())) } -const NAME: &str = "WatchTest"; +const NAME: &str = "Watchful"; pub fn start(spawner: Spawner, controller: NrfController, dfu_config: DfuConfig<'static>) { - let resources = RESOURCES.init(BleResources::new(PacketQos::None)); - let (stack, peripheral, _, runner) = trouble_host::new(controller, resources) - .set_random_address(ble_addr()) - .build(); + let resources = RESOURCES.init(BleResources::new()); + let stack = STACK.init(trouble_host::new(controller, resources).set_random_address(ble_addr())); + + let Host { peripheral, runner, .. } = stack.build(); let gatt = unwrap!(PineTimeServer::new_with_config(GapConfig::Peripheral( PeripheralConfig { @@ -196,7 +197,7 @@ async fn ble_task(mut runner: Runner<'static, NrfController>) { #[embassy_executor::task] async fn advertise_task( - stack: Stack<'static, NrfController>, + stack: &'static Stack<'static, NrfController>, mut peripheral: Peripheral<'static, NrfController>, server: &'static PineTimeServer<'static>, mut dfu_config: DfuConfig<'static>, @@ -233,7 +234,7 @@ async fn advertise_task( } async fn process( - stack: Stack<'static, NrfController>, + stack: &'static Stack<'static, NrfController>, connection: Connection<'static>, server: &'static PineTimeServer<'_>, dfu_config: &mut DfuConfig<'static>, @@ -290,7 +291,7 @@ async fn process( } #[embassy_executor::task] -async fn sync_time(stack: Stack<'static, NrfController>, conn: Connection<'static>) { +async fn sync_time(stack: &'static Stack<'static, NrfController>, conn: Connection<'static>) { info!("[ble] synchronizing time"); let client = unwrap!(GattClient::<_, 10, ATT_MTU>::new(stack, &conn).await); match select( diff --git a/firmware/src/firmware_validator.rs b/firmware/src/firmware_validator.rs index fc7c595..dadb06d 100644 --- a/firmware/src/firmware_validator.rs +++ b/firmware/src/firmware_validator.rs @@ -24,7 +24,7 @@ impl<'d> FirmwareValidator<'d> { pub async fn validate(&self) { if !self.is_valid() { let mut flash = self.flash.lock().await; - if let Err(e) = flash.write(VALID_BIT_ADDRESS, &VALID_BIT_VALUE.to_le_bytes()).await { + if let Err(_e) = flash.write(VALID_BIT_ADDRESS, &VALID_BIT_VALUE.to_le_bytes()).await { defmt::warn!("Error validating firmware"); } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0d9e283..2cf88ab 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ # Before upgrading check that everything is available on all tier1 targets here: # https://rust-lang.github.io/rustup-components-history [toolchain] -channel = "nightly-2024-07-16" +channel = "nightly-2024-12-10" components = [ "rust-src", "rustfmt", "llvm-tools-preview" ] targets = [ "thumbv7em-none-eabi", diff --git a/tools/mcuboot/mcuboot.bin b/tools/mcuboot/mcuboot.bin new file mode 100644 index 0000000..799bc97 Binary files /dev/null and b/tools/mcuboot/mcuboot.bin differ