tock / libtock-rs

Rust userland library for Tock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't compile example to esp32-c3 platform

gentooza opened this issue · comments

commented

Hi!

If I execute

make esp32_c3_devkitm_1 EXAMPLE=console

I get:

   Compiling runner v0.1.0 (/home/joa/dev/uni/investigación/rust/libtock-rs/runner)
    Finished release [optimized + debuginfo] target(s) in 33.35s
     Running `target/release/runner target/esp32_c3_devkitm_1/riscv32imc-unknown-none-elf/release/examples/console`
thread 'main' panicked at runner/src/elf2tab.rs:80:37:
failed to spawn elf2tab: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
make: *** [Makefile:226: esp32_c3_devkitm_1] Aborted

with more debugging options using RUST_BACKTRACE=full

stack backtrace:
   0:     0x556449744063 - std::backtrace_rs::backtrace::libunwind::trace::h2fefbffbf6edc5fe
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x556449744063 - std::backtrace_rs::backtrace::trace_unsynchronized::h164a12d32260fd00
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x556449744063 - std::sys_common::backtrace::_print_fmt::hb526b767be294050
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x556449744063 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2ed4562c3fadaa06
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x5564496f3460 - core::fmt::rt::Argument::fmt::hcfb0ff3711585c88
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/core/src/fmt/rt.rs:142:9
   5:     0x5564496f3460 - core::fmt::write::hf547b89b5928c219
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/core/src/fmt/mod.rs:1120:17
   6:     0x556449712a12 - std::io::Write::write_fmt::h0ba28ced0cce0432
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/io/mod.rs:1810:15
   7:     0x556449745c0e - std::sys_common::backtrace::_print::h245e3ea3a357897c
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x556449745c0e - std::sys_common::backtrace::print::hb2b9d1bad7a2cf62
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x556449745390 - std::panicking::default_hook::{{closure}}::he1e52e51a225e06e
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/panicking.rs:272:22
  10:     0x556449746531 - std::panicking::default_hook::hb0e6855273f2cb43
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/panicking.rs:292:9
  11:     0x556449746531 - std::panicking::rust_panic_with_hook::h6281fe4d868fb823
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/panicking.rs:781:13
  12:     0x556449745f60 - std::panicking::begin_panic_handler::{{closure}}::h12f9affd4f370d23
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/panicking.rs:659:13
  13:     0x556449745eb6 - std::sys_common::backtrace::__rust_end_short_backtrace::hf782545fa95fe373
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x556449745eaf - rust_begin_unwind
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/panicking.rs:647:5
  15:     0x5564496adcf4 - core::panicking::panic_fmt::hc956e908d0260c2f
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/core/src/panicking.rs:72:14
  16:     0x5564496ae1c2 - core::result::unwrap_failed::h4ef29696267c2949
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/core/src/result.rs:1649:5
  17:     0x556449706fb8 - core::result::Result<T,E>::expect::h32df3b941ab89717
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/core/src/result.rs:1030:23
  18:     0x556449706fb8 - runner::elf2tab::convert_elf::hb9cbaf17fbd53abb
                               at /home/joa/dev/uni/investigación/rust/libtock-rs/runner/src/elf2tab.rs:80:21
  19:     0x556449706fb8 - runner::main::h2cdc1c5fd5624482
                               at /home/joa/dev/uni/investigación/rust/libtock-rs/runner/src/main.rs:48:17
  20:     0x55644970a233 - core::ops::function::FnOnce::call_once::hf8aaaaefc2d14d90
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/core/src/ops/function.rs:250:5
  21:     0x55644970a233 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3b1ae49ff3473963
                               at /rustc/30dfb9e046aeb878db04332c74de76e52fb7db10/library/std/src/sys_common/backtrace.rs:155:18
  22:     0x556449701f7d - main
  23:     0x7f050faf8d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  24:     0x7f050faf8e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  25:     0x5564496b10b5 - _start
  26:                0x0 - <unknown>
make: *** [Makefile:226: esp32_c3_devkitm_1] Aborted

I'm a total newbie using rust (and pretty newbie compiling to esp32 :-D)

Cheers!

commented

Solved!

My problem was the crate elf2tab not installed.

I think setup process in Makefile should be different as it tries to execute:

setup-qemu toolchain
cargo install elf2tab

And for me qemu is not mandatory as I'm going to test this in a real device.
As qemu is not installed setup process stops with an error and elf2tab was never installed.

related to issue #492

Cheers

We should do a better job of documenting which dependencies are required for writing apps (>=MSRV Rust toolchain, elf2tab... maybe that's all?) and which dependencies are needed to develop libtock-rs (specific nightly toolchain, qemu, make, probably others).

Creating automated targets to install the correct subset of our dependencies for a particular user is tricky, because different users use different dependencies. Some users deploy to boards that require tockloader and OpenOCD, others develop only in QEMU. If someone is developing an out-of-tree app, they will need elf2tab but not the libtock-rs Rust toolchains. Also, the only environment we can automatically test is the CI environment, which starts with a lot of things preinstalled (e.g. rustup) and does not have dev hardware test. So in practice, maintaining a setup action that targets a different environment will be difficult. I think the best solution is better documentation.