Git Product home page Git Product logo

esp-template's People

Contributors

armandas avatar bjoernq avatar dependabot[bot] avatar eloycoto avatar har7an avatar hlf20010508 avatar jessebraham avatar linusu avatar mabezdev avatar mnlphlp avatar nereuxofficial avatar ozzieorca avatar sergiogasquez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp-template's Issues

cant build s3 template project

I have generated a esp32 project with the esp32s3 model.

peter:/media/peter/data/code$ cargo generate esp-rs/esp-template ⚠️ Favoriteesp-rs/esp-templatenot found in config, using it as a git repository: https://github.com/esp-rs/esp-template.git 🤷 Project Name: esp32s3-rust-test 🔧 Destination: /media/peter/data/code/esp32s3-rust-test ... 🔧 project-name: esp32s3-rust-test ... 🔧 Generating template ... ✔ 🤷 Configure advanced template options? · false ✔ 🤷 Which MCU to target? · esp32s3 🔧 Moving generated files into:/media/peter/data/code/esp32s3-rust-test... Initializing a fresh Git repository ✨ Done! New project created /media/peter/data/code/esp32s3-rust-test

When i try to build it it fails:

peter:/media/peter/data/code/esp32s3-rust-test$ cargo build Updating crates.io index Compiling compiler_builtins v0.1.92 Compiling core v0.0.0 (/home/peter/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core) Compiling proc-macro2 v1.0.66 Compiling unicode-ident v1.0.11 Compiling syn v1.0.109 Compiling serde v1.0.183 Compiling memchr v2.5.0 Compiling rustversion v1.0.14 Compiling serde_derive v1.0.183 Compiling heck v0.4.1 Compiling version_check v0.9.4 Compiling autocfg v1.1.0 Compiling anyhow v1.0.72 Compiling quote v1.0.32 Compiling aho-corasick v1.0.2 Compiling regex-syntax v0.7.4 Compiling lock_api v0.4.10 Compiling xtensa-lx v0.8.0 Compiling syn v2.0.28 Compiling proc-macro-error-attr v1.0.4 Compiling strsim v0.10.0 Compiling fnv v1.0.7 Compiling hashbrown v0.14.0 Compiling strum v0.24.1 Compiling ident_case v1.0.1 Compiling equivalent v1.0.1 Compiling proc-macro-error v1.0.4 Compiling indexmap v2.0.0 Compiling toml_datetime v0.6.3 Compiling regex-automata v0.3.6 Compiling winnow v0.5.4 Compiling minijinja v0.15.0 Compiling basic-toml v0.1.4 Compiling regex v1.9.3 Compiling darling_core v0.20.3 Compiling toml_edit v0.19.14 Compiling paste v1.0.14 Compiling esp-synopsys-usb-otg v0.3.2 Compiling log v0.4.18 Compiling esp32s3 v0.19.0 Compiling once_cell v1.18.0 Compiling proc-macro-crate v1.3.1 error[E0463]: can't find crate for unicode_identwhichproc_macro2` depends on
--> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/lib.rs:495:5
|
495 | pub extern crate proc_macro2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for proc_macro2
--> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/lib.rs:497:9
|
497 | use proc_macro2::Span;
| ^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for proc_macro2
--> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/lib.rs:286:5
|
286 | use proc_macro2::Span;
| ^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for quote
--> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/lib.rs:287:5
|
287 | use quote::{quote, ToTokens};
| ^^^^^ can't find crate

