Skip to content

Commit

Permalink
use ESP-BSP-RS for ESP32-C6-DevKit
Browse files Browse the repository at this point in the history
  • Loading branch information
georgik committed Dec 18, 2024
1 parent 80460bd commit 2076a05
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 293 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-esp32-c6-rust.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Continuous Integration for ESP32-C6

on:
push:
paths:
- "esp32-c6-devkit/**"
- "spooky-core/**"
- "spooky-embedded/**"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
rust-checks:
name: Rust Checks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [ "esp32-c6-devkit" ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust (Xtensa)
uses: esp-rs/xtensa-toolchain@v1.5
with:
default: true
buildtargets: esp32c6
ldproxy: false

- name: Enable caching
uses: Swatinem/rust-cache@v2

- name: Run checks sequentially within each job
run: |
cd ${{ matrix.project }}
# Format check
cargo fmt --all -- --check --color always
# Clippy linting (with release mode if desired)
cargo clippy --release --all-features --workspace -- -D warnings
# Build (Release)
cargo build --release
161 changes: 0 additions & 161 deletions .github/workflows/build-esp32-rust.yaml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/build-esp32-s3-rust.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Continuous Integration for ESP32-S3

on:
push:
paths:
- "esp32-s3-box/**"
- "esp32-s3-box-3/**"
- "m5stack-cores3/**"
- "spooky-core/**"
- "spooky-embedded/**"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
rust-checks:
name: Rust Checks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [ "esp32-s3-box", "esp32-s3-box-3", "m5stack-cores3" ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust (Xtensa)
uses: esp-rs/xtensa-toolchain@v1.5
with:
default: true
buildtargets: esp32s3
ldproxy: false

- name: Enable caching
uses: Swatinem/rust-cache@v2

- name: Run checks sequentially within each job
run: |
cd ${{ matrix.project }}
# Format check
cargo fmt --all -- --check --color always
# Clippy linting (with release mode if desired)
cargo clippy --release --all-features --workspace -- -D warnings
# Build (Release)
cargo build --release
13 changes: 6 additions & 7 deletions esp32-c6-devkit/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
[target.riscv32imac-unknown-none-elf]
runner = "espflash flash --monitor"

[env]
ESP_LOG="INFO"

[build]
rustflags = [
"-C", "link-arg=-Tlinkall.x",
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
# NOTE: May negatively impact performance of produced code
"-C", "force-frame-pointers",
]

[env]
# Use clean build after changing ESP_LOGLEVEL
ESP_LOGLEVEL="DEBUG"

[build]
target = "riscv32imac-unknown-none-elf"

[unstable]
build-std = [ "core", "alloc" ]
build-std = ["core"]
58 changes: 36 additions & 22 deletions esp32-c6-devkit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
[package]
name = "spooky-esp32-c6"
version = "0.10.0"
version = "0.11.0"
authors = ["Juraj Michálek <juraj.michalek@gmail.com>"]
edition = "2021"
license = "MIT"

[target.riscv32imac-unknown-none-elf.dependencies]
hal = { package = "esp32c6-hal", version = "0.7.0" }
esp-backtrace = { version = "0.9.0", features = ["esp32c6", "panic-handler", "exception-handler", "print-uart"] }
esp-println = { version = "0.7.0", features = [ "esp32c6", "log" ] }

[dependencies]
esp-alloc = "0.3.0"
embedded-graphics = "0.8.0"
embedded-hal = "0.2"
display-interface = "0.4"
display-interface-spi = "0.4"
log = { version = "0.4.18" }
mipidsi = "0.7.1"
panic-halt = "0.2"
rand = { version = "0.8.5", default-features = false }
rand_chacha = { version = "0.3.1", default-features = false }
petgraph = { git = "https://github.com/zendurix/petgraph.git", branch = "better_no_std", default-features = false, features = [
"graphmap",
esp-backtrace = { version = "0.14.2", features = [
"esp32c6",
"exception-handler",
"panic-handler",
"println",
]}

esp-hal = { version = "0.22.0", features = [
"esp32c6",
] }
shared-bus = { version = "0.3.0" }
spooky-core = { path = "../spooky-core", default-features = false, features = [ "static_maze"]}
spooky-embedded = { path = "../spooky-embedded", default-features = false, features = [ "esp32c6", "static_maze", "resolution_320x240" ] }
spi-dma-displayinterface = { path = "../spi-dma-displayinterface", features = [ "esp32c6" ] }
esp-println = { version = "0.12.0", features = ["esp32c6", "log"] }
log = { version = "0.4.21" }
critical-section = "1.2.0"

esp-alloc = "0.5.0"
embedded-graphics = "0.8.0"
embedded-hal = "1.0.0"
mipidsi = "0.8.0"
spooky-core = { path = "../spooky-core", default-features = false, features = [ "static_maze"] }
spooky-embedded = { path = "../spooky-embedded", default-features = false, features = [ "static_maze", "resolution_320x240" ] }
esp-display-interface-spi-dma = "0.2.0"
esp-bsp = { path = "../../esp-bsp-rs", features = [ "esp32c6devkitc1" ] }

[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
3 changes: 3 additions & 0 deletions esp32-c6-devkit/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("cargo:rustc-link-arg-bins=-Tlinkall.x");
}
7 changes: 3 additions & 4 deletions esp32-c6-devkit/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[toolchain]
channel = "nightly"
components = ["rustfmt", "rustc-dev"]
# targets = ["xtensa-esp32s3-none-elf"]
# targets = ["xtensa-esp32-none-elf", "xtensa-esp32s2-none-elf","xtensa-esp32s3-none-elf"]
channel = "stable"
components = ["rust-src"]
targets = ["riscv32imac-unknown-none-elf"]
Loading

0 comments on commit 2076a05

Please sign in to comment.