embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.48k stars 765 forks source link

Lots of errors #2688

Closed skhaz closed 7 months ago

skhaz commented 7 months ago

I'm following the starting guide, but instead of using the libraries with a relative path, I installed them using cargo add. Below, I show my Cargo.toml.

When I run cargo build, I receive about 30 errors in the embassy-nrf component.

Any ideas? Thank you.

$ cargo build
   Compiling nb v1.1.0
   Compiling byteorder v1.5.0
   Compiling critical-section v1.1.2
   Compiling cfg-if v1.0.0
   Compiling void v1.0.2
   Compiling pin-project-lite v0.2.13
   Compiling futures-task v0.3.30
   Compiling futures-core v0.3.30
   Compiling pin-utils v0.1.0
   Compiling nb v0.1.3
   Compiling stable_deref_trait v1.2.0
   Compiling futures-util v0.3.30
   Compiling embedded-io v0.6.1
   Compiling vcell v0.1.3
   Compiling embedded-hal v1.0.0
   Compiling embedded-hal v0.2.7
   Compiling bare-metal v0.2.5
   Compiling embassy-time-driver v0.1.0
   Compiling hash32 v0.3.1
   Compiling volatile-register v0.2.2
   Compiling embassy-time-queue-driver v0.1.0
   Compiling embedded-io-async v0.6.1
   Compiling heapless v0.8.0
   Compiling embedded-storage v0.3.1
   Compiling bitfield v0.13.2
   Compiling embedded-hal-async v1.0.0
   Compiling num-traits v0.2.18
   Compiling typenum v1.17.0
   Compiling az v1.2.1
   Compiling embedded-storage-async v0.4.1
   Compiling half v2.4.0
   Compiling embassy-futures v0.1.1
   Compiling cortex-m v0.7.7
   Compiling bytemuck v1.14.3
   Compiling cortex-m-rt v0.7.3
   Compiling embassy-usb-driver v0.1.0
   Compiling rand_core v0.6.4
   Compiling zoomies-new-firmware v0.1.0 (/opt/workspace/zoomies/zoomies-new-firmware)
   Compiling embassy-executor v0.5.0
   Compiling embassy-hal-internal v0.1.0
   Compiling fixed v1.26.0
   Compiling embassy-sync v0.5.0
   Compiling embassy-time v0.3.0
   Compiling embassy-embedded-hal v0.1.0
   Compiling embassy-nrf v0.1.0
error[E0583]: file not found for module `_version`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:27:1
   |
27 | mod _version;
   | ^^^^^^^^^^^^^
   |
   = help: to create the module `_version`, create file "/Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/_version.rs" or "/Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/_version/mod.rs"
   = note: if there is a `mod _version` elsewhere in the crate already, import it with `use crate::...` instead

error[E0583]: file not found for module `chip`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:100:1
    |
100 | mod chip;
    | ^^^^^^^^^
    |
    = help: to create the module `chip`, create file "/Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/chip.rs" or "/Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/chip/mod.rs"
    = note: if there is a `mod chip` elsewhere in the crate already, import it with `use crate::...` instead

error: No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:28:1
   |
28 | compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `crate::chip::FORCE_COPY_BUFFER_SIZE`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/spim.rs:15:5
   |
15 | use crate::chip::FORCE_COPY_BUFFER_SIZE;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `FORCE_COPY_BUFFER_SIZE` in `chip`

error[E0432]: unresolved import `crate::chip::FORCE_COPY_BUFFER_SIZE`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/spis.rs:13:5
   |
13 | use crate::chip::FORCE_COPY_BUFFER_SIZE;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `FORCE_COPY_BUFFER_SIZE` in `chip`

error[E0432]: unresolved imports `crate::chip::EASY_DMA_SIZE`, `crate::chip::FORCE_COPY_BUFFER_SIZE`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/twim.rs:17:19
   |
17 | use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE};
   |                   ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^ no `FORCE_COPY_BUFFER_SIZE` in `chip`
   |                   |
   |                   no `EASY_DMA_SIZE` in `chip`
   |
   = note: unresolved item `crate::spis::sealed::FORCE_COPY_BUFFER_SIZE` exists but is inaccessible