error[E0463]: can't find crate for proc_macro2
--> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/dummy.rs:116:5
|
116 | use proc_macro2::TokenStream;
| ^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for proc_macro2
--> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/diagnostic.rs:2:5
|
2 | use proc_macro2::Span;
| ^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for proc_macro2
--> /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/diagnostic.rs:3:5
|
3 | use proc_macro2::TokenStream;
| ^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for quote
`

It works fine if I try to generate and build for the C3 model

rust-analyzer errors in VSCode with blank project

Hi there,
When generating a project I'm getting the following errors in VSCode from rust-analyzer:
image
I couldn't find a solution to make them go away, is this supposed to be the case or am I missing something there?

I installed the toolchain via espup and also tried a bunch of settings in .vscode/settings.json, like:

{
    "rust-analyzer.server.extraEnv": { "RUSTUP_TOOLCHAIN": "esp"},
    "rust-analyzer.cargo.target": "xtensa-esp32-none-elf",
    "rust-analyzer.checkOnSave": false,
    "rust-analyzer.check.allTargets": false,
    "rust-analyzer.check.overrideCommand": [
        "cargo",
        "clippy",
        "--message-format=json",
        "--bins",
        "--all-features",
        "--target",
        "xtensa-esp32-none-elf",
    ],
    "rust-analyzer.check.targets": "xtensa-esp32-none-elf",
}

Meaning behind esp-template question "Use template default values" is not obvious.

Current questions: Use template default values? true/false

The question not provide insight into what is the user selecting.

Recommended change: Use minimalist project profile? yes/no
In case of no, continue with configuration options.

Why is the "default" question not good? Because "default" can mean something else to different people. Default in my case would mean full-blown project with all the bells and whistles, so that I can easily integrate it with all the things used by app developers including CI with containers, Simulation and Debugging.

Cannot run `cargo test` using fresh template

Hi,

This may be self-evident, and if it is I apologise. It appears that one cannot use cargo test using a fresh cargo generated project based on this template:

$ cargo generate --git https://github.com/esp-rs/esp-template
[...]
🔧   Generating template ...
✔ 🤷   Enable allocations via the esp-alloc crate? · true
✔ 🤷   Which MCU to target? · esp32
✔ 🤷   Configure project to use Dev Containers (VS Code, GitHub Codespaces and Gitpod)? · false
[...]
$ cd foo
$ cargo test
[...]
   Compiling foo v0.1.0 (/Users/slau/src/unticks/foo)
error[E0463]: can't find crate for `test`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `foo` due to previous error

Not sure if this is expected, intended, or unfixable.

Feature request: include CI files

I've started a project based on generating from this template, and setting up CI would be made easier if the generated files included some CI. This is what I've put together for my project:

name: check

on:
  pull_request:
    branches:
      - main


jobs:
  lint:
    name: Lint
    runs-on: ubuntu-22.04
    env:
      CARGO_TERM_COLOR: always

    steps:
      - uses: actions/checkout@v3
      - uses: esp-rs/[email protected]
      - uses: Swatinem/rust-cache@v2

      - name: check rustfmt
        run: cargo fmt -- --check --color always

      - name: clippy
        run: cargo clippy -- -D warnings

the steps were partially based on the CI files for this repo.

If there's a way to bring in the right toolchain in a way that is nice and quick, and only sets things up for the appropriate platform (I'm using S3, but I notice work is being done to setup for non S3 platforms), that would probably be ideal.

Issues with ESP32S2

Hi,
I'm trying to build a library (no_std) for the ESP32-S2 (thus no IC crates needed, just architecture needed) using:
cargo +esp build --target esp32s2-none-elf --release

However, I get the following mistake.. How can I avoid it:

error[E0463]: can't find crate for `core`
  |
  = note: the `xtensa-esp32s2-none-elf` target may not be installed
  = help: consider downloading the target with `rustup target add xtensa-esp32s2-none-elf`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

[Windows]: Cannot open linker script file linkall.x due to umlauts in project path

Dear all,

I'm trying to build a hello world project derived from this template on Windows 10 in a MSVC environment.
It was set up the following way:

  1. Install rustup-msvc via scoop
  2. Install microsoft command line compiler (like the scoop package suggested)
  3. Install nightly rust via rustup
  4. Install espup and cargo-generate via cargo
  5. Run espup install according to documentation

After that I generated the project for esp32 via this git repo

cargo build compiles everything but linking fails with:

rustc linker call Running `C:\Users\Olaf\scoop\persist\rustup-msvc\.rustup\toolchains\esp\bin\rustc.exe --crate-name esp32_test --edition=2021 src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=119 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=80f34878350df424 -C extra-filename=-80f34878350df424 --out-dir C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps --target xtensa-esp32-none-elf -C incremental=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\incremental -L dependency=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps -L dependency=C:\Users\Olaf\src\esp32-test\target\debug\deps --extern noprelude:alloc=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\liballoc-b83b4f40532317de.rlib --extern noprelude:compiler_builtins=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libcompiler_builtins-a6abaaf812b88ac3.rlib --extern noprelude:core=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libcore-20cc3db7174822c3.rlib --extern embedded_io=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libembedded_io-a11d11f01d50d33e.rlib --extern embedded_svc=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libembedded_svc-638243c65551179d.rlib --extern esp_alloc=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_alloc-7a18a8bc1e9c1a16.rlib --extern esp_backtrace=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_backtrace-ad8b19c56c9384b2.rlib --extern esp_println=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_println-e2b09142032fb05f.rlib --extern esp_wifi=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_wifi-59cc4053dbb9d2cc.rlib --extern hal=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp32_hal-bb25ebe35e864c4e.rlib --extern heapless=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libheapless-fbbf0ee7ccf78ebd.rlib --extern log=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\liblog-7afd8e7f1ada38de.rlib --extern smoltcp=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libsmoltcp-5337ec9fc4f58151.rlib -Z unstable-options -C link-arg=-Tlinkall.x -C link-arg=-Trom_functions.x -C link-arg=-nostartfiles -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp-wifi-sys-8b20ad09368be88d\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp32-hal-c193d42e30ee7e61\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp-hal-common-0291b71a3c0a8705\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp32-8425ed446dd1dfa3\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\xtensa-lx-833d551610d3c712\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\xtensa-lx-rt-fad6f9f2fe77c11b\out`
Even longer linker command line "xtensa-esp32-elf-gcc" "C:\\Users\\Olaf\\AppData\\Local\\Temp\\rustcy77nHW\\symbols.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.18tft40bkky3iiop.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1fgztwd7z7jcd4lr.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1fqaim87q0kcvj7s.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1nigjorlzph3r68y.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1penbsf3b7kqg1pc.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.21o0qworany5ct1f.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.24gk3itw4xg74r3u.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.2q6d0ky4c2i5orx1.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.38zelovied0ywvl1.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.39dm23rbfuqmtf7r.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3f9vhxgm8ev4omgq.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3ptdszurxm48lj40.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3qyxlqnu8z3pxf4n.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3ti4n95b2qmwz11d.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3tuea10dal372xyo.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.4ba05rh2g7jfroe3.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.4szdyytrqp4db85e.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.4wgebc7bzz9qqh9q.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.clyqcs93aridhmz.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.eymduzyo3x0vuha.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.92mwa8moj4bd976.rcgu.o" "-Wl,--as-needed" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\debug\\deps" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp-wifi-sys-8b20ad09368be88d\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp32-hal-c193d42e30ee7e61\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp-hal-common-0291b71a3c0a8705\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp32-8425ed446dd1dfa3\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\xtensa-lx-833d551610d3c712\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\xtensa-lx-rt-fad6f9f2fe77c11b\\out" "-L" "C:\\Users\\Olaf\\scoop\\persist\\rustup-msvc\\.rustup\\toolchains\\esp\\lib\\rustlib\\xtensa-esp32-none-elf\\lib" "-Wl,-Bstatic" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_alloc-7a18a8bc1e9c1a16.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_wifi-59cc4053dbb9d2cc.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblibm-f412bec360b75524.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_io-a11d11f01d50d33e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libsmoltcp-5337ec9fc4f58151.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbitflags-66545340898b2d28.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libmanaged-dc60188699462cce.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_svc-21c8b1364dba3891.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libserde-4145623200dd1b1c.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libno_std_net-83ae1e246a640dac.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libnum_traits-1f9e676721e6f32c.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libenumset-b49843d5d6158ccb.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libatomic_polyfill-fa4e9b7df58a1ce0.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libheapless-fbbf0ee7ccf78ebd.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libhash32-d6b6dbbc5b01d8d8.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbyteorder-3661cda5f6a44287.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_wifi_sys-7a9cb2427d51760e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblinked_list_allocator-e93d1b24a44fd233.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp32_hal-bb25ebe35e864c4e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_hal_common-5c15ec5f8e1eb5d6.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_io-4f6b867de79caaa6.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbitfield-990d0c2feb7c831a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbitflags-1b410470f2224139.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcfg_if-0fd6a78eafaec43f.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp32-782f40482039ea4e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libvcell-43d36fccaf7fce4b.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libstrum-83eaea363fd9d9a7.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_dma-75f15787eb784440.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libstable_deref_trait-fce22da1ffb4221b.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libfugit-364d17a013a80da8.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libgcd-246ec4dd56afd450.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_hal-65a9dc812ffdb2a9.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libvoid-ff355308b5083ba0.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libnb-afce8c51d908ad8f.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libnb-d89384f43eeb6de9.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libxtensa_lx_rt-d143951759fd978a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libr0-555c4527a92e0245.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libxtensa_lx-a7e54df6f2b1e2e8.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libspin-45bb07b6a0bf98ee.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblock_api-3124799a0c2bccdd.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libscopeguard-a8613ba8f311444a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libmutex_trait-8c3d9a55f00eb843.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbare_metal-efa2b4ae0af6b56a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_backtrace-ad8b19c56c9384b2.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_println-e2b09142032fb05f.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcritical_section-15cfe0f4c5987ae5.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblog-7afd8e7f1ada38de.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liballoc-b83b4f40532317de.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\librustc_std_workspace_core-d5887c39b006917b.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcore-20cc3db7174822c3.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcompiler_builtins-a6abaaf812b88ac3.rlib" "-Wl,-Bdynamic" "-lbtdm_app" "-lcoexist" "-lcore" "-lespnow" "-lmesh" "-lnet80211" "-lphy" "-lpp" "-lrtc" "-lsmartconfig" "-lwapi" "-lwpa_supplicant" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "C:\\Users\\Olaf\\scoop\\persist\\rustup-msvc\\.rustup\\toolchains\\esp\\lib\\rustlib\\xtensa-esp32-none-elf\\lib" "-o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "-Tlinkall.x" "-Trom_functions.x" "-nostartfiles"
C:\Users\Olaf\scoop\persist\rustup-msvc\.rustup\toolchains\esp\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin/xtensa-esp-elf-ld.exe: 
          cannot open linker script file linkall.x: No such file or directory
          collect2.exe: error: ld returned 1 exit status

EDIT: It would appear that there is a linkall.x in cargo's crate registry below esp32-hal-0.16.0/ld/.
But that folder is not among the linker search directories.

Any idea what might be wrong here or any pointers how to debug this?

Thanks a lot,
Olaf

Help - erro on generate template

Hi, I'm trying to use cargo generate, but it throw this error:

cargo generate https://github.com/esp-rs/esp-template          
error: Found argument 'https://github.com/esp-rs/esp-template' which wasn't expected, or isn't valid in this context

USAGE:
    cargo generate [FLAGS] [OPTIONS] --git <git>

For more information try --help

when I use --git:

cargo generate --git=https://github.com/esp-rs/esp-template
 Project Name: test-esp8266
 Creating project called `test-esp8266`...
Error:  Git Error: failed to clone into: /home/samuel/Downloads/test-esp8266IXEFXF

Have I did something wrong ?

why there is no esp8266 template ?

The README should be improved

We should briefly describe each prompt, its options, and why you may or may not want to use any given feature.

@SergioGasquez maybe if you had some time (this is low priority) you could look into this? If not I can do it at some point. If you're interested please just assign yourself to the issue!

Avoid running docker checks when not necessary

The CI is pretty slow and there is no benefit from running the docker-checks for PRs. One possible solution would be to move it to a separate yaml file and run the docker-checks only for PRs/push that modify anything related to containers or in scheduled runs.

Using env var in .cargo/config.toml

Hi, any way I can use env var in config.toml?

linker = "/home/ci/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc"

and I have export CROSS_CIMPILE=/home/ci/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-

I tryied linker = "${CROSS_COMPILE}gcc" but didn't work? Any adea about how to fix it?

Lack of auto completion, proc macro expansion, etc

I had my hands on a ESP32-Pico-Kit lately. I wanted to develop no_std apps on it. I am using Visual Studio Code with the rust-analyzer extension.

Firstly, auto completion is basically unusable. For example, peripherals.DPORT.split(), I would get nothing after I typed peripherals.DPORT. and hovering also doesn't show anything. I was wondering if it has anything to do with proc macro expansion (see below).

Secondly, rust-analyzer also pops an error stating that the #[entry] macro cannot be expanded. At first, it is rust-analyzer-proc-macro-srv not found, so I compiled one myself using esp-rs's toolchain (to eliminate any issues caused by incompatible toolchain versions). Then it show unsupported ABI: ..., I then "solved" it by compiling proc-macro-srv-cli with the sysroot-abi feature enabled (although I'm not so sure if this is really the solution). However, I notice that recent Rust toolchains ship with a rust-analyzer-proc-macro-srv to solve the ABI issue when the rust-analyzer client itself is not built under the same version of toolchain, maybe I should file an issue over esp-rs/rust?

Even after there is no errors or whatsoever, auto completion and most language features are basically unusable.

I want to know if this is a common experience or not. I tried my best to solve it myself but I am basically stuck now...

"error: linker `xtensa-esp32-elf-gcc` not found" when trying to build for esp32 after following installation instructions from rust on ESP book

After following the instructions for setting up the environment, I created a new project from this template.
Without modifying anything, I got the following error:``
error: linker xtensa-esp32-elf-gcc not found
|
= note: No such file or directory (os error 2)

error: could not compile no_std_project_template (bin "no_std_project_template") due to previous error``
I am trying to build this for the Adafruit ESP32 Feather which uses a 240 MHz dual core Tensilica LX6 microcontroller with 600 DMIPS.
Which according to cargo espflash board-info is an "esp32 (revision v3.0)".
How could I fix this?
There is an Arch package for the required linker, but I want to make sure it won't come with a future update with espup.

bug: cargo generate fails: Runtime error: System command `cargo fmt` returned non-zero status: exit status: 1

I tried to generate a new project according to the README but it fails:

$ cargo generate -a esp-rs/esp-template
⚠️   Favorite `esp-rs/esp-template` not found in config, using it as a git repository: https://github.com/esp-rs/esp-template.git
🤷   Project Name: no_std_test
⚠️   Renaming project called `no_std_test` to `no-std-test`...
🔧   Destination: /home/user/no-std-test ...
🔧   project-name: no-std-test ...
🔧   Generating template ...
✔ 🤷   Which MCU to target? · esp32
✔ 🤷   Enable allocations via the esp-alloc crate? · true
✔ 🤷   Configure project to use Dev Containers (VS Code, GitHub Codespaces and Gitpod)? · true
[ 1/27]   Done: .cargo/config.toml                                                                                                                                
[ 2/27]   Done: .cargo                                                                                                                                            
[ 3/27]   Done: .devcontainer/Dockerfile                                                                                                                          
[ 4/27]   Done: .devcontainer/devcontainer.json                                                                                                                   
[ 5/27]   Done: .devcontainer                                                                                                                                     
[ 6/27]   Done: .dockerignore                                                                                                                                     
[ 7/27]   Done: .gitignore                                                                                                                                        
[ 8/27]   Done: .gitpod.Dockerfile                                                                                                                                
[ 9/27]   Done: .gitpod.yml                                                                                                                                       
[10/27]   Done: .vscode/launch.json                                                                                                                               
[11/27]   Done: .vscode/settings.json                                                                                                                             
[12/27]   Done: .vscode/tasks.json                                                                                                                                
[13/27]   Done: .vscode                                                                                                                                           
[14/27]   Done: Cargo.toml                                                                                                                                        
[15/27]   Done: LICENSE-APACHE                                                                                                                                    
[16/27]   Done: LICENSE-MIT                                                                                                                                       
[17/27]   Done: docs/README.md                                                                                                                                    
[18/27]   Done: docs                                                                                                                                              
[19/27]   Ignored: post-script.rhai                                                                                                                               
[20/27]   Ignored: pre-script.rhai                                                                                                                                
[21/27]   Done: rust-toolchain.toml                                                                                                                               
[22/27]   Done: scripts/build.sh                                                                                                                                  
[23/27]   Done: scripts/flash.sh                                                                                                                                  
[24/27]   Done: scripts/run-wokwi.sh                                                                                                                              
[25/27]   Done: scripts                                                                                                                                           
[26/27]   Done: src/main.rs                                                                                                                                       
[27/27]   Done: src                                                                                                                                               
Error: ⛔   Failed executing script: post-script.rhai

Caused by:
    Runtime error: System command `cargo fmt` returned non-zero status: exit status: 1

Rust version:

$ cargo --version
cargo 1.70.0-nightly (7d3033d2e 2023-03-08)
$ rustc --version
rustc 1.70.0-nightly (7b4f48927 2023-03-12)
$ rustup --version
rustup 1.25.2 (17db695f1 2023-02-01)

fails to boot

When I cargo run this template, it successfully uploads the image but the chip fails to boot up.

~/devel/turingatemyhamster/scratch/cam32-baremetal-blink$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `espflash --monitor target/xtensa-esp32-none-elf/debug/cam32_baremetal_blink`
New version of espflash is available: v2.0.0-rc.3

Serial port: /dev/ttyUSB0
Connecting...

Chip type:         ESP32 (revision 3)
Crystal frequency: 40MHz
Flash size:        4MB
Features:          WiFi, BT, Dual Core, 240MHz, Coding Scheme None
MAC address:       c8:f0:9e:4d:4c:34
App/part. size:    150224/4128768 bytes, 3.64%
[00:00:01] ########################################      16/16      segment 0x1000                                  [00:00:00] ########################################       1/1       segment 0x8000                                  [00:00:05] ########################################      55/55      segment 0x10000                                 
Flashing has completed!
Commands:
    CTRL+R    Reset chip
    CTRL+C    Exit

ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0048,len:12
ho 0 tail 12 room 4
load:0x3fff0054,len:4800
load:0x40078000,len:17448
0x40078000 - ets_delay_us
    at ??:??
load:0x4007c428,len:4840
0x4007c428 - ets_delay_us
    at ??:??
entry 0x4007c6a0
0x4007c6a0 - ets_delay_us
    at ??:??
ets Jul 29 2019 12:21:46
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0048,len:12
ho 0 tail 12 room 4
load:0x3fff0054,len:4800
load:0x40078000,len:17448
0x40078000 - ets_delay_us
    at ??:??
load:0x4007c428,len:4840
0x4007c428 - ets_delay_us
    at ??:??
entry 0x4007c6a0
0x4007c6a0 - ets_delay_us
    at ??:??
<loops for ever>

The esp-idf-template project runs out of the box. The output is below for comparison.

~/devel/turingatemyhamster/scratch/cam32-idf-blink$ cargo run
    Finished dev [optimized + debuginfo] target(s) in 0.12s
     Running `espflash --monitor target/xtensa-esp32-espidf/debug/cam32-idf-blink`
New version of espflash is available: v2.0.0-rc.3

Serial port: /dev/ttyUSB0
Connecting...

Chip type:         ESP32 (revision 3)
Crystal frequency: 40MHz
Flash size:        4MB
Features:          WiFi, BT, Dual Core, 240MHz, Coding Scheme None
MAC address:       c8:f0:9e:4d:4c:34
App/part. size:    449296/4128768 bytes, 10.88%
[00:00:01] ########################################      16/16      segment 0x1000                                  [00:00:00] ########################################       1/1       segment 0x8000                                  [00:00:23] ########################################     228/228     segment 0x10000                                 
Flashing has completed!
Commands:
    CTRL+R    Reset chip
    CTRL+C    Exit

ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0048,len:12
ho 0 tail 12 room 4
load:0x3fff0054,len:4800
load:0x40078000,len:17448
0x40078000 - __udivmoddi4                                                                                           
    at ??:??                                                                                                        
load:0x4007c428,len:4840
0x4007c428 - __udivmoddi4                                                                                           
    at ??:??                                                                                                        
entry 0x4007c6a0
0x4007c6a0 - __udivmoddi4                                                                                           
    at ??:??                                                                                                        
I (227) cpu_start: Pro cpu up.
I (227) cpu_start: Starting app cpu, entry point is 0x40081164
0x40081164 - call_start_cpu1                                                                                        
    at /home/nmrp3/devel/turingatemyhamster/scratch/cam32-idf-blink/.embuild/espressif/esp-idf/release-v4.4/components/esp_system/port/cpu_start.c:148                                                                                  
I (0) cpu_start: App cpu up.
I (241) cpu_start: Pro cpu start user code
I (241) cpu_start: cpu freq: 160000000
I (241) cpu_start: Application information:
I (246) cpu_start: Project name:     libespidf
I (251) cpu_start: App version:      1
I (255) cpu_start: Compile time:     Mar 13 2023 14:24:44
I (261) cpu_start: ELF file SHA256:  0000000000000000...
I (267) cpu_start: ESP-IDF:          fee50c2-dirty
I (273) cpu_start: Min chip rev:     v0.0
I (277) cpu_start: Max chip rev:     v3.99 
I (282) cpu_start: Chip rev:         v3.0
I (287) heap_init: Initializing. RAM available for dynamic allocation:
I (294) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (300) heap_init: At 3FFB23A8 len 0002DC58 (183 KiB): DRAM
I (306) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (313) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (319) heap_init: At 4008AB20 len 000154E0 (85 KiB): IRAM
I (327) spi_flash: detected chip: generic
I (330) spi_flash: flash io: dio
I (335) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Hello, world!

Trouble running ESP32-C6 template

Got my hands on an ESP32-C6 and want to try rust on it. I am able to run the esp-idf examples (hello_world and blink) using idf.py to build and flash: I can see the hello world in my terminal or the del flash.

I'm having trouble running this template though.

I use cargo generate esp-rs/esp-template to generate a bare bone project:

❯ cargo generate esp-rs/esp-template
⚠️   Favorite `esp-rs/esp-template` not found in config, using it as a git repository: https://github.com/esp-rs/esp-template.git
🤷   Project Name: esp32-c6-hello-v5
🔧   Destination: esp32-c6-hello-v5 ...
🔧   project-name: esp32-c6-hello-v5 ...
🔧   Generating template ...
✔ 🤷   Which MCU to target? · esp32c6
✔ 🤷   Configure advanced template options? · true
✔ 🤷   Enable WiFi/Bluetooth/ESP-NOW via the esp-wifi crate? · false
✔ 🤷   Enable allocations via the esp-alloc crate? · false
✔ 🤷   Configure project to use Dev Containers (VS Code and GitHub Codespaces)? · false
✔ 🤷   Configure project to support Wokwi simulation with Wokwi VS Code extension? · false
✔ 🤷   Add CI files for GitHub Action? · false
✔ 🤷   Setup logging using the log crate? · false
🔧   Moving generated files into: `esp32-c6-hello-v5`...
🔧   Initializing a fresh Git repository
✨   Done! New project created esp32-c6-hello-v5

Building and flashing seems to succeed, but the monitoring hangs:

❯ cargo run -vv
[...]
     Running `CARGO=~/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/cargo CARGO_MANIFEST_DIR=~/esp32-c6-hello-v4 CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=esp32-c6-hello-v4 CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' DYLD_FALLBACK_LIBRARY_PATH='~/esp32-c6-hello-v4/target/riscv32imac-unknown-none-elf/debug/build/esp-hal-common-4b0655f184eabea1/out:~/esp32-c6-hello-v4/target/riscv32imac-unknown-none-elf/debug/build/esp-riscv-rt-2022adf018f321c1/out:~/esp32-c6-hello-v4/target/riscv32imac-unknown-none-elf/debug/build/esp32c6-32bf530043214f0b/out:~/esp32-c6-hello-v4/target/riscv32imac-unknown-none-elf/debug/build/esp32c6-hal-03646f514ebc9229/out:~/esp32-c6-hello-v4/target/riscv32imac-unknown-none-elf/debug/deps:~/esp32-c6-hello-v4/target/riscv32imac-unknown-none-elf/debug:~/.rustup/toolchains/nightly-aarch64-apple-darwin/lib:~/lib:/usr/local/lib:/usr/lib' espflash flash --monitor target/riscv32imac-unknown-none-elf/debug/esp32-c6-hello-v4`
