79
hp-core/Cargo.toml
Normal file
79
hp-core/Cargo.toml
Normal file
@@ -0,0 +1,79 @@
|
||||
[package]
|
||||
name = "hp-core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
aligned = { version = "0.4.2", optional = true }
|
||||
bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "a5148d8ae679e021b78f53fd33afb8bb35d0b62e", features = [ "macros", "async"] }
|
||||
blocking-network-stack = { git = "https://github.com/bjoernQ/blocking-network-stack.git", rev = "b3ecefc222d8806edd221f266999ca339c52d34e" }
|
||||
bt-hci = "0.2.0"
|
||||
cfg-if = "1.0.0"
|
||||
critical-section = "1.1.3"
|
||||
embassy-executor = { version = "0.7.0", features = ["task-arena-size-20480"] }
|
||||
embassy-futures = "0.1.1"
|
||||
embassy-net = { version = "0.6.0", features = [ "tcp", "udp", "dhcpv4", "medium-ethernet"] }
|
||||
embassy-sync = "0.6.0"
|
||||
embassy-time = "0.4.0"
|
||||
embassy-usb = { version = "0.2.0", default-features = false }
|
||||
embedded-can = "0.4.1"
|
||||
embedded-hal-async = "1.0.0"
|
||||
embedded-io = { version = "0.6.1", default-features = false }
|
||||
embedded-io-async = "0.6.1"
|
||||
embedded-storage = "0.3.1"
|
||||
esp-alloc = "0.6.0"
|
||||
esp-backtrace = { version = "0.15.0", features = ["esp32c6", "exception-handler", "panic-handler", "println"] }
|
||||
esp-hal = { version = "0.23.1", features = ["log"] }
|
||||
esp-hal-embassy = { version = "0.6.0", optional = true }
|
||||
esp-ieee802154 = { version = "0.5.0", optional = true }
|
||||
esp-println = { version = "0.13.0", features = ["log"] }
|
||||
esp-storage = { version = "0.4.0", optional = true }
|
||||
esp-wifi = { version = "0.12.0", features = ["log"], optional = true }
|
||||
heapless = "0.8.0"
|
||||
hmac = { version = "0.12.1", default-features = false }
|
||||
ieee80211 = { version = "0.4.0", default-features = false }
|
||||
ieee802154 = "0.6.1"
|
||||
log = "0.4.22"
|
||||
nb = "1.1.0"
|
||||
portable-atomic = { version = "1.9.0", default-features = false }
|
||||
sha2 = { version = "0.10.8", default-features = false }
|
||||
smoltcp = { version = "0.12.0", default-features = false, features = [ "medium-ethernet", "socket-raw"] }
|
||||
embedded-time = "=0.12.1"
|
||||
static_cell = { version = "2.1.0", features = ["nightly"] }
|
||||
usb-device = "0.3.2"
|
||||
usbd-serial = "0.2.2"
|
||||
edge-dhcp = { version = "0.5.0" }
|
||||
edge-raw = { version = "0.5.0" }
|
||||
edge-nal = { version = "0.5.0" }
|
||||
edge-nal-embassy = { version = "0.5.0" }
|
||||
|
||||
[features]
|
||||
default=["esp32c6"]
|
||||
|
||||
esp32 = ["esp-hal/esp32", "esp-backtrace/esp32", "esp-hal-embassy?/esp32", "esp-println/esp32", "esp-storage?/esp32", "esp-wifi?/esp32"]
|
||||
esp32c2 = ["esp-hal/esp32c2", "esp-backtrace/esp32c2", "esp-hal-embassy?/esp32c2", "esp-println/esp32c2", "esp-storage?/esp32c2", "esp-wifi?/esp32c2", ]
|
||||
esp32c3 = ["esp-hal/esp32c3", "esp-backtrace/esp32c3", "esp-hal-embassy?/esp32c3", "esp-println/esp32c3", "esp-storage?/esp32c3", "esp-wifi?/esp32c3"]
|
||||
esp32c6 = ["esp-hal/esp32c6", "esp-backtrace/esp32c6", "esp-hal-embassy?/esp32c6", "esp-println/esp32c6", "esp-storage?/esp32c6", "esp-wifi?/esp32c6", "esp-ieee802154?/esp32c6"]
|
||||
esp32h2 = ["esp-hal/esp32h2", "esp-backtrace/esp32h2", "esp-hal-embassy?/esp32h2", "esp-println/esp32h2", "esp-storage?/esp32h2", "esp-wifi?/esp32h2", "esp-ieee802154?/esp32h2"]
|
||||
esp32s2 = ["esp-hal/esp32s2", "esp-backtrace/esp32s2", "esp-hal-embassy?/esp32s2", "esp-println/esp32s2", "esp-storage?/esp32s2", "esp-wifi?/esp32s2"]
|
||||
esp32s3 = ["esp-hal/esp32s3", "esp-backtrace/esp32s3", "esp-hal-embassy?/esp32s3", "esp-println/esp32s3", "esp-storage?/esp32s3", "esp-wifi?/esp32s3"]
|
||||
|
||||
esp-wifi = ["dep:esp-wifi"]
|
||||
|
||||
embassy = ["dep:esp-hal-embassy"]
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
debug = 2
|
||||
debug-assertions = true
|
||||
incremental = false
|
||||
opt-level = 3
|
||||
lto = 'fat'
|
||||
overflow-checks = false
|
||||
|
||||
[build]
|
||||
rustflags = [
|
||||
"-C", "force-frame-pointers",
|
||||
]
|
19
hp-core/build.rs
Normal file
19
hp-core/build.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::error::Error;
|
||||
|
||||
// use esp_build::assert_unique_used_features;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
// assert_unique_used_features!("esp32c6");
|
||||
|
||||
// NOTE: update when adding new device support!
|
||||
// Determine the name of the configured device:
|
||||
let device_name = "esp32c6";
|
||||
|
||||
// Define all necessary configuration symbols for the configured device:
|
||||
println!("cargo:rustc-cfg={}", device_name);
|
||||
|
||||
println!("cargo:rustc-link-arg=-Tlinkall.x");
|
||||
|
||||
// // Done!
|
||||
Ok(())
|
||||
}
|
52
hp-core/src/main.rs
Normal file
52
hp-core/src/main.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
//! This shows a very basic example of running code on the LP core.
|
||||
//!
|
||||
//! Code on LP core increments a counter and continuously toggles LED. The
|
||||
//! current value is printed by the HP core.
|
||||
//!
|
||||
//! Make sure to first compile the `esp-lp-hal/examples/blinky.rs` example
|
||||
//!
|
||||
//! The following wiring is assumed:
|
||||
//! - LED => GPIO1
|
||||
|
||||
//% CHIPS: esp32c6
|
||||
//% FEATURES: esp-hal/unstable
|
||||
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use esp_backtrace as _;
|
||||
use esp_hal::{
|
||||
gpio::lp_io::LowPowerOutput,
|
||||
load_lp_code,
|
||||
lp_core::{LpCore, LpCoreWakeupSource},
|
||||
main,
|
||||
};
|
||||
use esp_println::{print, println};
|
||||
|
||||
#[main]
|
||||
fn main() -> ! {
|
||||
let peripherals = esp_hal::init(esp_hal::Config::default());
|
||||
|
||||
// configure GPIO 1 as LP output pin
|
||||
|
||||
let lp_pin = LowPowerOutput::new(peripherals.GPIO1);
|
||||
|
||||
let mut lp_core = LpCore::new(peripherals.LP_CORE);
|
||||
lp_core.stop();
|
||||
println!("lp core stopped");
|
||||
|
||||
// load code to LP core
|
||||
let lp_core_code =
|
||||
load_lp_code!("./target/riscv32imac-unknown-none-elf/release/lp-core");
|
||||
|
||||
// start LP core
|
||||
lp_core_code.run(&mut lp_core, LpCoreWakeupSource::HpCpu, lp_pin);
|
||||
println!("lpcore run");
|
||||
|
||||
let data = (0x5000_2000) as *mut u32;
|
||||
loop {
|
||||
print!("Current {:x} \u{000d}", unsafe {
|
||||
data.read_volatile()
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user