error[E0432]: unresolved imports `crate::chip::EASY_DMA_SIZE`, `crate::chip::FORCE_COPY_BUFFER_SIZE`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/twis.rs:16:19
   |
16 | use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE};
   |                   ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^ no `FORCE_COPY_BUFFER_SIZE` in `chip`
   |                   |
   |                   no `EASY_DMA_SIZE` in `chip`
   |
   = note: unresolved item `crate::twim::eh02::EASY_DMA_SIZE` exists but is inaccessible
   = note: unresolved item `crate::twim::eh02::FORCE_COPY_BUFFER_SIZE` exists but is inaccessible

error[E0432]: unresolved imports `crate::chip::EASY_DMA_SIZE`, `crate::chip::FORCE_COPY_BUFFER_SIZE`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/uarte.rs:27:19
   |
27 | use crate::chip::{EASY_DMA_SIZE, FORCE_COPY_BUFFER_SIZE};
   |                   ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^ no `FORCE_COPY_BUFFER_SIZE` in `chip`
   |                   |
   |                   no `EASY_DMA_SIZE` in `chip`
   |
   = note: unresolved item `crate::twis::sealed::EASY_DMA_SIZE` exists but is inaccessible
   = note: unresolved item `crate::twis::sealed::FORCE_COPY_BUFFER_SIZE` exists but is inaccessible

error[E0432]: unresolved import `chip::pac`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:157:16
    |
157 | pub(crate) use chip::pac;
    |                ^^^^^^^^^ no `pac` in `chip`

error[E0432]: unresolved imports `chip::peripherals`, `chip::Peripherals`, `chip::EASY_DMA_SIZE`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:158:16
    |
158 | pub use chip::{peripherals, Peripherals, EASY_DMA_SIZE};
    |                ^^^^^^^^^^^  ^^^^^^^^^^^  ^^^^^^^^^^^^^ no `EASY_DMA_SIZE` in `chip`
    |                |            |
    |                |            no `Peripherals` in `chip`
    |                no `peripherals` in `chip`
    |
    = help: consider importing this struct instead:
            cortex_m::Peripherals
    = note: unresolved item `crate::uarte::eh02::EASY_DMA_SIZE` exists but is inaccessible

error[E0433]: failed to resolve: use of undeclared crate or module `pac`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/buffered_uarte.rs:22:9
   |
22 | pub use pac::uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Parity};
   |         ^^^ use of undeclared crate or module `pac`

error[E0432]: unresolved import `crate::chip::interrupt`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:161:9
    |
161 | pub use crate::chip::interrupt;
    |         ^^^^^^^^^^^^^^^^^^^^^^ no `interrupt` in `chip`
    |
help: consider importing one of these items instead
    |
161 | pub use cortex_m::interrupt;
    |         ~~~~~~~~~~~~~~~~~~~
161 | pub use embassy_hal_internal::interrupt;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0433]: failed to resolve: use of undeclared crate or module `pac`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/spim.rs:13:9
   |
13 | pub use pac::spim0::frequency::FREQUENCY_A as Frequency;
   |         ^^^ use of undeclared crate or module `pac`

error[E0433]: failed to resolve: use of undeclared crate or module `pac`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/uarte.rs:23:5
   |
23 | use pac::uarte0::RegisterBlock;
   |     ^^^ use of undeclared crate or module `pac`

error[E0433]: failed to resolve: use of undeclared crate or module `pac`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/uarte.rs:25:9
   |
25 | pub use pac::uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Parity};
   |         ^^^ use of undeclared crate or module `pac`

error[E0432]: unresolved import `pac`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/saadc.rs:12:5
   |
12 | use pac::{saadc, SAADC};
   |     ^^^ use of undeclared crate or module `pac`

error[E0425]: cannot find function `regs` in module `ppi`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/buffered_uarte.rs:135:22
    |
135 |                 ppi::regs().chenset.write(|w| unsafe { w.bits(1 << chn) });
    |                      ^^^^ not found in `ppi`