[2023-11-08T00:20:25Z INFO ] Detected 8 serial ports
[2023-11-08T00:20:25Z INFO ] Ports which match a known common dev board are highlighted
[2023-11-08T00:20:25Z INFO ] Please select a port
[2023-11-08T00:20:26Z INFO ] Serial port: '/dev/cu.usbmodem101'
[2023-11-08T00:20:26Z INFO ] Connecting...
[2023-11-08T00:20:27Z INFO ] Using flash stub
Chip type:         esp32c6 (revision v0.0)
Crystal frequency: 40MHz
Flash size:        4MB
Features:          WiFi 6, BT 5
MAC address:       40:4c:ca:45:0a:cc
App/part. size:    177,392/4,128,768 bytes, 4.30%
[00:00:00] [========================================]      13/13      0x0
[00:00:00] [========================================]       1/1       0x8000
[00:00:01] [========================================]      70/70      0x10000
[2023-11-08T00:20:28Z INFO ] Flashing has completed!
Commands:
    CTRL+R    Reset chip
    CTRL+C    Exit

ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x15 (USB_UART_HPSYS),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x408007fe
0x408007fe - software_reset_cpu
    at ??:??
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xd48
0x4086c410 - __global_pointer$
    at ??:??
load:0x4086e610,len:0x2d68
0x4086e610 - __global_pointer$
    at ??:??
