-
Hello everyone! I am trying to get a project generated by Can someone help me figure out what am I missingZ Here is the error I am getting while trying to build:
Here is my [package]
name = "esp32-waterplant"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
esp-backtrace = { version = "0.11.0", features = [
"esp32c3",
"exception-handler",
"panic-handler",
"println",
] }
esp-hal = { version = "0.16.0", features = [ "esp32c3", "embassy", "embassy-time-timg0", "embassy-executor-thread", "async" ] }
esp-println = { version = "0.9.0", features = ["esp32c3", "log"] }
log = { version = "0.4.20" }
esp-alloc = { version = "0.3.0" }
embedded-svc = { version = "0.26.1", default-features = false }
embedded-io = "0.6.1"
embedded-hal-async = "1.0.0"
esp-wifi = { version = "0.4.0", features = [
"esp32c3",
"phy-enable-usb",
"utils",
"wifi-default",
] }
embassy-executor = { version = "0.5.0", features = ["nightly"] }
embassy-time = { version = "0.3.0" }
heapless = { version = "0.8.0", default-features = false }
static_cell = "2.0"
[profile.dev]
# Rust debug is too slow.
# For debug builds always builds with some optimization
opt-level = "s"
[profile.release]
codegen-units = 1 # LLVM can perform better optimizations using a single thread
debug = 2
debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 's'
overflow-checks = false And here is my current #![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
extern crate alloc;
use core::mem::MaybeUninit;
use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
embassy::{self},
peripherals::Peripherals,
prelude::*,
timer::TimerGroup,
};
#[global_allocator]
static ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();
fn init_heap() {
const HEAP_SIZE: usize = 32 * 1024;
static mut HEAP: MaybeUninit<[u8; HEAP_SIZE]> = MaybeUninit::uninit();
unsafe {
ALLOCATOR.init(HEAP.as_mut_ptr() as *mut u8, HEAP_SIZE);
}
}
#[embassy_executor::task]
async fn run() {
loop {
esp_println::println!("Hello world from embassy using esp-hal-async!");
Timer::after(Duration::from_millis(1_000)).await;
}
}
#[main]
async fn main(spawner: Spawner) {
init_heap();
esp_println::println!("Init!");
let peripherals = Peripherals::take();
let system = peripherals.SYSTEM.split();
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
let timg0 = TimerGroup::new(peripherals.TIMG0, &clocks);
embassy::init(&clocks, timg0);
spawner.spawn(run()).ok();
loop {
esp_println::println!("Bing!");
Timer::after(Duration::from_millis(5_000)).await;
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I think I stumbled on this lately which lead me to #1087 . |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
I think I stumbled on this lately which lead me to #1087 .
I think eventually I added
embassy-integrated-timers
feature to my esp-hal, but I'm using esp32s3, so don't know if it's the same in your case.