error[E0425]: cannot find function `regs` in module `ppi`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/buffered_uarte.rs:159:43
    |
159 |                 let ppi_ch_enabled = ppi::regs().chen.read().bits() & (1 << chn) != 0;
    |                                           ^^^^ not found in `ppi`

error[E0425]: cannot find function `regs` in module `ppi`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/buffered_uarte.rs:167:26
    |
167 |                     ppi::regs().chenclr.write(|w| unsafe { w.bits(1 << chn) });
    |                          ^^^^ not found in `ppi`

error[E0425]: cannot find value `FLASH_SIZE` in module `crate::chip`
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/nvmc.rs:21:44
   |
21 | pub const FLASH_SIZE: usize = crate::chip::FLASH_SIZE;
   |                                            ^^^^^^^^^^ not found in `crate::chip`

error[E0433]: failed to resolve: use of undeclared crate or module `consts`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:421:34
    |
421 |             let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_ENABLED);
    |                                  ^^^^^^ use of undeclared crate or module `consts`

error[E0433]: failed to resolve: use of undeclared crate or module `consts`
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:421:58
    |
421 |             let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_ENABLED);
    |                                                          ^^^^^^ use of undeclared crate or module `consts`

error[E0425]: cannot find function `regs` in this scope
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:51:17
   |
51 |         let r = regs();
   |                 ^^^^ not found in this scope

error[E0425]: cannot find function `regs` in this scope
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:65:17
   |
65 |         let r = regs();
   |                 ^^^^ not found in this scope

error[E0425]: cannot find function `regs` in this scope
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:78:17
   |
78 |         let r = regs();
   |                 ^^^^ not found in this scope

error[E0425]: cannot find function `regs` in this scope
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:87:9
   |
87 |         regs().tasks_chg[n].en.write(|w| unsafe { w.bits(1) });
   |         ^^^^ not found in this scope

error[E0425]: cannot find function `regs` in this scope
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:93:9
   |
93 |         regs().tasks_chg[n].dis.write(|w| unsafe { w.bits(1) });
   |         ^^^^ not found in this scope

error[E0425]: cannot find function `regs` in this scope
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:101:25
    |
101 |         Task::from_reg(&regs().tasks_chg[n].en)
    |                         ^^^^ not found in this scope

error[E0425]: cannot find function `regs` in this scope
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:109:25
    |
109 |         Task::from_reg(&regs().tasks_chg[n].dis)
    |                         ^^^^ not found in this scope

error[E0425]: cannot find function `regs` in this scope
   --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/ppi/mod.rs:115:17
    |
115 |         let r = regs();
    |                 ^^^^ not found in this scope

Some errors have detailed explanations: E0425, E0432, E0433, E0583.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `embassy-nrf` (lib) due to 30 previous errors
warning: build failed, waiting for other jobs to finish...

Cargo.toml

[package]
name = "firmware"
version = "0.1.0"
edition = "2021"

[dependencies]
embassy-executor = "0.5.0"
embassy-nrf = "0.1.0"
embassy-time = "0.3.0"

rust-toolchain.toml

[toolchain]
components = ["rust-src", "rustfmt"]
targets = ["thumbv7em-none-eabihf"]

.cargo/config.toml

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# replace STM32WB55CCUx with your chip as listed in `probe-rs chip list`
# runner = "probe-run --chip STM32WB55RGVx --speed 1000 --connect-under-reset"
runner = "teleprobe local run --chip STM32WB55RG --elf"

[build]
target = "thumbv7em-none-eabihf"

[env]
DEFMT_LOG = "trace"
Dirbaio commented 7 months ago

this error is telling you the problem



error: No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840
  --> /Users/skhaz/.asdf/installs/rust/1.76.0/registry/src/index.crates.io-6f17d22bba15001f/embassy-nrf-0.1.0/src/lib.rs:28:1
   |
28 | compile_error!("No chip feature activated. You must activate exactly one of the following features: nrf52810, nrf52811, nrf52832, nrf52833, nrf52840");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
skhaz commented 7 months ago

Thank you