-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the
esp32c6-lp-hal
package (#714)
* Create the `esp32c6-lp-hal` package * Update CHANGELOG
- Loading branch information
1 parent
846f3b0
commit 64556da
Showing
10 changed files
with
305 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[target.riscv32imac-unknown-none-elf] | ||
runner = "espflash flash --monitor" | ||
rustflags = [ | ||
"-C", "link-arg=-Tlinkall.x", | ||
] | ||
|
||
[build] | ||
target = "riscv32imac-unknown-none-elf" | ||
|
||
[unstable] | ||
build-std = ["core"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[package] | ||
name = "esp32c6-lp-hal" | ||
version = "0.1.0" | ||
edition = "2021" | ||
rust-version = "1.65.0" | ||
description = "HAL for ESP32-C6's low-power coprocessor" | ||
repository = "https://github.com/esp-rs/esp-hal" | ||
license = "MIT OR Apache-2.0" | ||
|
||
keywords = [ | ||
"embedded", | ||
"embedded-hal", | ||
"esp", | ||
"esp32c6", | ||
"no-std", | ||
] | ||
categories = [ | ||
"embedded", | ||
"hardware-support", | ||
"no-std", | ||
] | ||
|
||
[dependencies] | ||
critical-section = { version = "1.1.2", features = ["restore-state-u8"] } | ||
embedded-hal = { version = "0.2.7", features = ["unproven"] } | ||
esp32c6-lp = { git = "https://github.com/esp-rs/esp-pacs", rev = "a9cad5e", features = ["critical-section"] } | ||
riscv = "0.10.1" | ||
|
||
[features] | ||
default = [] | ||
debug = ["esp32c6-lp/impl-register-debug"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# esp32c6-lp-hal | ||
|
||
[![Crates.io](https://img.shields.io/crates/v/esp32c6-lp-hal?labelColor=1C2C2E&color=C96329&logo=Rust&style=flat-square)](https://crates.io/crates/esp32c6-lp-hal) | ||
[![docs.rs](https://img.shields.io/docsrs/esp32c6-lp-hal?labelColor=1C2C2E&color=C96329&logo=rust&style=flat-square)](https://docs.rs/esp32c6-lp-hal) | ||
![Crates.io](https://img.shields.io/crates/l/esp32c6-lp-hal?labelColor=1C2C2E&style=flat-square) | ||
[![Matrix](https://img.shields.io/matrix/esp-rs:matrix.org?label=join%20matrix&labelColor=1C2C2E&color=BEC5C9&logo=matrix&style=flat-square)](https://matrix.to/#/#esp-rs:matrix.org) | ||
|
||
`no_std` HAL for the ESP32-C6 from Espressif's low-power coprocessor. Implements a number of the traits defined by [embedded-hal](https://github.com/rust-embedded/embedded-hal). | ||
|
||
This device uses the RISC-V ISA, which is officially supported by the Rust compiler via the `riscv32imac-unknown-none-elf` target. Refer to the [Getting Started](#getting-started) section below for more information. | ||
|
||
## [Documentation] | ||
|
||
[documentation]: https://docs.rs/esp32c6-lp-hal/ | ||
|
||
## Getting Started | ||
|
||
### Installing the Rust Compiler Target | ||
|
||
The compilation target for this device is officially supported via the `stable` release channel and can be installed via [rustup](https://rustup.rs/): | ||
|
||
```shell | ||
$ rustup target add riscv32imac-unknown-none-elf | ||
``` | ||
|
||
## License | ||
|
||
Licensed under either of: | ||
|
||
- Apache License, Version 2.0 ([LICENSE-APACHE](../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | ||
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or http://opensource.org/licenses/MIT) | ||
|
||
at your option. | ||
|
||
### Contribution | ||
|
||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in | ||
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without | ||
any additional terms or conditions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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("link.x")) | ||
.unwrap() | ||
.write_all(include_bytes!("ld/link.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=ld/memory.x"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
ENTRY(reset_vector) | ||
|
||
CONFIG_ULP_COPROC_RESERVE_MEM = 1024 * 16; | ||
CONFIG_ULP_SHARED_MEM = 0; | ||
|
||
MEMORY | ||
{ | ||
/*first 128byte for exception/interrupt vectors*/ | ||
vector_table(RX) : ORIGIN = 0x50000000, LENGTH = 0x80 | ||
ram(RWX) : ORIGIN = 0x50000080, LENGTH = CONFIG_ULP_COPROC_RESERVE_MEM - 0x80 - CONFIG_ULP_SHARED_MEM | ||
} | ||
|
||
SECTIONS | ||
{ | ||
.vector.text : | ||
{ | ||
/*exception/interrupt vectors*/ | ||
__mtvec_base = .; | ||
KEEP (*(.init.vector)) | ||
__mtvec_end = .; | ||
} > vector_table | ||
|
||
. = ORIGIN(ram); | ||
|
||
.text ALIGN(4): | ||
{ | ||
*(.text.vectors) /* Default reset vector must link to offset 0x80 */ | ||
|
||
KEEP(*(.init)); | ||
KEEP(*(.init.rust)); | ||
*(.text) | ||
*(.text*) | ||
} > ram | ||
|
||
.rodata ALIGN(4): | ||
{ | ||
*(.rodata) | ||
*(.rodata*) | ||
} > ram | ||
|
||
.data ALIGN(4): | ||
{ | ||
*(.data) | ||
*(.data*) | ||
*(.sdata) | ||
*(.sdata*) | ||
} > ram | ||
|
||
.bss ALIGN(4) : | ||
{ | ||
*(.bss) | ||
*(.bss*) | ||
*(.sbss) | ||
*(.sbss*) | ||
PROVIDE(end = .); | ||
} > ram | ||
|
||
__stack_top = ORIGIN(ram) + LENGTH(ram); | ||
} |
Oops, something went wrong.