load:0x40875720,len:0x1800
0x40875720 - __global_pointer$
    at ??:??
SHA-256 comparison failed:
Calculated: aff89878a96cbff57c66c38aa6d1a422b7785040b5efea582babef6c357427c2
Expected: 0af544a033ab3492852b8232c904c578d5f07c9d4a423a64473f060db374ab32
Attempting to boot anyway...
entry 0x4086c410
0x4086c410 - __global_pointer$
    at ??:??
I (41) boot: ESP-IDF v5.1-beta1-378-gea5e0ff298-dirt 2nd stage bootloader
I (42) boot: compile time Jun  7 2023 08:02:08
I (43) boot: chip revision: v0.0
I (46) boot.esp32c6: SPI Speed      : 40MHz
I (51) boot.esp32c6: SPI Mode       : DIO
I (56) boot.esp32c6: SPI Flash Size : 4MB
I (61) boot: Enabling RNG early entropy source...
I (66) boot: Partition Table:
I (70) boot: ## Label            Usage          Type ST Offset   Length
I (77) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (84) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (92) boot:  2 factory          factory app      00 00 00010000 003f0000
I (99) boot: End of partition table
I (103) esp_image: segment 0: paddr=00010020 vaddr=42000020 size=23e80h (147072) map
I (142) esp_image: segment 1: paddr=00033ea8 vaddr=40808000 size=00020h (    32) load
I (143) esp_image: segment 2: paddr=00033ed0 vaddr=42023ed0 size=06598h ( 26008) map
I (153) esp_image: segment 3: paddr=0003a470 vaddr=40808020 size=01058h (  4184) load
I (157) boot: Loaded app from partition at offset 0x10000
I (162) boot: Disabling RNG early entropy source...

