Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:

typos:
name: Check for typos
runs-on: ubuntu-latest
Expand All @@ -33,8 +32,8 @@ jobs:
- uses: actions/checkout@v6
- uses: DavidAnson/markdownlint-cli2-action@v22
with:
globs: '**/*.md,#CHANGELOG.md'
separator: ','
globs: "**/*.md,#CHANGELOG.md"
separator: ","

fmt:
name: Run fmt
Expand Down Expand Up @@ -70,6 +69,11 @@ jobs:
dir: examples/esp32-std-demo
target: xtensa-esp32-espidf
setup_xtensa: true
# no-std demo
- name: esp32-no-std-demo
dir: examples/esp32-no-std-demo
target: ""
setup_xtensa: true
# EPD Waveshare demo
- name: epd-waveshare-demo
dir: examples/epd-waveshare-demo
Expand Down
118 changes: 109 additions & 9 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions examples/esp32-no-std-demo/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[target.xtensa-esp32-none-elf]
runner = "espflash flash --monitor --chip esp32"

[env]
ESP_LOG = "trace"

[build]
target = "xtensa-esp32-none-elf"
rustflags = ["-C", "link-arg=-nostartfiles"]

[unstable]
build-std = ["alloc", "core"]
1 change: 1 addition & 0 deletions examples/esp32-no-std-demo/.clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stack-size-threshold = 8192
34 changes: 34 additions & 0 deletions examples/esp32-no-std-demo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "esp32-no-std-demo"
version = "0.1.0"
edition = "2024"
publish = false

[[bin]]
name = "esp32-no-std-demo"
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors

# Commented out due to workspace profiles being used
# Feel free to uncomment and adjust if you have copied this outside of a workspace
#
# [profile.release]
# opt-level = 3
#
# [profile.dev]
# Symbols are nice and they don't increase the size on Flash
# debug = true
# opt-level = 3

[dependencies]
esp-hal = { version = "~1.0", features = ["esp32", "log-04", "unstable"] }
esp-bootloader-esp-idf = { version = "0.4.0", features = ["esp32", "log-04"] }
esp-alloc = "0.9.0"
esp-println = { version = "0.16.1", features = ["esp32", "log-04"] }
embedded-hal-bus = "0.3.0"
mipidsi = "0.9.0"
critical-section = "1.2.0"
mousefood = { path = "../../mousefood/" }
ratatui = { workspace = true, default-features = false, features = ["all-widgets"] }
log = "0.4.27"
time = { version = "0.3.45", default-features = false }
libm = "0.2.16"
70 changes: 70 additions & 0 deletions examples/esp32-no-std-demo/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
fn main() {
linker_be_nice();
// make sure linkall.x is the last linker script (otherwise might cause problems with flip-link)
println!("cargo:rustc-link-arg=-Tlinkall.x");
}

fn linker_be_nice() {
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
let kind = &args[1];
let what = &args[2];

match kind.as_str() {
"undefined-symbol" => match what.as_str() {
what if what.starts_with("_defmt_") => {
eprintln!();
eprintln!(
"💡 `defmt` not found - make sure `defmt.x` is added as a linker script and you have included `use defmt_rtt as _;`"
);
eprintln!();
}
"_stack_start" => {
eprintln!();
eprintln!("💡 Is the linker script `linkall.x` missing?");
eprintln!();
}
what if what.starts_with("esp_rtos_") => {
eprintln!();
eprintln!(
"💡 `esp-radio` has no scheduler enabled. Make sure you have initialized `esp-rtos` or provided an external scheduler."
);
eprintln!();
}
"embedded_test_linker_file_not_added_to_rustflags" => {
eprintln!();
eprintln!(
"💡 `embedded-test` not found - make sure `embedded-test.x` is added as a linker script for tests"
);
eprintln!();
}
"free"
| "malloc"
| "calloc"
| "get_free_internal_heap_size"
| "malloc_internal"
| "realloc_internal"
| "calloc_internal"
| "free_internal" => {
eprintln!();
eprintln!(
"💡 Did you forget the `esp-alloc` dependency or didn't enable the `compat` feature on it?"
);
eprintln!();
}
_ => (),
},
// we don't have anything helpful for "missing-lib" yet
_ => {
std::process::exit(1);
}
}

std::process::exit(0);
}

println!(
"cargo:rustc-link-arg=-Wl,--error-handling-script={}",
std::env::current_exe().unwrap().display()
);
}
2 changes: 2 additions & 0 deletions examples/esp32-no-std-demo/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "esp"
Loading