Skip to content

Commit

Permalink
initial esp32 support
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Feb 27, 2024
1 parent 9b3cd5e commit 0d8f86a
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 60 deletions.
74 changes: 43 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ embassy-time = { version = "0.3", default-features = false }
embassy-usb = { version = "0.1", default-features = false }
embassy-net-driver-channel = { version = "0.2.0", default-features = false }

esp-hal = { version = "0.15", git = "https://github.com/kaspar030/esp-hal", default-features = false }
esp32c3-hal = { version = "0.15", git = "https://github.com/kaspar030/esp-hal", default-features = false }
esp-hal = { version = "0.15", git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-250224", default-features = false }
esp32c3-hal = { version = "0.15", git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-250224", default-features = false }
esp-println = { version = "0.9.0" }

linkme = { version = "0.3.21", features = ["used_linker"] }

Expand Down
30 changes: 20 additions & 10 deletions laze-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ contexts:
env:
RUSTFLAGS:
- "-Clink-arg=--nmagic"
- "-Clink-arg=-Tlinkme.x"
- "-Clink-arg=-Tlink.x"
- "-Clink-arg=-Tdevice.x"
- "-Clink-arg=${LINK_ARG_PREFIX}--no-eh-frame-hdr"
- --cfg builder=\"${builder}\"
FEATURES:
Expand Down Expand Up @@ -159,6 +156,8 @@ contexts:
env:
OBJCOPY: arm-none-eabi-objcopy
RUSTFLAGS:
- -Clink-arg=-Tlink.x
- -Clink-arg=-Tdevice.x
- -Clink-arg=-Tisr_stack.x
- --cfg context=\"cortex-m\"

Expand All @@ -176,7 +175,8 @@ contexts:
RUSTC_TARGET: thumbv7em-none-eabi
CARGO_TARGET_PREFIX: CARGO_TARGET_THUMBV7EM_NONE_EABI
RUSTFLAGS:
- "-Ctarget-cpu=cortex-m4"
- -Clink-arg=-Tlinkme.x
- -Ctarget-cpu=cortex-m4
- --cfg armv7m

- name: thumbv7m-none-eabi
Expand Down Expand Up @@ -259,15 +259,24 @@ contexts:

- name: esp
parent: riot-rs
selects:
- build_std
env:
RUSTC_TARGET: riscv32imc-unknown-none-elf
CARGO_TARGET_PREFIX: CARGO_TARGET_RISCV32IMC_UNKNOWN_NONE_ELF
CARGO_RUNNER: '"espflash flash --monitor"'
RUSTFLAGS:
- --cfg context=\"esp\"
# linkall first
- -Clink-arg=-Tlinkall.x
- -Clink-arg=-Tlinkme-esp-fixup.x
- -Clink-arg=-Tlinkme.x
# this is needed for backtraces
#- -C force-frame-pointers
CARGO_ARGS:
- -Zbuild-std=core
CARGO_RUNNER: '"espflash flash --monitor"'

- name: esp32c3
parent: esp
env:
RUSTC_TARGET: riscv32imc-unknown-none-elf
CARGO_TARGET_PREFIX: CARGO_TARGET_RISCV32IMC_UNKNOWN_NONE_ELF

modules:
- name: release
Expand Down Expand Up @@ -431,6 +440,7 @@ builders:
- rustup target add thumbv7m-none-eabi
- rustup target add thumbv7em-none-eabi
- rustup target add thumbv7em-none-eabihf
- rustup target add riscv32imc-unknown-none-elf

install-c2rust:
build: false
Expand Down Expand Up @@ -505,7 +515,7 @@ builders:
BOARD: rpi-pico-w

- name: ai-c3
parent: esp
parent: esp32c3

apps:
# define a dummy host application so the host tasks work
Expand Down
5 changes: 4 additions & 1 deletion src/riot-rs-boards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
use cfg_if::cfg_if;

cfg_if! {
if #[cfg(feature = "nrf52dk")] {
if #[cfg(feature = "ai-c3")] {
pub use ai_c3 as board;
} else if #[cfg(feature = "nrf52dk")] {
pub use nrf52dk as board;
} else if #[cfg(feature = "dwm1001")] {
pub use dwm1001 as board;
Expand Down Expand Up @@ -35,5 +37,6 @@ use riot_rs_rt::INIT_FUNCS;

#[distributed_slice(INIT_FUNCS)]
fn init() {
riot_rs_rt::debug::println!("riot-rs-boards::init()");
board::init();
}
3 changes: 3 additions & 0 deletions src/riot-rs-embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ embassy-rp = { workspace = true, features = [
# "unstable-traits",
] }

[target.'cfg(context = "esp")'.dependencies]
esp32c3-hal = { workspace = true, features = [ "embassy", "embassy-executor-interrupt", "embassy-time-systick" ] }

[features]
time = ["dep:embassy-time", "embassy-executor/integrated-timers"]
usb = [ "dep:embassy-usb" ]
Expand Down
Loading

0 comments on commit 0d8f86a

Please sign in to comment.