There's no output after the last line, no hello world :(

The expanded template result in:

#![no_std]
#![no_main]

use esp_backtrace as _;
use esp_println::println;
use hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay};

#[entry]
fn main() -> ! {
    let peripherals = Peripherals::take();
    let system = peripherals.SYSTEM.split();

    let clocks = ClockControl::max(system.clock_control).freeze();
    let mut delay = Delay::new(&clocks);

    println!("Hello world!");
    loop {
        println!("Loop...");
        delay.delay_ms(500u32);
    }
}

with the .cargo/config.toml:

[target.riscv32imac-unknown-none-elf]
runner = "espflash flash --monitor"


[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",
]

target = "riscv32imac-unknown-none-elf"

[unstable]
build-std = ["core"]

and Cargo.toml:

[package]
name = "esp32-c6-hello-v4"
version = "0.1.0"
authors = [""]
edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
hal = { package = "esp32c6-hal", version = "0.6.0" }
esp-backtrace = { version = "0.9.0", features = ["esp32c6", "panic-handler", "exception-handler", "print-uart"] }
esp-println = { version = "0.7.0", features = ["esp32c6"] }

Something I realized is that the built binary is large (larger than the available flash?):

❯ ls target/riscv32imac-unknown-none-elf/debug/esp32-c6-hello-v5

