Add the (incomplete and non-buildable) esp32s2-hal and esp32s3-hal packages

This commit is contained in:
Jesse Braham 2021-11-23 14:07:47 -08:00
parent 7fa2c4dbcf
commit 61e3d6ccf3
13 changed files with 148 additions and 0 deletions

View File

@ -3,4 +3,6 @@ members = [
"esp-hal-common", "esp-hal-common",
"esp32-hal", "esp32-hal",
"esp32c3-hal", "esp32c3-hal",
"esp32s2-hal",
"esp32s3-hal",
] ]

View File

@ -0,0 +1,12 @@
[target.xtensa-esp32s2-none-elf]
runner = "xtensa-esp32s2-elf-gdb -q -x xtensa.gdb"
[build]
rustflags = [
"-C", "link-arg=-nostartfiles",
"-C", "link-arg=-Wl,-Tlink.x",
]
target = "xtensa-esp32s2-none-elf"
[unstable]
build-std = ["core"]

31
esp32s2-hal/Cargo.toml Normal file
View File

@ -0,0 +1,31 @@
[package]
name = "esp32s2-hal"
version = "0.1.0"
edition = "2018"
[dependencies]
bare-metal = "1.0"
embedded-hal = { version = "0.2", features = ["unproven"] }
nb = "1.0"
void = { version = "1.0", default-features = false }
xtensa-lx = { version = "0.4", features = ["lx6"] } # FIXME
[dependencies.esp32s2]
path = "../../esp-pacs/esp32s2"
[dependencies.esp-hal-common]
path = "../esp-hal-common"
features = ["32s2"]
[dependencies.xtensa-lx-rt]
git = "https://github.com/esp-rs/xtensa-lx-rt/"
branch = "unify-xtensa-asm"
features = ["lx6"]
optional = true
[dev-dependencies]
panic-halt = "0.2"
[features]
default = ["rt"]
rt = ["esp32s2/rt", "xtensa-lx-rt"]

1
esp32s2-hal/README.md Normal file
View File

@ -0,0 +1 @@
# esp32s2-hal

21
esp32s2-hal/build.rs Normal file
View File

@ -0,0 +1,21 @@
use std::{env, fs::File, io::Write, path::PathBuf};
fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
File::create(out.join("alias.x"))
.unwrap()
.write_all(include_bytes!("rom.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
// Only re-run the build script when memory.x is changed,
// instead of when any part of the source code changes.
println!("cargo:rerun-if-changed=memory.x");
}

View File

@ -0,0 +1,4 @@
[toolchain]
channel = "esp"
components = ["rustfmt", "rustc-dev"]
targets = ["xtensa-esp32s2-none-elf"]

8
esp32s2-hal/src/lib.rs Normal file
View File

@ -0,0 +1,8 @@
#![no_std]
pub use embedded_hal as ehal;
pub use esp32s2 as pac;
pub use esp_hal_common::{prelude, Serial, Timer};
#[no_mangle]
extern "C" fn DefaultHandler(_level: u32, _interrupt: pac::Interrupt) {}

View File

@ -0,0 +1,12 @@
[target.xtensa-esp32s3-none-elf]
runner = "xtensa-esp32s3-elf-gdb -q -x xtensa.gdb"
[build]
rustflags = [
"-C", "link-arg=-nostartfiles",
"-C", "link-arg=-Wl,-Tlink.x",
]
target = "xtensa-esp32s3-none-elf"
[unstable]
build-std = ["core"]

31
esp32s3-hal/Cargo.toml Normal file
View File

@ -0,0 +1,31 @@
[package]
name = "esp32s3-hal"
version = "0.1.0"
edition = "2018"
[dependencies]
bare-metal = "1.0"
embedded-hal = { version = "0.2", features = ["unproven"] }
nb = "1.0"
void = { version = "1.0", default-features = false }
xtensa-lx = { version = "0.4", features = ["lx6"] } # FIXME
[dependencies.esp32s3]
path = "../../esp-pacs/esp32s3"
[dependencies.esp-hal-common]
path = "../esp-hal-common"
features = ["32s3"]
[dependencies.xtensa-lx-rt]
git = "https://github.com/esp-rs/xtensa-lx-rt/"
branch = "unify-xtensa-asm"
features = ["lx6"]
optional = true
[dev-dependencies]
panic-halt = "0.2"
[features]
default = ["rt"]
rt = ["esp32s3/rt", "xtensa-lx-rt"]

1
esp32s3-hal/README.md Normal file
View File

@ -0,0 +1 @@
# esp32s3-hal

16
esp32s3-hal/build.rs Normal file
View File

@ -0,0 +1,16 @@
use std::{env, fs::File, io::Write, path::PathBuf};
fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
// Only re-run the build script when memory.x is changed,
// instead of when any part of the source code changes.
println!("cargo:rerun-if-changed=memory.x");
}

View File

@ -0,0 +1,4 @@
[toolchain]
channel = "esp"
components = ["rustfmt", "rustc-dev"]
targets = ["xtensa-esp32s3-none-elf"]

5
esp32s3-hal/src/lib.rs Normal file
View File

@ -0,0 +1,5 @@
#![no_std]
pub use embedded_hal as ehal;
pub use esp32s3 as pac;
pub use esp_hal_common::{prelude, Serial, Timer};