I tried opt-level = "s" and opt-level = "z" and strip = true which does reduce the size but the same result happens: there's no hello world :(

Any idea what I could be doing wrong? I'm not sure what to look for as playing with embedded is quite new for me.

Thanks!!

esp32c3 can't boot

Board: https://cdn.openluat-luatcommunity.openluat.com/attachment/CORE-ESP32-C3%E8%AE%BE%E8%AE%A1%E5%8E%9F%E7%90%86%E5%9B%BE_V1.2.pdf

Toolchains installed by espup

project generated using cargo generate --git https://github.com/esp-rs/esp-template, target esp32c3.

Output:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xe (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x172c
load:0x3ce00000,len:0x92840
load:0x50285e28,len:0xfeaa50a8
Invalid image block, can't boot.
ets_main.c 333 
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0xe (SPI_FAST_FLASH_BOOT)
Saved PC:0x40047ed2
0x40047ed2 - _stack_start
    at ??:??
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x172c
load:0x3ce00000,len:0x92840
load:0x50285e28,len:0xfeaa50a8
Invalid image block, can't boot.
ets_main.c 333

This board using a micropython firmware with custom partition table previously:

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 0x2F0000,
vfs,      data, fat,     0x300000, 0x100000,

I tried to generate another project with esp32 target and esp32 board, it works fine.

Consider restructuring the project to simplify adding support for new chips

Currently due to the limited functionality of the templating system used by cargo-generate, our template files are quite messy. It's also rather difficult to add support for a new chip, and in general I just feel that from a maintainer's perspective this project still leaves a lot to be desired.

I'm proposing we consider restructuring the project to simplify things for us. I have two possible ideas; both of these have the unfortunate side-effect of requiring a fair bit of duplication, however I feel they are both cleaner and will give us much more flexibility than we currently have.

I will outline my ideas below. It may turn out that sticking with our current approach is the right way forward, however I would at least like to discuss these other options.

cc @SergioGasquez

Per-architecture Templates

One possibility is splitting things up into two subdirectories, riscv and xtensa, much in the same way that esp-idf-template is split into cargo and cmake directories.

This removes a lot of the conditional code from our templates, and we are fairly certain that no new Xtensa devices will be released so we can be reasonably confident that this will not change much. Adding support for new devices will always require modifying the riscv template.

Per-device Templates

Taking this even a step further, we could simply have a directory for each supported device. This results in a lot of duplication, however the templates become much simpler and cleaner as a result and we have maximum flexibility. This also makes it trivial to add support for a new device.

My only concern here is that I'm not sure this level of duplication is worth the benefits.

espflash::connection_failed when building

I have an esp32-cam-mb (an esp32-cam with a programming mb) and I am able to build and run the idf template (https://github.com/esp-rs/esp-idf-template) out of the box without any alteration. When building the esp-template, I get an error:

~/devel/turingatemyhamster/scratch/cam32-baremetal-blink$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `espflash flash --monitor target/xtensa-esp32-none-elf/debug/cam32_baremetal_blink`
New version of espflash is available: v2.0.0-rc.3

Error: espflash::connection_failed

  × Error while connecting to device
  ╰─▶ Serial port not found
  help: Ensure that the device is connected and your host recognizes the serial adapter

When I edited the file .cargo/config.toml to replace runner = "espflash flash --monitor" with runner = "espflash --monitor", it succeeded in uploading and running code, although it appears there's some other issue that prevents it reaching the "hello world!" line, but I guess that's another bug report.

For completeness, here is the successful session with esp-idf-template.

~/devel/turingatemyhamster/scratch/cam32-idf-blink$ cargo run
    Finished dev [optimized + debuginfo] target(s) in 0.12s
     Running `espflash --monitor target/xtensa-esp32-espidf/debug/cam32-idf-blink`
New version of espflash is available: v2.0.0-rc.3

Serial port: /dev/ttyUSB0
Connecting...

Chip type:         ESP32 (revision 3)
Crystal frequency: 40MHz
Flash size:        4MB
Features:          WiFi, BT, Dual Core, 240MHz, Coding Scheme None
MAC address:       c8:f0:9e:4d:4c:34
App/part. size:    449296/4128768 bytes, 10.88%
[00:00:01] ########################################      16/16      segment 0x1000                                  [00:00:00] ########################################       1/1       segment 0x8000                                  [00:00:23] ########################################     228/228     segment 0x10000                                 
Flashing has completed!
Commands:
    CTRL+R    Reset chip
    CTRL+C    Exit

ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0048,len:12
ho 0 tail 12 room 4
load:0x3fff0054,len:4800
load:0x40078000,len:17448
0x40078000 - __udivmoddi4
    at ??:??
load:0x4007c428,len:4840
0x4007c428 - __udivmoddi4
    at ??:??
entry 0x4007c6a0
0x4007c6a0 - __udivmoddi4
    at ??:??
I (227) cpu_start: Pro cpu up.
I (227) cpu_start: Starting app cpu, entry point is 0x40081164
0x40081164 - call_start_cpu1
    at /home/nmrp3/devel/turingatemyhamster/scratch/cam32-idf-blink/.embuild/espressif/esp-idf/release-v4.4/components/esp_system/port/cpu_start.c:148
I (0) cpu_start: App cpu up.
I (241) cpu_start: Pro cpu start user code
I (241) cpu_start: cpu freq: 160000000
I (241) cpu_start: Application information:
I (246) cpu_start: Project name:     libespidf
I (251) cpu_start: App version:      1
I (255) cpu_start: Compile time:     Mar 13 2023 14:24:44
I (261) cpu_start: ELF file SHA256:  0000000000000000...
I (267) cpu_start: ESP-IDF:          fee50c2-dirty
I (273) cpu_start: Min chip rev:     v0.0
I (277) cpu_start: Max chip rev:     v3.99 
I (282) cpu_start: Chip rev:         v3.0
I (287) heap_init: Initializing. RAM available for dynamic allocation:
I (294) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (300) heap_init: At 3FFB23A8 len 0002DC58 (183 KiB): DRAM
I (306) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (313) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (319) heap_init: At 4008AB20 len 000154E0 (85 KiB): IRAM
I (327) spi_flash: detected chip: generic
I (330) spi_flash: flash io: dio
I (335) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Hello, world!

Update rust-toolchain.toml

rust-toolchain.toml can include components and target properties, so it will download them if the user does not have it

CI caching does not work

I noticed that the caching for Rust did not work. After some investigation, I saw the following errors in Enable Caching step:

Error: Command failed: rustc -vV
Error: error: in /home/runner/work/armo-firmware-rs/armo-firmware-rs/rust-toolchain.toml: invalid toolchain name: 'esp'

Looking at the rust-cache README, I found the following note:

selecting a toolchain either by action or manual rustup calls should happen
before the plugin, as the cache uses the current rustc version as its cache key

Currently, CI workflow enables the cache before setting up Rust, but the two steps should be reversed.

Add an option for an alloc crate

I'm new to rust on embedded systems. I want to use esp-hal instead of esp-idf because idf has lots of stuff and configuration I dont understand, so being more bare metal will help me learn here.

I am attempting to use the alloc crate, it would be great if the cargo generate for this template prompted the user to ask them if they want to use alloc, and gives them a good default global allocator to use, like esp-alloc

When do I call init_heap()?

I just used cargo generate to create a new project for ESP32C3 with allocations via the esp-alloc crate. When I build I get this warning message:

warning: function `init_heap` is never used
  --> src\main.rs:10:4
   |
10 | fn init_heap() {
   |    ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Should I call init_heap() first thing in main()?

Generation fails when using `advanced=false`

❯ cargo generate --vcs none --path ../forks/esp-template/ --name rust-project-esp32 -d mcu=esp32 -d advanced=false
🔧   mcu: "esp32" (variable provided via CLI)
🔧   advanced: "false" (variable provided via CLI)
🔧   Destination: /home/sergio/Documents/Espressif/tests/rust-project-esp32 ...
🔧   project-name: rust-project-esp32 ...
🔧   Generating template ...
Error: ⛔   Failed executing script: post-script.rhai

Caused by:
    Function not found: print (&str | ImmutableString | String, bool) (line 6, position 1)

Cannot flash ESP32 using `web-flash` tool

I am getting started on the awesome world of embedded-rust, amazing! 🦀

I am not sure, but I didn't found any document related to web-flash.

web-flash --chip {{ mcu }} target/{{ rust_target }}/${BUILD_MODE}/{{ crate_name }}

Also, in the ESP Rust Book I found that the official tool used to flash ESP32 is espflash, that is based on esptool.py.
https://esp-rs.github.io/book/tooling/espflash.html#cargo-espflash
Fortunately, with this tool I could flash the ESP32 successfully.

Could anyone tell me why the template use this web-flash tool instead of espflash?
Thanks in advance! 😃

Idea: Offering VSCode Snippets

As suggested by @jessebraham in the last community meeting, adding more and more options will make the template (even) harder to maintain and we probably should only generate a minimal project

As @MabezDev mentioned the thing users are struggling the most with is choosing the needed dependencies (and features) - so we probably should generate Cargo.toml even for more advanced configurations (embassy, wifi, ble etc.)

One thing that came to my mind is we could still support at least VSCode users by providing snippets (see https://code.visualstudio.com/docs/editor/userdefinedsnippets) - and even add more convenience

e.g. adding ./.vscode/rust.code-snippets like this

{
	"Construct SPI": {
		"prefix": "setup_spi",
		"body": [
            "//use hal::{IO, spi::{master::Spi, SpiMode}};",
	    "let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);",
            "let sclk = io.pins.gpio$1;",
            "let miso = io.pins.gpio$2;",
            "let mosi = io.pins.gpio$3;",
            "let cs = io.pins.gpio$4;",
            "",
            "let mut spi = Spi::new(peripherals.SPI2, 100u32.kHz(), SpiMode::Mode0, &clocks).with_pins(",
            "    Some(sclk),",
            "    Some(mosi),",
            "    Some(miso),",
            "    Some(cs),",
            ");"
		],
		"description": "Setup SPI"
	}
}

Would give the user an easy way to create an SPI instance. Since snippets are not very powerful, they still need to figure out the right imports - we could just add a local use statement or (like in this very simple example) a commented out use statement which users can manually copy (or remove). Or don't do that and let the user use the quick-fix feature.

We could also have snippets to add dependencies to Cargo.toml instead of generating it (e.g. a snippet to add embassy or esp-wifi)

This way we could also add more elaborate snippets like setting up wifi, ble etc.

But I'm not sure if this is really a very useful thing or just sounds good in my head. I'm also not sure which snippets to include (for me I always have to look up how to setup some peripherals but maybe that's just me)

Downsides of this

  • we cannot verify the snippets in CI
  • needs some maintenance whenever there are breaking API changes
  • might clutter the CTRL+SPACE code completion if we have a lot of these snippets

wish: Blinking LED

The current template is a hollow shell. My wish is that it gets "blinking LED" code.

Benefits I see:

  • The whole toolchain can be verified
  • There is something that works and can be tweaked ( frequency of LED blinking )

Possible down side: The unwanted source code has to be removed.
(but that is outweighted by all project starts that do need / want something that proves a working target)

Wrong espflash command

Hi!
I generated the sample program from this esp-template but in the .cargo/config.toml
I've finally got:

[target.xtensa-esp32-none-elf]
runner = "espflash flash --monitor"

Since version 2.0 of espflash the --monitor parameter is not valid anymore.

CI needs to be improved

Our current CI takes way too long to run, 10+ minutes, and does not work at all in forks. This makes developing new features much more difficult than it needs to be.

There is some low-hanging fruit, such as ldproxy (not sure why this is being installed?), but I'm not sure if that will be enough by itself to get us to more reasonable run times.

Bump cargo_generate_version

I think the current cargo_generate_version = ">=0.10.0" is too old for the features the template uses - not sure which is the minimum version, it definitely works with 0.17.6 (which I have installed)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.