Git Product home page Git Product logo

esp-idf-sys's Introduction

Raw Rust bindings for the ESP IDF SDK

CI crates.io Documentation Matrix Wokwi

Highlights

  • Build is cargo driven and automatically downloads & configures everything by default; no need to download the ESP IDF SDK manually, or set up a C toolchain
  • Supports both native ESP IDF build (default), as well as a PlatformIO build
  • Option to use in a mixed Rust/C project. Check the documentation in the esp-idf-template crate

You might want to also check out the type safe Rust wrappes built on top of these raw bindings:

Note
esp-idf-sys's build script will download the esp-idf, its gcc toolchain, and build it. To show progress and build information about this process run cargo with the -vv (very verbose) flag, so that build script output is also displayed. This is especially useful since the initial build will take a while.

Build Prerequisites

Follow the Prerequisites section in the esp-idf-template crate.

Customizing how the ESP IDF SDK is built

Read the documentation here.

Examples

The examples could be built and flashed conveniently with cargo-espflash. To run e.g. std_basics on an e.g. ESP32-C3: (Swap the Rust target and example name with the target corresponding for your ESP32 MCU and with the example you would like to build)

with cargo-espflash:

$ MCU=esp32c3 cargo espflash flash --target riscv32imc-esp-espidf --example std_basics --monitor
MCU "--target"
esp32c2 riscv32imc-esp-espidf
esp32c3 riscv32imc-esp-espidf
esp32c6 riscv32imac-esp-espidf
esp32h2 riscv32imac-esp-espidf
esp32p4 riscv32imafc-esp-espidf
esp32 xtensa-esp32-espidf
esp32s2 xtensa-esp32s2-espidf
esp32s3 xtensa-esp32s3-espidf

Setting up a "Hello, world!" binary crate with ESP IDF

Use the esp-idf-template project. Everything would be arranged and built for you automatically - no need to manually clone the ESP IDF repository.

More information

For more information, check out:

esp-idf-sys's People

Contributors

axos88 avatar bernii avatar bjoernq avatar bugadani avatar dacut avatar elotom avatar faern avatar forsakenharmony avatar ivmarkov avatar krhougs avatar mabezdev avatar maximeborges avatar mykmelez avatar n3xed avatar pyaillet avatar rednaz1337 avatar reitermarkus avatar ricardicus avatar s3j5b0 avatar sapir avatar sergiogasquez avatar svenstaro avatar taks avatar tcbennun avatar torkleyy avatar usbalbin avatar vollbrecht avatar xymist avatar yoshinari-nomura avatar zredshift 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-idf-sys's Issues

Include esp_tls.h header

Hello,
would it be possible to include the esp_tls.h header? I think this would be useful to be able to make https requests.

Best regards.

First 3 bytes of files read from FatFs will be truncated

Hi,
I have created a repro for this bug: https://github.com/derchr/repro-fs
Just follow the instructions in the readme and the bug should show up.

Description of the bug:
What I noticed is that somehow the first 3 bytes of all files that are being read from the filesystem get truncated.
I'm almost certain that 1-2 weeks ago this bug wasn't there as I remember loading binary files (images) from the fs and this worked flawlessly. Now always 3 bytes are missing and the image does not get parsed.
I'm also not sure if this is even caused by esp-idf-sys.

My toolchain is the esp rust compiler version 1.57.0 targeting the default ESP32.
In the example I use the master branch of esp-idf, but I also encountered the issue in the stable 4.4 version.

Thanks!

EDIT:
When using a fixed size array instead of Vec or String to read in the file, it actually works! String::with_capacity on the other hand does not work.

    use std::io::Read;
    let mut lorem = std::fs::File::open("/mnt/readme.txt").unwrap();
    let mut read: usize;
    let mut buf = [0u8; 512];
    read = lorem.read(&mut buf).unwrap();
    while read != 0 {
        println!("{}", std::str::from_utf8(&buf[..read]).unwrap());
        read = lorem.read(&mut buf).unwrap();
    }

`esp-idf-sys` fails to build

I have a project using the Rust ESP toolchain and today compilation of esp-idf-sys failed without any apparent changes. I've created an entirely new project from scratch using https://github.com/esp-rs/esp-idf-template and even that fails to compile with the exact same error:

    Updating crates.io index
   Compiling compiler_builtins v0.1.49
   Compiling core v0.0.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.103
   Compiling libc v0.2.112
   Compiling cc v1.0.69
   Compiling proc-macro2 v1.0.36
   Compiling std v0.0.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std)
   Compiling unicode-xid v0.2.2
   Compiling cfg-if v1.0.0
   Compiling syn v1.0.84
   Compiling memchr v2.4.1
   Compiling cc v1.0.72
   Compiling serde_derive v1.0.133
   Compiling fnv v1.0.7
   Compiling log v0.4.14
   Compiling once_cell v1.9.0
   Compiling autocfg v1.0.1
   Compiling regex-syntax v0.6.25
   Compiling untrusted v0.7.1
   Compiling spin v0.5.2
   Compiling serde v1.0.133
   Compiling adler v1.0.2
   Compiling version_check v0.9.4
   Compiling glob v0.3.0
   Compiling tinyvec_macros v0.1.0
   Compiling matches v0.1.9
   Compiling lazy_static v1.4.0
   Compiling crossbeam-utils v0.8.5
   Compiling crc32fast v1.3.0
   Compiling gimli v0.26.1
   Compiling minimal-lexical v0.2.1
   Compiling bitflags v1.3.2
   Compiling unicode-bidi v0.3.7
   Compiling same-file v1.0.6
   Compiling unicode-width v0.1.9
   Compiling percent-encoding v2.1.0
   Compiling ppv-lite86 v0.2.16
   Compiling strsim v0.8.0
   Compiling rustc-demangle v0.1.21
   Compiling serde_json v1.0.74
   Compiling humantime v2.1.0
   Compiling ansi_term v0.12.1
   Compiling termcolor v1.1.2
   Compiling vec_map v0.8.2
   Compiling anyhow v1.0.52
   Compiling bindgen v0.59.2
   Compiling either v1.6.1
   Compiling remove_dir_all v0.5.3
   Compiling ryu v1.0.9
   Compiling rustc-hash v1.1.0
   Compiling strsim v0.10.0
   Compiling peeking_take_while v0.1.2
   Compiling unicode-segmentation v1.8.0
   Compiling zero v0.1.2
   Compiling ident_case v1.0.1
   Compiling chunked_transfer v1.4.0
   Compiling shlex v1.1.0
   Compiling lazycell v1.3.0
   Compiling base64 v0.13.0
   Compiling itoa v1.0.1
   Compiling async-trait v0.1.52
   Compiling paste v1.0.6
   Compiling libloading v0.7.2
   Compiling tinyvec v1.5.1
   Compiling thread_local v1.1.3
   Compiling walkdir v2.3.2
   Compiling textwrap v0.11.0
   Compiling form_urlencoded v1.0.1
   Compiling nom v7.1.0
   Compiling xmas-elf v0.8.0
   Compiling miniz_oxide v0.4.4
   Compiling clang-sys v1.3.0
   Compiling heck v0.3.3
   Compiling quote v1.0.14
   Compiling aho-corasick v0.7.18
   Compiling bstr v0.2.17
   Compiling object v0.27.1
   Compiling ring v0.16.20
   Compiling backtrace v0.3.63
   Compiling unwind v0.0.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/unwind)
   Compiling getrandom v0.2.3
   Compiling atty v0.2.14
   Compiling which v4.2.2
   Compiling dirs-sys v0.3.6
   Compiling flate2 v1.0.22
   Compiling unicode-normalization v0.1.19
   Compiling clap v2.34.0
   Compiling rand_core v0.6.3
   Compiling dirs v4.0.0
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.4
   Compiling regex v1.5.4
   Compiling idna v0.2.3
   Compiling tempfile v3.2.0
   Compiling addr2line v0.17.0
   Compiling url v2.2.2
   Compiling cexpr v0.6.0
   Compiling globset v0.4.8
   Compiling env_logger v0.9.0
   Compiling ignore v0.4.18
   Compiling webpki v0.22.0
   Compiling sct v0.7.0
   Compiling webpki-roots v0.22.2
   Compiling rustls v0.20.2
   Compiling globwalk v0.8.1
   Compiling darling_core v0.13.1
   Compiling ureq v2.4.0
   Compiling strum_macros v0.21.1
   Compiling darling_macro v0.13.1
   Compiling darling v0.13.1
   Compiling enumset_derive v0.5.5
   Compiling strum v0.21.0
   Compiling rustc-std-workspace-core v1.99.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v0.1.10
   Compiling rustc-std-workspace-alloc v1.99.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/panic_unwind)
   Compiling hashbrown v0.11.0
   Compiling std_detect v0.1.5 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
   Compiling toml v0.5.8
   Compiling proc_macro v0.0.0 (/home/sophie/.rustup/toolchains/esp/lib/rustlib/src/rust/library/proc_macro)
   Compiling cargo_toml v0.9.2
   Compiling base64 v0.12.3
   Compiling no-std-net v0.5.0
   Compiling enumset v1.0.8
   Compiling mutex-trait v0.2.0
   Compiling http-auth-basic v0.1.3
   Compiling embuild v0.27.1
   Compiling esp-idf-sys v0.28.3
   Compiling esp-test v0.1.0 (/home/sophie/projects/other/esp-test)
   Compiling embedded-svc v0.15.4
error: failed to run custom build command for `esp-idf-sys v0.28.3`

Caused by:
  process didn't exit successfully: `/home/sophie/projects/other/esp-test/target/debug/build/esp-idf-sys-e4ce039c35a62e6f/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  Installer version: 1.0.2
  Platform: Linux-5.15.11-zen1-1-zen-x86_64-with-glibc2.33
  Python version: 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0]
  Python path: /usr/bin/python3
  Creating a virtual environment at /home/sophie/projects/other/esp-test/.embuild/platformio/penv
  Updating Python package manager (PIP) in a virtual environment
  PIP has been successfully updated!
  Virtual environment has been successfully created!
  Installing PlatformIO Core
  Collecting platformio
    Using cached platformio-5.2.4-py3-none-any.whl
  Collecting requests==2.*
    Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
  Collecting semantic-version==2.8.*
    Using cached semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
  Collecting colorama
    Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
  Collecting starlette==0.17.*
    Using cached starlette-0.17.1-py3-none-any.whl (58 kB)
  Collecting pyelftools<1,>=0.27
    Using cached pyelftools-0.27-py2.py3-none-any.whl (151 kB)
  Collecting aiofiles==0.8.*
    Using cached aiofiles-0.8.0-py3-none-any.whl (13 kB)
  Collecting ajsonrpc==1.*
    Using cached ajsonrpc-1.2.0-py3-none-any.whl (22 kB)
  Collecting tabulate==0.8.*
    Using cached tabulate-0.8.9-py3-none-any.whl (25 kB)
  Collecting uvicorn==0.16.*
    Using cached uvicorn-0.16.0-py3-none-any.whl (54 kB)
  Collecting bottle==0.12.*
    Using cached bottle-0.12.19-py3-none-any.whl (89 kB)
  Collecting marshmallow<4,>=2
    Using cached marshmallow-3.14.1-py3-none-any.whl (47 kB)
  Collecting zeroconf==0.37.*
    Using cached zeroconf-0.37.0-py3-none-any.whl (105 kB)
  Collecting click!=8.0.2,<9,>=8
    Using cached click-8.0.3-py3-none-any.whl (97 kB)
  Collecting pyserial==3.*
    Using cached pyserial-3.5-py2.py3-none-any.whl (90 kB)
  Collecting wsproto==1.0.*
    Using cached wsproto-1.0.0-py3-none-any.whl (24 kB)
  Collecting idna<4,>=2.5
    Using cached idna-3.3-py3-none-any.whl (61 kB)
  Collecting charset-normalizer~=2.0.0
    Using cached charset_normalizer-2.0.9-py3-none-any.whl (39 kB)
  Collecting urllib3<1.27,>=1.21.1
    Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB)
  Collecting certifi>=2017.4.17
    Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
  Collecting anyio<4,>=3.0.0
    Using cached anyio-3.4.0-py3-none-any.whl (78 kB)
  Collecting h11>=0.8
    Using cached h11-0.12.0-py3-none-any.whl (54 kB)
  Collecting asgiref>=3.4.0
    Using cached asgiref-3.4.1-py3-none-any.whl (25 kB)
  Collecting ifaddr>=0.1.7
    Using cached ifaddr-0.1.7-py2.py3-none-any.whl (10 kB)
  Collecting sniffio>=1.1
    Using cached sniffio-1.2.0-py3-none-any.whl (10 kB)
  Installing collected packages: sniffio, idna, urllib3, ifaddr, h11, click, charset-normalizer, certifi, asgiref, anyio, zeroconf, wsproto, uvicorn, tabulate, starlette, semantic-version, requests, pyserial, pyelftools, marshmallow, colorama, bottle, ajsonrpc, aiofiles, platformio
  Successfully installed aiofiles-0.8.0 ajsonrpc-1.2.0 anyio-3.4.0 asgiref-3.4.1 bottle-0.12.19 certifi-2021.10.8 charset-normalizer-2.0.9 click-8.0.3 colorama-0.4.4 h11-0.12.0 idna-3.3 ifaddr-0.1.7 marshmallow-3.14.1 platformio-5.2.4 pyelftools-0.27 pyserial-3.5 requests-2.26.0 semantic-version-2.8.5 sniffio-1.2.0 starlette-0.17.1 tabulate-0.8.9 urllib3-1.26.7 uvicorn-0.16.0 wsproto-1.0.0 zeroconf-0.37.0

  PlatformIO Core has been successfully installed into an isolated environment `/home/sophie/projects/other/esp-test/.embuild/platformio/penv`!

  The full path to `platformio.exe` is `/home/sophie/projects/other/esp-test/.embuild/platformio/penv/bin/platformio`

  If you need an access to `platformio.exe` from other applications, please install Shell Commands
  (add PlatformIO Core binary directory `/home/sophie/projects/other/esp-test/.embuild/platformio/penv/bin` to the system environment PATH variable):

  See https://docs.platformio.org/page/installation.html#install-shell-commands

  Found compatible PlatformIO Core 5.2.4 -> /home/sophie/projects/other/esp-test/.embuild/platformio/penv/bin/platformio

  --- stderr
  Error: Compatible PlatformIO Core not found.
  Reason: PlatformIO executable not found in `/home/sophie/projects/other/esp-test/.embuild/platformio/penv/bin`
  Error: invalid type: null, expected a string at line 1 column 9390

Every subsequent build (without cleaning the .embuild directory) fails with:

   Compiling esp-idf-sys v0.28.3
error: failed to run custom build command for `esp-idf-sys v0.28.3`

Caused by:
  process didn't exit successfully: `/home/sophie/projects/other/esp-test/target/debug/build/esp-idf-sys-e4ce039c35a62e6f/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  Found compatible PlatformIO Core 5.2.4 -> /home/sophie/projects/other/esp-test/.embuild/platformio/penv/bin/platformio

  --- stderr
  Error: invalid type: null, expected a string at line 1 column 9390

Consider installing embedded Python on Windows

Python is not installed by default on Windows, and overall, the installation is a hassle.
Therefore, the ESP-IDF installation script (PowerShell) for Windows installs an embedded Python instance in the ~/.espressif directory.

  • We might do the same during the native cargo-first build when installing other stuff in the .espressif directory.
  • We might even consider doing this for the PlatformIO build, even though it is not completely clear where exactly the Python instance should be uncompressed then (in ~/.platformio?).

Assert when calling std::time::Instant::now()

I got such traceback using https://maximeborges.github.io/esp-stacktrace-decoder/ on ESP32.

esp-idf-sys = { version = "0.30.4", features = ["binstart"] }
esp-idf-svc = "0.36.7"
esp-idf-hal = "=0.32.4"
    0x40081bd2: panic_abort at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/esp_system/panic.c:393
    0x40087d29: esp_system_abort at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/esp_system/system_api.c:112
    0x4008df69: __assert_func at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/newlib/assert.c:85
    0x40088c25: xQueueSemaphoreTake at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/freertos/queue.c:1451
    0x40082bd4: pthread_mutex_lock_internal at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/pthread/pthread.c:630
    0x40082c06: pthread_mutex_lock at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/pthread/pthread.c:660
    0x400d7589: std::sys::unix::mutex::Mutex::lock at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/sys/unix/mutex.rs:63
    0x400d7589: std::sys_common::mutex::StaticMutex::lock at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/sys_common/mutex.rs:29
    0x400d7589: std::time::monotonic::inner::monotonize at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/time/monotonic.rs:110
    0x400d7589: std::time::monotonic::monotonize at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/time/monotonic.rs:5
    0x400d7589: std::time::Instant::now at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/time.rs:289
+   0x400d3442: esp32rogue::ublox::timer::SysTimer<_>::new at /Users/andres/Development/yaak/esp32rogue/src/ublox/timer.rs:15
+   0x400d3def: esp32rogue::ublox::spawn at /Users/andres/Development/yaak/esp32rogue/src/ublox/mod.rs:56
    0x400d35f2: esp32rogue::main at /Users/andres/Development/yaak/esp32rogue/src/main.rs:79
    0x400d31c5: core::ops::function::FnOnce::call_once at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
    0x400d31c5: std::sys_common::backtrace::__rust_begin_short_backtrace at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:123
    0x400d31c5: std::rt::lang_start::{{closure}} at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:146
    0x400d7065: core::ops::function::impls:: for &F>::call_once at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:259
    0x400d7065: std::panicking::try::do_call at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/panicking.rs:403
    0x400d7065: std::panicking::try at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/panicking.rs:367
    0x400d7065: std::panic::catch_unwind at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/panic.rs:133
    0x400d7065: std::rt::lang_start_internal::{{closure}} at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:128
    0x400d7065: std::panicking::try::do_call at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/panicking.rs:403
    0x400d7065: std::panicking::try at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/panicking.rs:367
    0x400d7065: std::panic::catch_unwind at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/panic.rs:133
    0x400d7065: std::rt::lang_start_internal at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:128
    0x400d31b6: std::rt::lang_start at /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:145
    0x400d4c4f: app_main at /Users/andres/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.30.4/src/start.rs:46
    0x400faf8c: main_task at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/freertos/port/port_common.c:133
    0x4008b429: vPortTaskWrapper at /Users/andres/Development/yaak/esp32rogue/.embuild/platformio/packages/framework-espidf/components/freertos/port/xtensa/port.c:168

I have little bit hard time understanding where things blew up.
So esp32rogue/src/ublox/mod.rs:56 calls my timer wrapper esp32rogue/src/ublox/timer.rs:15 which looks like:

use ublox_cellular::fugit;
use ublox_cellular::prelude::*;

pub struct SysTimer<const TIMER_HZ: u32> {
    description: String,
    monotonic: std::time::Instant,
    start: Option<std::time::Instant>,
    duration: fugit::TimerDurationU32<TIMER_HZ>,
}

impl<const TIMER_HZ: u32> SysTimer<TIMER_HZ> {
    pub fn new(description: &str) -> Self {
        Self {
            description: description.into(),
            monotonic: std::time::Instant::now(),
            start: None,
            duration: fugit::TimerDurationU32::millis(0),
        }
    }
}

impl<const TIMER_HZ: u32> Clock<TIMER_HZ> for SysTimer<TIMER_HZ> {
    type Error = std::convert::Infallible;

    fn now(&mut self) -> fugit::TimerInstantU32<TIMER_HZ> {
        let millis = self.monotonic.elapsed().as_millis();
        fugit::TimerInstantU32::from_ticks(millis as u32)
    }

    fn start(&mut self, duration: fugit::TimerDurationU32<TIMER_HZ>) -> Result<(), Self::Error> {
        self.start = Some(std::time::Instant::now());
        self.duration = duration.convert();
        log::debug!(
            "[{}] start {:?} duration {:?}",
            self.description,
            self.start,
            self.duration
        );
        Ok(())
    }

    fn cancel(&mut self) -> Result<(), Self::Error> {
        if self.start.is_some() {
            self.start = None;
        }
        Ok(())
    }

    fn wait(&mut self) -> nb::Result<(), Self::Error> {
        if let Some(start) = self.start {
            if std::time::Instant::now() - start > std::time::Duration::from_millis(self.duration.ticks() as u64) {
                log::debug!(
                    "[{}] now {:?} start {:?} duration {:?} {:?}",
                    self.description,
                    std::time::Instant::now(),
                    self.start,
                    self.duration,
                    std::time::Duration::from_millis(self.duration.ticks() as u64)
                );
                Ok(())
            } else {
                // this does not work yet
                // std::thread::yield_now();
                // use workaround
                unsafe { esp_idf_sys::vTaskDelay(1) };

                Err(nb::Error::WouldBlock)
            }
        } else {
            Ok(())
        }
    }
}

Line 15 is monotonic: std::time::Instant::now(),. If I understood it correctly calling this actually caused assert and panic in the end.

Notice that three SysTimer instances were created from different threads.

Decide tools installation directory

  • pio uses the platformio default in ~/.platformio
  • Should both strategies use the same directory (e.g. <?>/.embuild/platformio for pio and <?>/.embuild/espressif for native)?
  • Where should the default directory be: home, workspace or out directory?

@ivmarkov already enumerated options with pros and cons:

That is to say, whatever we decide to be the default, it should be for both build systems. To summarize, perhaps 4 options:

  • Option 1 - install and use the default global locations (i.e. ~/.platformio and ~/.espressif)
    • Pros:
      • Does not pollute the binary crate with stuff that should be .gitignore-d
      • Downloaded toolchains etc. can be re-used across builds of different binary crates
      • Already downloaded toolchains etc. will just be used
    • Cons:
      • Patching ESP-IDF by the build itself is not so ideal as this is kinda build-specific
      • Messes up with the global user configuration of either PlatformIO or Espressif idf.py
  • Option 2 - install and use an embuild-specific global location (i.e. ~/.embuild/platformio and ~/.embuild/espressif)
    • Pros:
      • Does not pollute the binary crate with stuff that should be .gitignore-d
      • Downloaded toolchains etc. can be re-used across builds of different binary crates
      • Already downloaded toolchains etc. will just be used
      • Does not mess up with the user configuration
    • Cons:
      • Patching ESP-IDF by the build itself is not so ideal as this is kinda build-specific
      • Creates something outside the binary crate directory
  • Option 3 - install and use an embuild-specific location within the root of the binary crate (i.e. .embuild/platformio and .embuild/espressif)
    • Pros:
      • Does not mess up with the user configuration
      • No global state
      • Patching ESP-IDF OK as it remains build specific
    • Cons:
      • Pollutes the binary crate with stuff that should be .gitignore-d
      • Still does not follow the cargo policy that everything should be in the $OUT_DIR
      • Downloaded toolchains etc. cannot be re-used across builds of different binary crates
  • Option 4 - install and use an embuild-specific location within the OUT_DIR of the binary crate (i.e. $OUT_DIR/embuild/platformio and $OUT_DIR/embuild/espressif)
    • Pros:
      • Does not mess up with the user configuration
      • No global state
      • Patching ESP-IDF OK as it remains build specific
      • Does not pollute the binary crate with stuff that should be .gitignore-d
      • Does not follow the cargo policy that everything should be int he $OUT_DIR
      • cargo clean means everything is removed, including ESP-IDf patches. Really clean state
    • Cons:
      • cargo clean means everything will be re-downloaded again
      • Downloaded toolchains etc. cannot be re-used across builds of different binary crates

Preferences for a default?
Mines are:

  • Option 2
  • Option 3 (if global state is something you guys feel uneasy)

In any case, having a flag/switch/env var/whatever so that the build framework is operating in Option 1 mode is a prerequisite IMO.

Build script failure when building esp-idf-sys as dependency of previously working project

I have a project based on rust-esp32-std-demo that I've been successfully building for my ESP32 in the past, but today, when I said cargo build, it decided to recompile esp-idf-sys and the esp-idf-sys build failed, without me changing anything except for my own code. (I also get the same (similar?) error after switching to the latest esp-idf-sys version.)

I don't know how to tell if this is an esp-idf-sys issue, or an embuild issue, or something else, so I'm reporting it in both places; feel free to close this if it's in the wrong place.

I'm on Debian, and I installed esp-rs using rust-build as of Jan 11 (rust-build commit 6b71e690c35778c7c62ba5a229542cdfae01d6c4).

Console output:

/n/autobuild/eliduprees-emg-mouse/build/emg-server$ cargo build
   Compiling bindgen v0.59.2
   Compiling embuild v0.27.2
   Compiling esp-idf-sys v0.29.1
   Compiling esp-idf-hal v0.32.2
   Compiling esp-idf-svc v0.36.1
   Compiling emg-server v0.1.0 (/n/autobuild/eliduprees-emg-mouse/build/emg-server)
error: failed to run custom build command for `esp-idf-sys v0.29.1`

Caused by:
  process didn't exit successfully: `/n/autobuild/eliduprees-emg-mouse/build/emg-server/target/debug/build/esp-idf-sys-dce598b034e4c44c/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  Found compatible PlatformIO Core 5.2.4 -> /n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/ping_setsockopt_fix.diff
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  cargo:rerun-if-changed=./patches/missing_riscv_atomics_fix.diff
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32cam; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Verbose mode can be enabled via `-v, --verbose` option
  CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32cam.html
  PLATFORM: Espressif 32 (3.4.0) > AI Thinker ESP32-CAM
  HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
  DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
  PACKAGES: 
   - framework-espidf 3.40301.0 (4.3.1) 
   - tool-cmake 3.16.4 
   - tool-esptoolpy 1.30100.210531 (3.1.0) 
   - tool-ninja 1.7.1 
   - toolchain-esp32ulp 1.22851.191205 (2.28.51) 
   - toolchain-riscv32-esp 8.4.0+2021r1 
   - toolchain-xtensa-esp32 8.4.0+2021r1 
   - toolchain-xtensa-esp32s2 8.4.0+2021r1
  Reading CMake configuration...
  LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
  LDF Modes: Finder ~ chain, Compatibility ~ soft
  Found 0 compatible libraries
  Scanning dependencies...
  No dependencies
  Building in debug mode
  Retrieving maximum program size .pio/build/debug/firmware.elf
  Checking size .pio/build/debug/firmware.elf
  Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
  RAM:   [          ]   3.9% (used 12896 bytes from 327680 bytes)
  Flash: [==        ]  15.7% (used 164497 bytes from 1048576 bytes)
  ========================= [SUCCESS] Took 12.18 seconds =========================

  Environment    Status    Duration
  -------------  --------  ------------
  debug          SUCCESS   00:00:12.181
  ========================= 1 succeeded in 00:00:12.181 =========================

  ********************************************************************************
  There are the new updates for platforms (espressif32)
  Please update them via `platformio platform update` command.

  If you want to manually check for the new versions without updating, please use `platformio platform update --dry-run` command.
  ********************************************************************************

  cargo:rerun-if-changed=/n/HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.29.1/src/include/esp-idf/bindings.h

  --- stderr
  Output: "/n/autobuild/eliduprees-emg-mouse/build/emg-server/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-94df6151a6a52853/out/bindings.rs"
  Bindgen builder flags: ["/n/HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.29.1/src/include/esp-idf/bindings.h", "--rust-target", "1.47", "--blocklist-function", "strtold", "--blocklist-function", "_strtold_r", "--blocklist-function", "v.*printf", "--blocklist-function", "v.*scanf", "--blocklist-function", "_v.*printf_r", "--blocklist-function", "_v.*scanf_r", "--blocklist-function", "esp_log_writev", "--no-layout-tests", "--with-derive-default", "--ctypes-prefix", "c_types", "--generate", "functions,types,vars,methods,constructors,destructors", "--use-core", "--no-rustfmt-bindings", "--", "-D__bindgen", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_pm/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-94df6151a6a52853/out/esp-idf/.pio/build/debug/config", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/newlib/platform_include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/freertos/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/freertos/port/xtensa/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_hw_support/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_hw_support/port/esp32/.", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/heap/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/log/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/lwip/include/apps", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/lwip/include/apps/sntp", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/lwip/lwip/src/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/lwip/port/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/lwip/port/esp32/include/arch", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/soc/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/soc/esp32/.", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/soc/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/hal/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/hal/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_rom/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_rom/esp32", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_rom/include/esp32", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_common/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_system/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/driver/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/driver/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_ringbuf/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/efuse/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/efuse/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/xtensa/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/xtensa/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/espcoredump/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_timer/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_ipc/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/vfs/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_wifi/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_wifi/esp32/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_event/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_netif/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_eth/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/tcpip_adapter/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/app_trace/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/mbedtls/port/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/mbedtls/mbedtls/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/mbedtls/esp_crt_bundle/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/app_update/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/spi_flash/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/bootloader_support/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/nvs_flash/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/pthread/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_gdbstub/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_gdbstub/xtensa", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_gdbstub/esp32", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/wpa_supplicant/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/wpa_supplicant/port/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/wpa_supplicant/include/esp_supplicant", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/perfmon/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/asio/asio/asio/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/asio/port/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/cbor/port/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/unity/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/unity/unity/src", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/cmock/CMock/src", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/coap/port/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/coap/port/include/coap", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/coap/libcoap/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/coap/libcoap/include/coap2", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/console", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/nghttp/port/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/nghttp/nghttp2/lib/includes", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp-tls", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp-tls/esp-tls-crypto", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_adc_cal/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_hid/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/tcp_transport/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_http_client/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_http_server/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_https_ota/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/protobuf-c/protobuf-c", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/protocomm/include/common", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/protocomm/include/security", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/protocomm/include/transports", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/mdns/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_local_ctrl/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/sdmmc/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_serial_slave_link/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/esp_websocket_client/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/expat/expat/expat/lib", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/expat/port/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/wear_levelling/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/fatfs/diskio", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/fatfs/vfs", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/fatfs/src", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/freemodbus/common/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/idf_test/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/idf_test/include/esp32", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/jsmn/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/json/cJSON", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/libsodium/libsodium/src/libsodium/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/libsodium/port_include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/mqtt/esp-mqtt/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/openssl/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/spiffs/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/ulp/include", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/framework-espidf/components/wifi_provisioning/include", "-DESP_IDF_COMP_PTHREAD_ENABLED", "-DESP_IDF_COMP_NVS_FLASH_ENABLED", "-DESP_IDF_COMP_ESP_TLS_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_CLIENT_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_SERVER_ENABLED", "-DESP_IDF_COMP_ESPCOREDUMP_ENABLED", "-DESP_IDF_COMP_APP_UPDATE_ENABLED", "-DESP_IDF_COMP_ESP_SERIAL_SLAVE_LINK_ENABLED", "-DESP_IDF_COMP_SPI_FLASH_ENABLED", "-DESP_IDF_COMP_ESP_ADC_CAL_ENABLED", "-DESP_IDF_COMP_MQTT_ENABLED", "--sysroot=/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/toolchain-xtensa-esp32/bin/../xtensa-esp32-elf", "-I/n/autobuild/eliduprees-emg-mouse/build/emg-server/.embuild/platformio/packages/toolchain-xtensa-esp32/bin/../xtensa-esp32-elf/include", "-x", "c", "-DESP_IDF_COMP_PTHREAD_ENABLED", "-DESP_IDF_COMP_NVS_FLASH_ENABLED", "-DESP_IDF_COMP_ESP_TLS_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_CLIENT_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_SERVER_ENABLED", "-DESP_IDF_COMP_ESPCOREDUMP_ENABLED", "-DESP_IDF_COMP_APP_UPDATE_ENABLED", "-DESP_IDF_COMP_ESP_SERIAL_SLAVE_LINK_ENABLED", "-DESP_IDF_COMP_SPI_FLASH_ENABLED", "-DESP_IDF_COMP_ESP_ADC_CAL_ENABLED", "-DESP_IDF_COMP_MQTT_ENABLED", "-target", "xtensa"]
  thread 'main' panicked at 'libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  - Host vs. target architecture mismatch
  If you encounter an error missing from this list, please file an issue or a PR!', /n/HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/ir/context.rs:538:15
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

GPIO pins receive current during deep sleep

Running the code below keeps the led on during the deep sleep, which is different from what I've experienced using the Arduino libs.
Afaik unless gpio_hold_en(gpio_num_t gpio_num) is called alongside gpio_deep_sleep_hold_en(), the pin should go back to low during deep sleep.

Chip type:         ESP32 (revision 1)
Crystal frequency: 40MHz
Flash size:        4MB
Features:          WiFi, BT, Dual Core, Coding Scheme None
[dependencies]
anyhow = { version = "1.0", features = ["backtrace"] }
esp-idf-hal = "0.31"
esp-idf-sys = { version = "0.29", features = ["binstart", "native"] }
use anyhow::Context;
use esp_idf_hal::delay;
use esp_idf_hal::prelude::*;

fn main() -> anyhow::Result<()> {
    esp_idf_sys::link_patches();

    let peripherals = Peripherals::take().context("failed to get peripherals")?;
    let pins = peripherals.pins;

    let mut led = pins.gpio25.into_output_od()?;
    led.set_high()?;

    let mut delay = delay::Ets;
    delay.delay_ms(3000_u32);

    println!("going to sleep...");
    unsafe {
        esp_idf_sys::esp_sleep_enable_timer_wakeup(30 * 1_000_000u64);
        esp_idf_sys::esp_deep_sleep_start();
    }

    Ok(())
}

Unable to build with latest ESP-IDF due to pthread_rwlock

It seems that ESP-IDF commit espressif/esp-idf@b117bcd, has broken compilation on both ESP-IDF master and release/v4.4 branches, resulting in the below error:

  = note: Running ldproxy
          Error: Linker /home/user/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc failed: exit status: 1
          STDERR OUTPUT:
          /home/user/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in function `pthread_rwlock_init':
          /home/user/.espressif/esp-idf-master/components/pthread/pthread_rwlock.c:51: multiple definition of `pthread_rwlock_init'; /home/user/projects/rust-esp32-std-demo/target/xtensa-esp32s3-espidf/release/deps/libesp_idf_sys-033449d0383ac0dd.rlib(esp_idf_sys-033449d0383ac0dd.esp_idf_sys.208449cf-cgu.8.rcgu.o):/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.24.4/src/pthread_rwlock.rs:15: first defined here
          /home/user/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in function `pthread_rwlock_destroy':
          /home/user/.espressif/esp-idf-master/components/pthread/pthread_rwlock.c:103: multiple definition of `pthread_rwlock_destroy'; /home/user/projects/rust-esp32-std-demo/target/xtensa-esp32s3-espidf/release/deps/libesp_idf_sys-033449d0383ac0dd.rlib(esp_idf_sys-033449d0383ac0dd.esp_idf_sys.208449cf-cgu.8.rcgu.o):/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.24.4/src/pthread_rwlock.rs:54: first defined here
          /home/user/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in function `pthread_rwlock_rdlock':
          /home/user/.espressif/esp-idf-master/components/pthread/pthread_rwlock.c:162: multiple definition of `pthread_rwlock_rdlock'; /home/user/projects/rust-esp32-std-demo/target/xtensa-esp32s3-espidf/release/deps/libesp_idf_sys-033449d0383ac0dd.rlib(esp_idf_sys-033449d0383ac0dd.esp_idf_sys.208449cf-cgu.8.rcgu.o):/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.24.4/src/pthread_rwlock.rs:24: first defined here
          /home/user/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in function `pthread_rwlock_wrlock':
          /home/user/.espressif/esp-idf-master/components/pthread/pthread_rwlock.c:195: multiple definition of `pthread_rwlock_wrlock'; /home/user/projects/rust-esp32-std-demo/target/xtensa-esp32s3-espidf/release/deps/libesp_idf_sys-033449d0383ac0dd.rlib(esp_idf_sys-033449d0383ac0dd.esp_idf_sys.208449cf-cgu.8.rcgu.o):/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.24.4/src/pthread_rwlock.rs:36: first defined here
          /home/user/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in function `pthread_rwlock_unlock':
          /home/user/.espressif/esp-idf-master/components/pthread/pthread_rwlock.c:223: multiple definition of `pthread_rwlock_unlock'; /home/user/projects/rust-esp32-std-demo/target/xtensa-esp32s3-espidf/release/deps/libesp_idf_sys-033449d0383ac0dd.rlib(esp_idf_sys-033449d0383ac0dd.esp_idf_sys.208449cf-cgu.8.rcgu.o):/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.24.4/src/pthread_rwlock.rs:48: first defined here
          collect2: error: ld returned 1 exit status



error: could not compile `rust-esp32-std-demo` due to previous error

Reverting to the previous before the above commit, ie espressif/esp-idf@cd97e95 on the release/v4.4 branch, results in a successful build.

Building with latest commit to fix ESP32-S3 DAC error results in failed build

Building rust-esp32-std-demo for the ESP32-S3 fails to build.
On commit "b28d5454adc620b57b7021291056eca60315d3ed", the latest at time of writing I get the following error:

error[E0412]: cannot find type `dac_channel_t` in this scope
     --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-hal-0.23.2/src/gpio.rs:75:25
      |
75    |     fn dac_channel() -> dac_channel_t;
      |                         ^^^^^^^^^^^^^ help: a type alias with a similar name exists: `adc_channel_t`
      |
     ::: /home/user/rust-esp32-std-demo/target/xtensa-esp32s3-espidf/release/build/esp-idf-sys-d57948dc3e50df5e/out/bindings.rs:28769:1
      |
28769 | pub type adc_channel_t = c_types::c_uint;
      | ----------------------------------------- similarly named type alias `adc_channel_t` defined here

For more information about this error, try `rustc --explain E0412`.
error: could not compile `esp-idf-hal` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

On the previous commit "090311018dbbb0edc2efc8578c089edf4d59b10d", I get the following error:

  /home/user/.espressif/esp-idf-master/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:627:20: warning: section does not match previous declaration [-Wsection]
  /home/user/.espressif/esp-idf-master/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:356:20: note: previous attribute is here
  /home/user/.espressif/esp-idf-master/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:646:26: warning: section does not match previous declaration [-Wsection]
  /home/user/.espressif/esp-idf-master/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:398:26: note: previous attribute is here
  /home/user/.cargo/git/checkouts/esp-idf-sys-d4c2e811b42d99d6/0903110/src/include/esp-idf/bindings.h:65:10: fatal error: 'driver/dac.h' file not found
  /home/user/.espressif/esp-idf-master/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:627:20: warning: section does not match previous declaration [-Wsection], err: false
  /home/user/.espressif/esp-idf-master/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:646:26: warning: section does not match previous declaration [-Wsection], err: false
  /home/user/.cargo/git/checkouts/esp-idf-sys-d4c2e811b42d99d6/0903110/src/include/esp-idf/bindings.h:65:10: fatal error: 'driver/dac.h' file not found, err: true

I realise the latest commit is supposed to fix it, however I cannot build the latest. As a work around I have edited 'src/include/esp-idf/bindings.h' of commit "090311018dbbb0edc2efc8578c089edf4d59b10d", and modified line 65 to say '#include "driver/dac_common.h"' instead of the following as a hacky workaround.

#include "driver/dac.h"

From then on I am able to build and flash the project to my ESP32-S3 Dev Board successfully.

Use tags to mark crate release versions

Is it possible/reasonable to tag versions of the esp-idf-sys crate that are released to crates.io? I'm hoping to see at a glance what the source is for different crate versions. Tags seem like a natural approach for this.

thread::sleep(Duration::from_millis(1) causes WDT timeout

Tried on ESP32.

esp-idf-sys = { version = "0.30.4", features = ["binstart"] }
thread::Builder::new()
        .name("read".to_string())
        .stack_size(8192)
        .spawn(move || loop {
            // tried also with 5
            std::thread::sleep(Duration::from_millis(1));
        })
        .unwrap();
E (5325) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (5325) task_wdt:  - IDLE (CPU 1)
E (5325) task_wdt: Tasks currently running:
E (5325) task_wdt: CPU 0: IDLE
E (5325) task_wdt: CPU 1: pthread
E (5325) task_wdt: Print CPU 0 (current core) backtrace
Backtrace:0x400F7580:0x3FFB0710 0x40082121:0x3FFB0730 0x400F8C97:0x3FFB7D20 0x400F732F:0x3FFB7D40 0x400880CA:0x3FFB7D60 0x4008A095:0x3FFB7D80
E (5325) task_wdt: Print CPU 1 backtrace
Backtrace:0x400840F9:0x3FFB0D10 0x40082121:0x3FFB0D30 0x40008544:0x3FFBF5B0 0x400E6E02:0x3FFBF5D0 0x400D6166:0x3FFBF5F0 0x400D6A38:0x3FFBF630 0x400D3079:0x3FFBF650 0x400D2E02:0x3FFBF670 0x400D34AF:0x3FFBF690 0x400D6353:0x3FFBF6C0 0x400D637A:0x3FFBF6E0 0x400D60DC:0x3FFBF700 0x400E7468:0x3FFBF720 0x4008A095:0x3FFBF740

Works OK with:

std::thread::sleep(Duration::from_millis(10));

Error building esp-idf-sys 0.16.4

When I try to build a project with esp-idf-sys 0.16.4 I get the following error:

Compiling esp-idf-sys v0.16.4
error: failed to run custom build command for esp-idf-sys v0.16.4

Caused by:
process didn't exit successfully: /home/david/src/ESP32/AcrRust/target/debug/build/esp-idf-sys-2326459d2b7cd194/build-script-build (exit status: 1)
--- stdout
Found compatible PlatformIO Core 5.1.1 -> /home/david/.platformio/penv/bin/platformio

--- stderr
Error: Cannot derive default PIO platform, MCU and frameworks for target 'x86_64-unknown-linux-gnu'

This is on a linux (Debian) system, amd64

Support using ESP-IDF from the IDF_PATH variable

If the user has defined an IDF_PATH environment variable, the native build should use the ESP-IDF framework designated by that environment variable, rather than cloning and using a separate ESP-IDF GIT repo.

More details:

  • (Relevant for ESP-IDF versions 4.3.X which do require patching): This ESP-IDF instance should be considered "unmanaged" and should not be patched. It would be assumed, that the user has done that, possibly by providing an ESP-IDF fork which has all the Rust patches applied
  • Related to #36 : in addition to having IDF_PATH defined, the user may or may not have the tooling of that particular ESP-IDF instance install.sh-ed and export.sh-ed:
    • If the tooling is already installed and exported by the user (can be detected by e.g. checking if idf.py is on $PATH), the native builder should not install any additional tooling, setup Python virtual env and so on. It should assume, that the necessary tooling is already on the path (scope of #36 actually, which turns out to be a sub-task of this one)
    • If the tooling is not found on the $PATH, the installer should try to install it, based on the ESP-IDF instance pointed to by the IDF_PATH variable, and then proceed with setting up a virtual Python environment specifically for the build and so on.

External components discussion

Getting esp-idf-sys to build external components is relatively simple, I have PoC locally building esp-rainmaker. The hard part is how we tell esp-idf-sys where these external components are and what includes we need. Essentially the inter-crate communication.

It seems there is no way (unless I'm missing something, and I hope I am because it would make this really easy) in cargo to set environment variables for dependent crates; therefore a separate crate that depends on esp-idf-sys is out of the question because we can't give esp-idf-sys the information it needs to build these external components.

Option 1 - env variables in the final application

We already set custom variables to dictate the build, added something like ESP_IDF_EXTRA_COMPONENT_PATHS could work. The downside to this is that its yet another thing a user has to remember to include, and if its the case we have a separate wrapper crate for some external components we will get weird missing item errors when we try and build that crate if we forget to add our extra component variable

Option 2 - esp-idf-sys becomes monolithic

Instead of being able to customize the build process, the way to add new components would be to add them at the source level in esp-idf-sys. esp-idf-sys will then take care of downloading the external component and adding it into its normal build process. To save build time, it might be a good idea to put these external components behind feature flags.

There may be better options I haven't considered, I won't lie I'm not an expert in esp-idf-sys's build system hence why I am opening this ๐Ÿ˜….

Cannot find bluedroid functions

I've created a project with esp-idf-template, added

CONFIG_BT_ENABLED=y
CONFIG_BT_BLUEDROID_ENABLED=y

to sdkconfig.defaults and stared to follow official esp-idf tutorial.

Unfortunately after implementing part of some of the functions were missing. Currently I see 3 of them: esp_bluedroid_init, esp_bluedroid_enable and esp_ble_gatts_register_callback. But when I searched generated bindings.rs file for "bluedroid" it found nothing despite some mentions in the comments.

I searched for the c header files in the embuild folder. I don't remember exactly were I found them, but every file I looked at was exactly the same as those in the esp-idf repository and contained all the functions that bindings.rs was missing.

Here is the function I was writing:

unsafe fn unsafe_init() {
    esp_idf_sys::nvs_flash_init();
    esp_idf_sys::esp_bt_controller_init(&mut Default::default());
    esp_idf_sys::esp_bt_controller_enable(esp_idf_sys::esp_bt_mode_t_ESP_BT_MODE_BLE);
    esp_idf_sys::esp_bluedroid_init();
    esp_idf_sys::esp_bluedroid_enable();
    esp_idf_sys::esp_ble_gatts_register_callback();
}

No binding for efuse?

Hi, I was just looking around for a binding for the efuse manager api that I can find in esp_idf.

How come this is not added currently?

Compile only needed esp-idf components

Currently, when compiling the esp-idf all components are compiled by cmake, but only for select components the bindings are generated (everything that is included in src/include/esp-idf/bindings.h). That is currently around 1k C-files, which @igrr estimated could be brought down to around 600.
This behavior is not that detrimental as recompiling the esp-idf is normally rare (e.g. on first build, after clean). (There is also currently a bug where changing the sdkconfig/sdkconfig.defaults does not cause an esp-idf recompilation.)
However, when frequently changing the sdkconfigs or switing MCU, etc. and especially for CI such an improvement would be nice indeed.

To fix this we need to pass a list of components to cmake so that it knows specifically which components to build. As a first approach, we can disable building all components for which no bindings are generated (I don't how many that is, though).

In the long term though, we should make this configurable (maybe with an approach like I suggested in #72) as the demand for more and more esp-idf components grows.

Building in workspace, the .embuild folder is placed outside of the workspace dir

i'm trying to set up a Cargo workspace to build both Xtensa and RISC-V binaries for the ESP32-S2.

the setup is:

  • Workspace located at /opt/esp32-workspace
  • Binary crates at /opt/esp32-workspace/main and /opt/esp32-workspace/ulp

when I build from /opt/esp32-workspace, the embuild folder is created at /opt/.embuild, e.g. outside of the workspace.

for example building from:

  • /opt/esp32-workspace
  • /opt/.embuild is created

but when building from:

  • /opt/esp32-workspace/main (or any subdir)
  • /opt/esp32-workspace/.embuild is created

note also that this only happens when ESP_IDF_TOOLS_INSTALL_DIR is set to workspace or custom:./.embuild. the issue is fixed by using out, or an absolute path.

apologies if this is the wrong place to post this bug report!

deep_sleep timing

Hi,
when calling

esp_idf_sys::esp_sleep_enable_timer_wakeup(1_000_000u64);
esp_idf_sys::esp_deep_sleep_start(); 

the system goes to sleep but wakes up after approximately 5 seconds. I would have expected 1 second. The same holds for directly calling esp_idf_sys::esp_deep_sleep(1_000_000u64); . Is there anything else I have to configure?

Cargo-first build story with "pure" ESP-IDF tooling

I was looking at what it would take to replace (or have it as an additional option) the existing PlatformIO-based cargo-first build with a "native" esp-idf-tooling based cargo-first build.

Scope & Requirements

This is for now only for "Cargo-first" builds. I.e.:

  • The target audience consists of folks who would like to stay in "pure Rust" land
  • Use only Rust crates (the ones we provide here + commonly available)
  • Use Cargo as the one and only build tool (that's on the surface of course, but that's what they see and care about)
  • The firmware should be built as a standard Rust binary crate (with a main() function et. all) and not as a static library which is a better option for CMake/PlatformIO-first builds which are out of scope here
  • If - during the building of this esp-idf-sys crate (which is somehow the representation of ESP-IDF in Rust-land) - Cargo is invoking or even downloading other tools, like the Espressif toolchains, or CMake or Python - this is completely hidden from the user (unless the user wants to opt-in with their own ESP IDF SDK dir and/or .espressif toolchain dir).
  • The compilation of the ESP-IDF SDK itself is also completely transparent
  • No PATH alterations required before invoking Cargo
  • No special environment variables required (e.g. ESP-IDF) before invoking Cargo
  • Minimum prerequisites that the user has to install up-front (ideally, only Python3)

This story is currently implemented by utilizing the PlatformIO build capabilities.

Why ESP-IDF native toolchain?

  • Possibility to build and use the ESP-IDF master branch (PlatformIO only supports the last stable one)
  • Possibility to build and use older ESP-IDF releases (PlatformIO seems to support building e.g. ESP-IDF V4.2, but not sure for earlier ones - might require older versions of PlatformIO itself, whichis too big of a hack)
  • Create an "ESP8266" story with the "ESP-IDF-like" ESP8266 SDK. Maybe even with libstd support. Not supported by PlatformIO.
  • Faster build times (hopefully)

Assessment

The install.sh script available in the root of the ESP-IDF repository might be a very good start, fulfilling most (but maybe not all) of the above requirements:
(+) A thin wrapper over Python-based tooling in tools/
(+) Creates Python virtual envs and does not pollute the user's main Python environment (right?)
(+) Downloads all toolchains automatically
(+) Older and newer ESP-IDFs can co-exist (have separate python virtual envs)
(?) Can I use it on Windows without the "Windows installer" stuff?
(-) Some tooling besides Python still required on the PC of the user (cmake, ninja). PIO downloads this stuff too
(-) Grabbing the PATH requires running . ./export.sh. Can I do this with pure Python scripts?
(-) PowerShell necessary on Windows. Can I do everything with only Python scripts?

Harder stuff

How the esp-idf-sys works is that it essentially builds a hidden ESP-IDF "mini" project, which only contains a stubbed app_main function.

It then grabs all the artefacts of this build, namely:

  • (a) All ESP-IDF include directories -> needed for Bindgen so that we get unsafe bindings to various ESP-IDF APIs which are not mapped in Rust libstd and which are used by type-safe crates like esp-idf-hal and esp-idf-svc
  • (b) All ESP-IDF link artefacts: static libraries + linker scripts + linker flags and passes them up to the user's top-level binary crate, which is passing these to the Rust linker (which is whatever the rust target triple says - for our case - the linker from the relevant Espressif toolchain), together with the Rust libraries generated by pure Rust crates

So the question is: is there an easy way to "interrogate" the CMake build system, so that I can get (a) and (b)? With PlatformIO, I'm making use of Scons Construction Variables which provide all of this.

I'm sure there's a way to do this with CMake (or idf.py) too, I just don't know it yet. Any hints?

If we can solve (a) and (b), the rest is a breeze.

thread::yield_now() does not yield

This causes WDT timeout on ESP32.

thread::Builder::new()
    .name("yield".to_string())
    .spawn(move || loop { 
        std::thread::yield_now();

        // also does not work
        // unsafe { esp_idf_sys::vTaskDelay(0) };

        // but this works
        // unsafe { esp_idf_sys::vTaskDelay(1) };
    })
    .unwrap();

It is somewhat related to #66

Error when building on Linux aarch64

Hello,

When trying to build on Linux aarch64 (Raspberry pi 4) I got the following error:

error: failed to run custom build command for `esp-idf-sys v0.20.0`

Caused by:
  process didn't exit successfully: `/home/ubuntu/rust-esp32-std-hello/target/debug/build/esp-idf-sys-791a8c4daff86dfa/build-script-build` (exit status: 1)
  --- stdout
  Found compatible PlatformIO Core 5.2.0 -> /home/ubuntu/.platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/ping_setsockopt_fix.diff
  cargo:rerun-if-changed=./patches/master_missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=/home/ubuntu/rust-esp32-std-hello/./sdkconfig.defaults
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32cam; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Tool Manager: Installing platformio/toolchain-xtensa32 @ ~2.80400.0

  --- stderr
  Error: Could not find the package with 'platformio/toolchain-xtensa32 @ ~2.80400.0' requirements for your system 'linux_aarch64'
  Error: No such file or directory (os error 2)

Then:

$ pio platform install espressif32
Platform Manager: espressif32 @ 3.3.2 is already installed
Tool Manager: toolchain-xtensa32 @ 2.50200.97 is already installed
Tool Manager: tool-esptoolpy @ 1.30100.210531 is already installed
The platform 'espressif32' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.

So I successfully hacked my way by manually modifying platforms/espressif32/platform.py to require toolchain-xtensa32 @ 2.50200.97 instead of toolchain-xtensa32 @ 2.80400.0

But then I got the following error:

error: failed to run custom build command for `esp-idf-sys v0.20.0`

Caused by:
  process didn't exit successfully: `/home/ubuntu/rust-esp32-std-hello/target/debug/build/esp-idf-sys-791a8c4daff86dfa/build-script-build` (exit status: 1)
  --- stdout
  Found compatible PlatformIO Core 5.2.0 -> /home/ubuntu/.platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/ping_setsockopt_fix.diff
  cargo:rerun-if-changed=./patches/master_missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=/home/ubuntu/rust-esp32-std-hello/./sdkconfig.defaults
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32cam; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Tool Manager: Installing platformio/toolchain-esp32ulp @ ~1.22851.0

  --- stderr
  Error: Could not find the package with 'platformio/toolchain-esp32ulp @ ~1.22851.0' requirements for your system 'linux_aarch64'
  Error: No such file or directory (os error 2)
$ pio platform install toolchain-esp32ulp
Platform Manager: Installing toolchain-esp32ulp
Error: Could not find the package with 'toolchain-esp32ulp' requirements for your system 'linux_aarch64'

And can't find a solution for this error.

Any idea?

Tracking issue to use native build strategy as default

This issue tries to list everything that has to be done for us to switch to the native esp-idf build strategy.

  • #11
    • Currently native uses <workspace-dir>/.espressif and pio uses the platformio default.
  • #12
    • Cannot be done using idf_tools.py as that version is outdated
    • Need at least version 3.20 with cmake-file-api toolchains object or 3.14 without.
  • Decide whether python3 should remain a user requirement (#18)
  • Decide whether we should switch away from idf_tools.py and roll our own install logic. (see #10 (comment))
    • It would give us more freedom.
    • Removes dependency on idf_tools.py.
    • We need some install logic for cmake anyway.
    • idf_tools.py requires workaround for windows when using msys or git-bash.
  • #38
  • esp-rs/embuild#32
  • esp-rs/embuild#16

Using Instant::now() blocks thread

On ESP32.

use esp_idf_sys::*;
use std::time::{Duration, Instant};

fn main() {
    // Temporary. Will disappear once ESP-IDF 4.4 is released, but for now it is necessary to call this function once,
    // or else some patches to the runtime implemented by esp-idf-sys might not link properly.
    esp_idf_sys::link_patches();

    if let Err(_e) = esp!(unsafe { esp_task_wdt_delete(xTaskGetIdleTaskHandleForCPU(0)) }) {
        panic!("cannot stop twdt 0");
    }
    if let Err(_e) = esp!(unsafe { esp_task_wdt_delete(xTaskGetIdleTaskHandleForCPU(1)) }) {
        panic!("cannot stop twdt 1");
    }

    std::thread::Builder::new()
        .name("thread 0".to_string())
        .stack_size(16384)
        .spawn(move || {
            let mut t = Instant::now();
            loop {
                std::thread::sleep(Duration::from_millis(2));
                //unsafe { esp_idf_sys::vTaskDelay(1) };
                if Instant::now() - t > Duration::from_millis(1000) {
                    t = Instant::now();
                    //println!("{:?} thread 0", t);
                    println!("thread 0");
                }
            }
        })
        .unwrap();

    std::thread::Builder::new()
        .name("thread 1".to_string())
        .stack_size(16384)
        .spawn(move || {
            let mut t = Instant::now();
            loop {
                std::thread::sleep(Duration::from_millis(2));
                //unsafe { esp_idf_sys::vTaskDelay(1) };
                if Instant::now() - t > Duration::from_millis(1000) {
                    t = Instant::now();
                    //println!("{:?} thread 1", t);
                    println!("thread 1");
                }
            }
        })
        .unwrap();

    println!("Hello, world!");
}

With println!("thread 0"); etc it prints:

thread 0
thread 1
thread 1
thread 0
thread 1
thread 0

With println!("{:?} thread 0", t); etc it prints:

Instant { tv_sec: 1, tv_nsec: 91379000 } thread 0
Instant { tv_sec: 2, tv_nsec: 93091000 } thread 0
Instant { tv_sec: 3, tv_nsec: 94130000 } thread 0
Instant { tv_sec: 4, tv_nsec: 95166000 } thread 0
Instant { tv_sec: 5, tv_nsec: 96238000 } thread 0
Instant { tv_sec: 6, tv_nsec: 97318000 } thread 0
Instant { tv_sec: 7, tv_nsec: 98390000 } thread 0

Notice that thread 1 is completely missing.

Docs do not build on docs.rs

The docs do not build on docs.rs

build log

# rustc version
rustc 1.57.0-nightly (5ecc8ad84 2021-09-19)
# docs.rs version
docsrs 0.6.0 (432e30a 2021-09-12)

# build log
[INFO] running `Command { std: "docker" "create" "-v" "/home/cratesfyi/workspace/builds/esp-idf-svc-0.20.1/target:/opt/rustwide/target:rw,Z" "-v" "/home/cratesfyi/workspace/builds/esp-idf-svc-0.20.1/source:/opt/rustwide/workdir:ro,Z" "-v" "/home/cratesfyi/workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/home/cratesfyi/workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "DOCS_RS=1" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "3221225472" "--cpus" "2" "--user" "1001:1001" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:a89201d6b5b9fd45c15d5952ece0a0129e7e80cb26ec023fd59cf09bc26f1604" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "rustdoc" "--lib" "-Zrustdoc-map" "-Zunstable-options" "--config=doc.extern-map.registries.crates-io=\"https://docs.rs/{pkg_name}/{version}/x86_64-unknown-linux-gnu\"" "-j2" "--" "-Z" "unstable-options" "--emit=invocation-specific" "--resource-suffix" "-20210919-1.57.0-nightly-5ecc8ad84" "--static-root-path" "/" "--cap-lints" "warn" "--disable-per-crate-search", kill_on_drop: false }`
[INFO] [stdout] f9c12e04431be89cc02118eae1b9c9eee59977444a9b61c055ef566694544387
[INFO] [stderr] WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
[INFO] running `Command { std: "docker" "start" "-a" "f9c12e04431be89cc02118eae1b9c9eee59977444a9b61c055ef566694544387", kill_on_drop: false }`
[INFO] [stderr]    Compiling esp-idf-sys v0.20.0
[INFO] [stderr] error: failed to run custom build command for `esp-idf-sys v0.20.0`
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/target/debug/build/esp-idf-sys-a2bf8941e6b245cc/build-script-build` (exit status: 1)
[INFO] [stderr]   --- stdout
[INFO] [stderr]   Installer version: 1.0.2
[INFO] [stderr]   Platform: Linux-5.4.0-1037-aws-x86_64-with-glibc2.29
[INFO] [stderr]   Python version: 3.8.10 (default, Jun  2 2021, 10:49:15) 
[INFO] [stderr]   [GCC 9.4.0]
[INFO] [stderr]   Python path: /usr/bin/python3
[INFO] [stderr]   Creating a virtual environment at /.platformio/penv
[INFO] [stderr]   /usr/bin/python3
[INFO] [stderr] 
[INFO] [stderr]   --- stderr
[INFO] [stderr]   Error: Compatible PlatformIO Core not found.
[INFO] [stderr]   Reason: PlatformIO executable not found in `/.platformio/penv/bin`
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/connection.py", line 169, in _new_conn
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/util/connection.py", line 73, in create_connection
[INFO] [stderr]     File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
[INFO] [stderr]       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
[INFO] [stderr]   socket.gaierror: [Errno -3] Temporary failure in name resolution
[INFO] [stderr] 
[INFO] [stderr]   During handling of the above exception, another exception occurred:
[INFO] [stderr] 
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/connectionpool.py", line 699, in urlopen
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/connectionpool.py", line 382, in _make_request
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/connectionpool.py", line 1010, in _validate_conn
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/connection.py", line 353, in connect
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/connection.py", line 181, in _new_conn
[INFO] [stderr]   urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f96e5f5b340>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution
[INFO] [stderr] 
[INFO] [stderr]   During handling of the above exception, another exception occurred:
[INFO] [stderr] 
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/requests/adapters.py", line 439, in send
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/connectionpool.py", line 755, in urlopen
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/urllib3/util/retry.py", line 574, in increment
[INFO] [stderr]   urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.registry.platformio.org', port=443): Max retries exceeded with url: /v3/packages/platformio/tool/python-portable (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f96e5f5b340>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
[INFO] [stderr] 
[INFO] [stderr]   During handling of the above exception, another exception occurred:
[INFO] [stderr] 
[INFO] [stderr]   Traceback (most recent call last):
[INFO] [stderr]     File "/tmp/.tmpJjdIul", line 68, in <module>
[INFO] [stderr]       main()
[INFO] [stderr]     File "/tmp/.tmpJjdIul", line 60, in main
[INFO] [stderr]       bootstrap()
[INFO] [stderr]     File "/tmp/.tmpJjdIul", line 46, in bootstrap
[INFO] [stderr]       pioinstaller.__main__.main()
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/pioinstaller/__main__.py", line 131, in main
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/click/core.py", line 829, in __call__
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/click/core.py", line 782, in main
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/click/core.py", line 1236, in invoke
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/click/core.py", line 1066, in invoke
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/click/core.py", line 610, in invoke
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/click/decorators.py", line 21, in new_func
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/pioinstaller/__main__.py", line 61, in cli
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/pioinstaller/core.py", line 67, in install_platformio_core
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/pioinstaller/core.py", line 95, in _install_platformio_core
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/pioinstaller/penv.py", line 58, in create_core_penv
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/pioinstaller/python.py", line 70, in fetch_portable_python
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/pioinstaller/python.py", line 97, in get_portable_python_url
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/requests/api.py", line 76, in get
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/requests/api.py", line 61, in request
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/requests/sessions.py", line 542, in request
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/requests/sessions.py", line 655, in send
[INFO] [stderr]     File "/tmp/.piocore-installer-pq16kjv6/tmphidq62b1/pioinstaller.zip/requests/adapters.py", line 516, in send
[INFO] [stderr]   requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.registry.platformio.org', port=443): Max retries exceeded with url: /v3/packages/platformio/tool/python-portable (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f96e5f5b340>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
[INFO] [stderr]   Error: Compatible PlatformIO Core not found.
[INFO] [stderr]   Reason: PlatformIO executable not found in `/.platformio/penv/bin`
[INFO] [stderr]   Error: EOF while parsing a value at line 1 column 0
[INFO] running `Command { std: "docker" "inspect" "f9c12e04431be89cc02118eae1b9c9eee59977444a9b61c055ef566694544387", kill_on_drop: false }`
[INFO] running `Command { std: "docker" "rm" "-f" "f9c12e04431be89cc02118eae1b9c9eee59977444a9b61c055ef566694544387", kill_on_drop: false }`
[INFO] [stdout] f9c12e04431be89cc02118eae1b9c9eee59977444a9b61c055ef566694544387

It seems that the docs.rs build environment does not have a networking stack available, so the platformio installation script fails. Is there any way to provide fallback information in the build.rs script so that the docs can be built without networking?

Failure to build with the Espressif-built compiler

Iโ€™m trying to build rust-esp32-std-hello using the pre-compiled compiler I installed according to this guide. (I have previously built the compiler myself, but I wanted to cut the installation time by a couple of hours this time.)

Iโ€™m using rustup to manage toolchains. Having set the local override to esp, Iโ€™m getting this output:

$ rustc --version
rustc 1.53.0-dev
$ rustc --print target-list | grep xtensa
xtensa-esp32-espidf
xtensa-esp32-none-elf
xtensa-esp32s2-espidf
xtensa-esp32s2-none-elf
xtensa-esp8266-none-elf
xtensa-none-elf

However, during the build, Iโ€™m getting this error:

$ cargo build
   Compiling esp-idf-sys v0.16.3
error: failed to run custom build command for `esp-idf-sys v0.16.3`

Caused by:
  process didn't exit successfully: `/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/debug/build/esp-idf-sys-e657db78e305d488/build-script-build` (exit status: 101)
  --- stdout
  Found compatible PlatformIO Core 5.1.1 -> /home/andrewsh/.platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/master_missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/esp32c3_atomics_emul.diff
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/master_restore_link_fragments_for_pio.diff
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32cam; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Verbose mode can be enabled via `-v, --verbose` option
  CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32cam.html
  PLATFORM: Espressif 32 (3.3.1) > AI Thinker ESP32-CAM
  HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
  DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
  PACKAGES: 
   - framework-espidf 3.40300.0 (4.3.0) 
   - tool-cmake 3.16.4 
   - tool-esptoolpy 1.30100.210531 (3.1.0) 
   - tool-ninja 1.7.1 
   - toolchain-esp32ulp 1.22851.191205 (2.28.51) 
   - toolchain-xtensa32 2.80400.210211 (8.4.0)
  Reading CMake configuration...
  LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
  LDF Modes: Finder ~ chain, Compatibility ~ soft
  Found 0 compatible libraries
  Scanning dependencies...
  No dependencies
  Building in debug mode
  Retrieving maximum program size .pio/build/debug/firmware.elf
  Checking size .pio/build/debug/firmware.elf
  Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
  RAM:   [          ]   3.8% (used 12596 bytes from 327680 bytes)
  Flash: [==        ]  15.4% (used 161793 bytes from 1048576 bytes)
  ========================= [SUCCESS] Took 11.51 seconds =========================

  Environment    Status    Duration
  -------------  --------  ------------
  debug          SUCCESS   00:00:11.507
  ========================= 1 succeeded in 00:00:11.507 =========================
  cargo:CARGO_PIO_LINK_ARGS=--cargo-pio-link-linker=/home/andrewsh/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc --cargo-pio-link-remove-duplicate-libs -L/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf -L/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug -L/home/andrewsh/.platformio/packages/framework-espidf/components/esp_wifi/lib/esp32 -L/home/andrewsh/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld -L/home/andrewsh/.platformio/packages/framework-espidf/components/xtensa/esp32 -L/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp32 -L/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp32/ld -L/home/andrewsh/.platformio/packages/framework-espidf/components/esp32/ld -Wl,--start-group /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_pm/libesp_pm.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/asio/libasio.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/cbor/libcbor.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/unity/libunity.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/cmock/libcmock.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/coap/libcoap.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/console/libconsole.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_adc_cal/libesp_adc_cal.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_hid/libesp_hid.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/protobuf-c/libprotobuf-c.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/protocomm/libprotocomm.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/mdns/libmdns.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_local_ctrl/libesp_local_ctrl.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_websocket_client/libesp_websocket_client.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/expat/libexpat.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/wear_levelling/libwear_levelling.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/fatfs/libfatfs.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/freemodbus/libfreemodbus.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/jsmn/libjsmn.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/json/libjson.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/libsodium/liblibsodium.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/mqtt/libmqtt.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/openssl/libopenssl.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/spiffs/libspiffs.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/wifi_provisioning/libwifi_provisioning.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/app_trace/libapp_trace.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/app_update/libapp_update.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/bootloader_support/libbootloader_support.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/cxx/libcxx.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/driver/libdriver.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/efuse/libefuse.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp-tls/libesp-tls.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp32/libesp32.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_common/libesp_common.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_eth/libesp_eth.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_event/libesp_event.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_gdbstub/libesp_gdbstub.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_http_client/libesp_http_client.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_http_server/libesp_http_server.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_https_ota/libesp_https_ota.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_hw_support/libesp_hw_support.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_ipc/libesp_ipc.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_netif/libesp_netif.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_ringbuf/libesp_ringbuf.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_rom/libesp_rom.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_serial_slave_link/libesp_serial_slave_link.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_system/libesp_system.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_timer/libesp_timer.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/esp_wifi/libesp_wifi.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/espcoredump/libespcoredump.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/freertos/libfreertos.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/hal/libhal.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/heap/libheap.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/log/liblog.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/lwip/liblwip.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/mbedtls/libmbedtls.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/newlib/libnewlib.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/nghttp/libnghttp.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/nvs_flash/libnvs_flash.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/perfmon/libperfmon.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/pthread/libpthread.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/sdmmc/libsdmmc.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/soc/libsoc.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/spi_flash/libspi_flash.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/tcp_transport/libtcp_transport.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/tcpip_adapter/libtcpip_adapter.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/ulp/libulp.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/vfs/libvfs.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/wpa_supplicant/libwpa_supplicant.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/xtensa/libxtensa.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/mbedtls/mbedtls/library/libmbedtls.a /home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf/mbedtls/mbedtls/library/libmbedx509.a -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lxt_hal -lm -lgcc -lstdc++ -lgcov -lc -Wl,--end-group -T esp32_out.ld -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u ld_include_panic_highint_hdl -u start_app -u start_app_other_cores -T esp32.rom.ld -T esp32.rom.api.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld -T esp32.rom.newlib-time.ld -u vfs_include_syscalls_impl -T esp32.project.ld -T esp32.peripherals.ld -u call_user_start_cpu0 -u app_main -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u __cxa_guard_dummy -u __cxx_fatal_exception -Wl,--Map=/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/esp-idf.map -Wl,--cref -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -Wl,--wrap=longjmp -Wl,--wrap=mbedtls_mpi_exp_mod -Wno-frame-address -fno-lto -fno-rtti -mlongcalls -Og -g2 -ggdb2
  cargo:CARGO_PIO_C_INCLUDE_ARGS=-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_pm/include -I/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/config -I/home/andrewsh/.platformio/packages/framework-espidf/components/newlib/platform_include -I/home/andrewsh/.platformio/packages/framework-espidf/components/freertos/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/freertos/port/xtensa/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hw_support/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hw_support/port/esp32/. -I/home/andrewsh/.platformio/packages/framework-espidf/components/heap/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/log/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/include/apps -I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/include/apps/sntp -I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/lwip/src/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/port/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/port/esp32/include/arch -I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/esp32/. -I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/hal/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/hal/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_rom/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_rom/esp32 -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_common/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_system/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/driver/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/driver/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_ringbuf/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/efuse/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/efuse/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/xtensa/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/xtensa/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/espcoredump/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_timer/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_ipc/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/vfs/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_wifi/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_wifi/esp32/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_event/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_netif/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_eth/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/tcpip_adapter/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/app_trace/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/port/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/mbedtls/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/esp_crt_bundle/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/app_update/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/spi_flash/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/bootloader_support/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/nvs_flash/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/pthread/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/xtensa -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/esp32 -I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/port/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/include/esp_supplicant -I/home/andrewsh/.platformio/packages/framework-espidf/components/perfmon/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/asio/asio/asio/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/asio/port/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/cbor/port/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/unity/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/unity/unity/src -I/home/andrewsh/.platformio/packages/framework-espidf/components/cmock/CMock/src -I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/port/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/port/include/coap -I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/libcoap/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/libcoap/include/coap2 -I/home/andrewsh/.platformio/packages/framework-espidf/components/console -I/home/andrewsh/.platformio/packages/framework-espidf/components/nghttp/port/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/nghttp/nghttp2/lib/includes -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp-tls -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp-tls/esp-tls-crypto -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_adc_cal/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hid/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/tcp_transport/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_http_client/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_http_server/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_https_ota/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/protobuf-c/protobuf-c -I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/common -I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/security -I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/transports -I/home/andrewsh/.platformio/packages/framework-espidf/components/mdns/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_local_ctrl/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/sdmmc/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_serial_slave_link/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_websocket_client/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/expat/expat/expat/lib -I/home/andrewsh/.platformio/packages/framework-espidf/components/expat/port/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/wear_levelling/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/diskio -I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/vfs -I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/src -I/home/andrewsh/.platformio/packages/framework-espidf/components/freemodbus/common/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/idf_test/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/idf_test/include/esp32 -I/home/andrewsh/.platformio/packages/framework-espidf/components/jsmn/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/json/cJSON -I/home/andrewsh/.platformio/packages/framework-espidf/components/libsodium/libsodium/src/libsodium/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/libsodium/port_include -I/home/andrewsh/.platformio/packages/framework-espidf/components/mqtt/esp-mqtt/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/openssl/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/spiffs/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/ulp/include -I/home/andrewsh/.platformio/packages/framework-espidf/components/wifi_provisioning/include
  cargo:rustc-cfg=esp32
  cargo:MCU=esp32
  cargo:rerun-if-changed=src/include/esp-idf/bindings.h

  --- stderr
  Bindgen builder factory flags: ["--rust-target", "1.40", "--no-layout-tests", "--with-derive-default", "--generate", "functions,types,vars,methods,constructors,destructors", "--use-core", "--no-rustfmt-bindings", "--", "-D__bindgen", "--sysroot=/home/andrewsh/.platformio/packages/toolchain-xtensa32/bin/../xtensa-esp32-elf", "-I/home/andrewsh/.platformio/packages/toolchain-xtensa32/bin/../xtensa-esp32-elf/include", "-x", "c", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_pm/include", "-I/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/config", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/newlib/platform_include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/freertos/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/freertos/port/xtensa/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hw_support/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hw_support/port/esp32/.", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/heap/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/log/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/include/apps", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/include/apps/sntp", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/lwip/src/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/port/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/port/esp32/include/arch", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/esp32/.", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/hal/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/hal/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_rom/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_rom/esp32", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_common/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_system/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/driver/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/driver/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_ringbuf/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/efuse/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/efuse/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/xtensa/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/xtensa/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/espcoredump/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_timer/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_ipc/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/vfs/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_wifi/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_wifi/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_event/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_netif/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_eth/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/tcpip_adapter/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/app_trace/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/mbedtls/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/esp_crt_bundle/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/app_update/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/spi_flash/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/bootloader_support/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/nvs_flash/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/pthread/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/xtensa", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/esp32", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/include/esp_supplicant", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/perfmon/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/asio/asio/asio/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/asio/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/cbor/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/unity/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/unity/unity/src", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/cmock/CMock/src", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/port/include/coap", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/libcoap/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/libcoap/include/coap2", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/console", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/nghttp/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/nghttp/nghttp2/lib/includes", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp-tls", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp-tls/esp-tls-crypto", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_adc_cal/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hid/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/tcp_transport/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_http_client/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_http_server/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_https_ota/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protobuf-c/protobuf-c", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/common", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/security", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/transports", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mdns/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_local_ctrl/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/sdmmc/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_serial_slave_link/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_websocket_client/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/expat/expat/expat/lib", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/expat/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wear_levelling/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/diskio", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/vfs", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/src", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/freemodbus/common/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/idf_test/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/idf_test/include/esp32", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/jsmn/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/json/cJSON", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/libsodium/libsodium/src/libsodium/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/libsodium/port_include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mqtt/esp-mqtt/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/openssl/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/spiffs/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/ulp/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wifi_provisioning/include"]
  Output: "/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/bindings.rs"
  Bindgen builder flags: ["src/include/esp-idf/bindings.h", "--rust-target", "1.40", "--blacklist-function", "strtold", "--blacklist-function", "_strtold_r", "--no-layout-tests", "--with-derive-default", "--ctypes-prefix", "c_types", "--generate", "functions,types,vars,methods,constructors,destructors", "--use-core", "--no-rustfmt-bindings", "--", "-D__bindgen", "--sysroot=/home/andrewsh/.platformio/packages/toolchain-xtensa32/bin/../xtensa-esp32-elf", "-I/home/andrewsh/.platformio/packages/toolchain-xtensa32/bin/../xtensa-esp32-elf/include", "-x", "c", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_pm/include", "-I/home/andrewsh/projects/rust-esp/rust-esp32-std-hello/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-c914de5a2aae2661/out/esp-idf/.pio/build/debug/config", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/newlib/platform_include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/freertos/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/freertos/port/xtensa/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hw_support/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hw_support/port/esp32/.", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/heap/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/log/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/include/apps", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/include/apps/sntp", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/lwip/src/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/port/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/lwip/port/esp32/include/arch", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/esp32/.", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/soc/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/hal/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/hal/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_rom/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_rom/esp32", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_common/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_system/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/driver/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/driver/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_ringbuf/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/efuse/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/efuse/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/xtensa/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/xtensa/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/espcoredump/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_timer/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_ipc/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/vfs/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_wifi/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_wifi/esp32/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_event/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_netif/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_eth/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/tcpip_adapter/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/app_trace/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/mbedtls/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mbedtls/esp_crt_bundle/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/app_update/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/spi_flash/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/bootloader_support/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/nvs_flash/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/pthread/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/xtensa", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_gdbstub/esp32", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wpa_supplicant/include/esp_supplicant", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/perfmon/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/asio/asio/asio/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/asio/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/cbor/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/unity/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/unity/unity/src", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/cmock/CMock/src", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/port/include/coap", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/libcoap/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/coap/libcoap/include/coap2", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/console", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/nghttp/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/nghttp/nghttp2/lib/includes", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp-tls", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp-tls/esp-tls-crypto", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_adc_cal/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_hid/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/tcp_transport/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_http_client/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_http_server/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_https_ota/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protobuf-c/protobuf-c", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/common", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/security", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/protocomm/include/transports", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mdns/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_local_ctrl/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/sdmmc/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_serial_slave_link/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/esp_websocket_client/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/expat/expat/expat/lib", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/expat/port/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wear_levelling/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/diskio", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/vfs", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/fatfs/src", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/freemodbus/common/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/idf_test/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/idf_test/include/esp32", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/jsmn/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/json/cJSON", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/libsodium/libsodium/src/libsodium/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/libsodium/port_include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/mqtt/esp-mqtt/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/openssl/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/spiffs/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/ulp/include", "-I/home/andrewsh/.platformio/packages/framework-espidf/components/wifi_provisioning/include"]
  error: unknown target triple 'xtensa-esp32-espidf', please use -triple or -arch
  thread 'main' panicked at 'libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  - Host vs. target architecture mismatch
  If you encounter an error missing from this list, please file an issue or a PR!', /home/andrewsh/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.57.0/src/ir/context.rs:531:15
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Native build does not work with ESP-IDF branches named `release/vX.X`

  1. Generate a Cargo ESP-IDF project using the esp-idf-template:
cargo generate --vcs none --git https://github.com/ivmarkov/esp-idf-template cargo
  1. When asked to select ESP-IDF native build version (stable = 4.3, upcoming = 4.4, master = 5.0; applicable only with cargo build --features native), choose upcoming

  2. Enter the generated project:

cd <your-project>
  1. Build:
cargo build --features native

Error:

  --- stderr
  Cloning into '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4'...
Updating files: 100% (9463/9463), done.
  Submodule 'components/asio/asio' (https://github.com/espressif/asio.git) registered for path 'components/asio/asio'
  Submodule 'components/bootloader/subproject/components/micro-ecc/micro-ecc' (https://github.com/kmackay/micro-ecc.git) registered for path 'components/bootloader/subproject/components/micro-ecc/micro-ecc'
<SNIP>
  Cloning into '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4/examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib'...
  Submodule 'vendor/c_exception' (https://github.com/throwtheswitch/cexception.git) registered for path 'components/cmock/CMock/vendor/c_exception'
  Submodule 'vendor/unity' (https://github.com/throwtheswitch/unity.git) registered for path 'components/cmock/CMock/vendor/unity'
  Cloning into '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4/components/cmock/CMock/vendor/c_exception'...
  Cloning into '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4/components/cmock/CMock/vendor/unity'...
  Submodule 'ext/tinydtls' (https://github.com/eclipse/tinydtls.git) registered for path 'components/coap/libcoap/ext/tinydtls'
  Cloning into '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4/components/coap/libcoap/ext/tinydtls'...
  Submodule 'third-party/mruby' (https://github.com/mruby/mruby) registered for path 'components/nghttp/nghttp2/third-party/mruby'
  Submodule 'third-party/neverbleed' (https://github.com/tatsuhiro-t/neverbleed.git) registered for path 'components/nghttp/nghttp2/third-party/neverbleed'
  Cloning into '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4/components/nghttp/nghttp2/third-party/mruby'...
  Cloning into '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4/components/nghttp/nghttp2/third-party/neverbleed'...
  fatal: No names found, cannot describe anything.
  fatal: No names found, cannot describe anything.
  WARNING: You are using pip version 20.3.3; however, version 21.3.1 is available.
  You should consider upgrading via the '/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/python_env/idf4.4_py3.9_env/bin/python -m pip install --upgrade pip' command.
  fatal: No names found, cannot describe anything.
  fatal: No names found, cannot describe anything.
  fatal: No names found, cannot describe anything.
  fatal: ref refs/remotes/origin/HEAD is not a symbolic ref
  Error: Command '"git" "--git-dir" "/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4/.git" "--work-tree" "/Users/imarkov/projects/esp32/ttt/error/.embuild/espressif/esp-idf-release/v4.4" "symbolic-ref" "refs/remotes/origin/HEAD"' failed with exit code Some(128)

  Caused by:
      fatal: ref refs/remotes/origin/HEAD is not a symbolic ref

ESP_ERR* constants should be `i32`

Errors are defined as:

typedef int32_t esp_err_t;

/* Definitions for error constants. */
#define ESP_OK          0       /*!< esp_err_t value indicating success (no error) */
#define ESP_FAIL        -1      /*!< Generic esp_err_t code indicating failure */

#define ESP_ERR_NO_MEM              0x101   /*!< Out of memory */
#define ESP_ERR_INVALID_ARG         0x102   /*!< Invalid argument */
#define ESP_ERR_INVALID_STATE       0x103   /*!< Invalid state */
#define ESP_ERR_INVALID_SIZE        0x104   /*!< Invalid size */
#define ESP_ERR_NOT_FOUND           0x105   /*!< Requested resource not found */
#define ESP_ERR_NOT_SUPPORTED       0x106   /*!< Operation or feature not supported */
#define ESP_ERR_TIMEOUT             0x107   /*!< Operation timed out */
#define ESP_ERR_INVALID_RESPONSE    0x108   /*!< Received response was invalid */
#define ESP_ERR_INVALID_CRC         0x109   /*!< CRC or checksum was invalid */
#define ESP_ERR_INVALID_VERSION     0x10A   /*!< Version was invalid */
#define ESP_ERR_INVALID_MAC         0x10B   /*!< MAC address was invalid */

#define ESP_ERR_WIFI_BASE           0x3000  /*!< Starting number of WiFi error codes */
#define ESP_ERR_MESH_BASE           0x4000  /*!< Starting number of MESH error codes */
#define ESP_ERR_FLASH_BASE          0x6000  /*!< Starting number of flash error codes */

However in rust they are:

pub type esp_err_t = c_types::c_int;

pub const ESP_OK: u32 = 0;
pub const ESP_FAIL: i32 = -1;

pub const ESP_ERR_NO_MEM: u32 = 257;
pub const ESP_ERR_INVALID_ARG: u32 = 258;
pub const ESP_ERR_INVALID_STATE: u32 = 259;
pub const ESP_ERR_INVALID_SIZE: u32 = 260;
pub const ESP_ERR_NOT_FOUND: u32 = 261;
pub const ESP_ERR_NOT_SUPPORTED: u32 = 262;
pub const ESP_ERR_TIMEOUT: u32 = 263;
pub const ESP_ERR_INVALID_RESPONSE: u32 = 264;
pub const ESP_ERR_INVALID_CRC: u32 = 265;
pub const ESP_ERR_INVALID_VERSION: u32 = 266;
pub const ESP_ERR_INVALID_MAC: u32 = 267;

pub const ESP_ERR_WIFI_BASE: u32 = 12288;
pub const ESP_ERR_MESH_BASE: u32 = 16384;
pub const ESP_ERR_FLASH_BASE: u32 = 24576;
pub const ESP_ERR_HW_CRYPTO_BASE: u32 = 49152;

Notice that esp_err_t is i32 and ESP_FAIL is i32 but all other constants are u32.

This makes error handling a bit tricky. This would not work because of type mismatch:

match unsafe { twai_transmit(&frame.0, portMAX_DELAY) } {
    ESP_OK => Ok(None),
    ESP_FAIL => Err(nb::Error::WouldBlock),
    ESP_ERR_TIMEOUT => Err(nb::Error::WouldBlock),
    _ => Err(nb::Error::Other(embedded_hal::can::ErrorKind::Other)),
}

For me it seems all those constants must be defined as i32, this is what esp_err_t expects them to be. I checked https://github.com/esp-rs/esp-idf-sys/blob/master/src/error.rs#L10 but it seems I still do not have a good way to match particular error using a constant.
I could do this, but this seems so wrong:

const _ESP_OK: i32 = ESP_OK as i32;
const _ESP_ERR_TIMEOUT: i32 = ESP_ERR_TIMEOUT as i32;

match unsafe { twai_transmit(&frame.0, portMAX_DELAY) } {
    _ESP_OK => Ok(None),
    ESP_FAIL => Err(nb::Error::WouldBlock),
    _ESP_ERR_TIMEOUT => Err(nb::Error::WouldBlock),
    _ => Err(nb::Error::Other(embedded_hal::can::ErrorKind::Other)),
}

How to set flash size

I'm currently trying to change the flash size from 2 MB to 8 MB as I am getting the following warning:

W (269) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.

However I am unsure how to do this properly. Changing the flash size in the sdkconfig does not work either.

Slow rebuilds with `native` feature

I think there was another issue floating around about slow builds, but I can't seem to find it now.

It seems making any change to the build when using the native feature forces an entire rebuild (possible recloning too?). Perhaps the file tracking for rebuilds on native build is tracking something it shouldn't.

Error while building for ESP32C3

Hi there! When trying to build my project for the ESP32-C3 I get a build error for this dependency, the exact same code worked about a week ago:

error: failed to run custom build command for `esp-idf-sys v0.25.0`

Caused by:
  process didn't exit successfully: `/../../target/debug/build/esp-idf-sys-e1a1dd77045a2396/build-script-build` (exit status: 1)
  --- stdout
  Found compatible PlatformIO Core 5.2.3 -> /../.platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  cargo:rerun-if-changed=./patches/ping_setsockopt_fix.diff
  cargo:rerun-if-changed=/../.././sdkconfig.debug
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32-c3-devkitm-1; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Verbose mode can be enabled via `-v, --verbose` option
  CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-c3-devkitm-1.html
  PLATFORM: Espressif 32 (3.3.2) > Espressif ESP32-C3-DevKitM-1
  HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
  DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
  PACKAGES: 
   - framework-espidf 3.40300.0 (4.3.0) 
   - tool-cmake 3.16.4 
   - tool-esptoolpy 1.30100.210531 (3.1.0) 
   - tool-ninja 1.9.0 
   - toolchain-riscv-esp 1.80400.0 (8.4.0)
  Reading CMake configuration...


  --- stderr
  -- Found Git: /usr/bin/git (found version "2.30.1 (Apple Git-130)") 
  -- The C compiler identification is GNU 8.4.0
  -- The CXX compiler identification is GNU 8.4.0
  -- The ASM compiler identification is GNU
  -- Found assembler: /../.platformio/packages/toolchain-riscv-esp/bin/riscv32-esp-elf-gcc
  -- Check for working C compiler: /../.platformio/packages/toolchain-riscv-esp/bin/riscv32-esp-elf-gcc
  -- Check for working C compiler: /../.platformio/packages/toolchain-riscv-esp/bin/riscv32-esp-elf-gcc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /../.platformio/packages/toolchain-riscv-esp/bin/riscv32-esp-elf-g++
  -- Check for working CXX compiler: /../.platformio/packages/toolchain-riscv-esp/bin/riscv32-esp-elf-g++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
  -- Building ESP-IDF components for target esp32c3
  -- Project sdkconfig file /../../target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-fcab891b3db1348e/out/esp-idf/sdkconfig.debug
  -- Found PythonInterp: /../.platformio/penv/bin/python (found version "3.8.11") 
  -- Found Perl: /usr/bin/perl (found version "5.30.3") 
  -- App "esp-idf" version: 1
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp_rom/esp32c3/ld/esp32c3.rom.ld
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp_rom/esp32c3/ld/esp32c3.rom.version.ld
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld
  -- Adding linker script /../../target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-fcab891b3db1348e/out/esp-idf/.pio/build/debug/esp-idf/esp32c3/esp32c3_out.ld
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp32c3/ld/esp32c3.project.ld.in
  -- Adding linker script /../.platformio/packages/framework-espidf/components/esp32c3/ld/esp32c3.peripherals.ld
  -- Components: __pio_env app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32c3 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_ipc esp_local_ctrl esp_netif esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos hal heap idf_test jsmn json libsodium log lwip mbedtls mdns mqtt newlib nghttp nvs_flash openssl partition_table protobuf-c protocomm pthread riscv sdmmc soc spi_flash spiffs src tcp_transport tcpip_adapter tinyusb unity vfs wear_levelling wifi_provisioning wpa_supplicant
  -- Component paths: /../../target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-fcab891b3db1348e/out/esp-idf/.pio/build/debug/__pio_env /../.platformio/packages/framework-espidf/components/app_trace /../.platformio/packages/framework-espidf/components/app_update /../.platformio/packages/framework-espidf/components/asio /../.platformio/packages/framework-espidf/components/bootloader /../.platformio/packages/framework-espidf/components/bootloader_support /../.platformio/packages/framework-espidf/components/bt /../.platformio/packages/framework-espidf/components/cbor /../.platformio/packages/framework-espidf/components/cmock /../.platformio/packages/framework-espidf/components/coap /../.platformio/packages/framework-espidf/components/console /../.platformio/packages/framework-espidf/components/cxx /../.platformio/packages/framework-espidf/components/driver /../.platformio/packages/framework-espidf/components/efuse /../.platformio/packages/framework-espidf/components/esp-tls /../.platformio/packages/framework-espidf/components/esp32c3 /../.platformio/packages/framework-espidf/components/esp_adc_cal /../.platformio/packages/framework-espidf/components/esp_common /../.platformio/packages/framework-espidf/components/esp_eth /../.platformio/packages/framework-espidf/components/esp_event /../.platformio/packages/framework-espidf/components/esp_gdbstub /../.platformio/packages/framework-espidf/components/esp_hid /../.platformio/packages/framework-espidf/components/esp_http_client /../.platformio/packages/framework-espidf/components/esp_http_server /../.platformio/packages/framework-espidf/components/esp_https_ota /../.platformio/packages/framework-espidf/components/esp_https_server /../.platformio/packages/framework-espidf/components/esp_hw_support /../.platformio/packages/framework-espidf/components/esp_ipc /../.platformio/packages/framework-espidf/components/esp_local_ctrl /../.platformio/packages/framework-espidf/components/esp_netif /../.platformio/packages/framework-espidf/components/esp_pm /../.platformio/packages/framework-espidf/components/esp_ringbuf /../.platformio/packages/framework-espidf/components/esp_rom /../.platformio/packages/framework-espidf/components/esp_serial_slave_link /../.platformio/packages/framework-espidf/components/esp_system /../.platformio/packages/framework-espidf/components/esp_timer /../.platformio/packages/framework-espidf/components/esp_websocket_client /../.platformio/packages/framework-espidf/components/esp_wifi /../.platformio/packages/framework-espidf/components/espcoredump /../.platformio/packages/framework-espidf/components/esptool_py /../.platformio/packages/framework-espidf/components/expat /../.platformio/packages/framework-espidf/components/fatfs /../.platformio/packages/framework-espidf/components/freemodbus /../.platformio/packages/framework-espidf/components/freertos /../.platformio/packages/framework-espidf/components/hal /../.platformio/packages/framework-espidf/components/heap /../.platformio/packages/framework-espidf/components/idf_test /../.platformio/packages/framework-espidf/components/jsmn /../.platformio/packages/framework-espidf/components/json /../.platformio/packages/framework-espidf/components/libsodium /../.platformio/packages/framework-espidf/components/log /../.platformio/packages/framework-espidf/components/lwip /../.platformio/packages/framework-espidf/components/mbedtls /../.platformio/packages/framework-espidf/components/mdns /../.platformio/packages/framework-espidf/components/mqtt /../.platformio/packages/framework-espidf/components/newlib /../.platformio/packages/framework-espidf/components/nghttp /../.platformio/packages/framework-espidf/components/nvs_flash /../.platformio/packages/framework-espidf/components/openssl /../.platformio/packages/framework-espidf/components/partition_table /../.platformio/packages/framework-espidf/components/protobuf-c /../.platformio/packages/framework-espidf/components/protocomm /../.platformio/packages/framework-espidf/components/pthread /../.platformio/packages/framework-espidf/components/riscv /../.platformio/packages/framework-espidf/components/sdmmc /../.platformio/packages/framework-espidf/components/soc /../.platformio/packages/framework-espidf/components/spi_flash /../.platformio/packages/framework-espidf/components/spiffs /../../target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-fcab891b3db1348e/out/esp-idf/src /../.platformio/packages/framework-espidf/components/tcp_transport /../.platformio/packages/framework-espidf/components/tcpip_adapter /../.platformio/packages/framework-espidf/components/tinyusb /../.platformio/packages/framework-espidf/components/unity /../.platformio/packages/framework-espidf/components/vfs /../.platformio/packages/framework-espidf/components/wear_levelling /../.platformio/packages/framework-espidf/components/wifi_provisioning /../.platformio/packages/framework-espidf/components/wpa_supplicant
  -- Configuring incomplete, errors occurred!
  See also "/../../target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-fcab891b3db1348e/out/esp-idf/.pio/build/debug/CMakeFiles/CMakeOutput.log".
  See also "/../../target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-fcab891b3db1348e/out/esp-idf/.pio/build/debug/CMakeFiles/CMakeError.log".

  fatal: not a git repository (or any of the parent directories): .git
  CMake Error at .pio/build/debug/CMakeFiles/git-data/grabRef.cmake:48 (file):
    file failed to open for reading (No such file or directory):

      /../../target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-fcab891b3db1348e/out/esp-idf/.pio/build/debug/CMakeFiles/git-data/head-ref
  Call Stack (most recent call first):
    /../.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
    /../.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
    /../.platformio/packages/framework-espidf/tools/cmake/project.cmake:49 (git_describe)
    /../.platformio/packages/framework-espidf/tools/cmake/project.cmake:392 (__project_get_revision)
    CMakeLists.txt:3 (project)



  ========================== [FAILED] Took 2.90 seconds ==========================
  Environment    Status    Duration
  -------------  --------  ------------
  debug          FAILED    00:00:02.905
  ==================== 1 failed, 0 succeeded in 00:00:02.905 ====================
  Error: No such file or directory (os error 2)

  Stack backtrace:
     0: std::backtrace_rs::backtrace::libunwind::trace
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1: std::backtrace_rs::backtrace::trace_unsynchronized
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2: std::backtrace::Backtrace::create
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/backtrace.rs:327:13
     3: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
               at /../.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.45/src/error.rs:530:25
     4: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/core/src/result.rs:1915:27
     5: embuild::pio::project::SconsVariables::from_dump
               at /../.cargo/git/checkouts/embuild-c4499053a5b85aaf/f9fb48f/src/pio/project.rs:85:36
     6: build_script_build::build_driver::build
               at ./build/pio.rs:54:30
     7: build_script_build::main
               at ./build/build.rs:25:24
     8: core::ops::function::FnOnce::call_once
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/core/src/ops/function.rs:227:5
     9: std::sys_common::backtrace::__rust_begin_short_backtrace
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/sys_common/backtrace.rs:123:18
    10: std::rt::lang_start::{{closure}}
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:146:18
    11: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/core/src/ops/function.rs:259:13
    12: std::panicking::try::do_call
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:403:40
    13: std::panicking::try
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:367:19
    14: std::panic::catch_unwind
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panic.rs:133:14
    15: std::rt::lang_start_internal::{{closure}}
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:128:48
    16: std::panicking::try::do_call
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:403:40
    17: std::panicking::try
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:367:19
    18: std::panic::catch_unwind
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panic.rs:133:14
    19: std::rt::lang_start_internal
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:128:20
    20: std::rt::lang_start
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:145:17
    21: <unknown>
               at ./build/build.rs:52:6

This errors with all versions of esp-idf-sys, the latest and the oldest I could find that satisfied the API I need.
I am building without the native feature.

Undeclared defines while building native (DR_REG_EMAC_BASE)

I try to build the crate for the esp32c3 with native feature #10 enabled and get the following error:

FAILED: esp-idf/esp_eth/CMakeFiles/__idf_esp_eth.dir/src/esp_eth_mac_openeth.c.obj
In file included from /root/.espressif/esp-idf-release/v4.4/components/esp_eth/src/esp_eth_mac_openeth.c:36:
  /root/.espressif/esp-idf-release/v4.4/components/esp_eth/src/openeth.h: In function 'openeth_tx_desc':
  /root/.espressif/esp-idf-release/v4.4/components/esp_eth/src/openeth.h:40:37: error: 'DR_REG_EMAC_BASE' undeclared (first use in this function); did you mean 'DR_REG_HMAC_BASE'?
   #define OPENETH_BASE                DR_REG_EMAC_BASE
...

I use the version release/v4.4 and have CONFIG_ETH_USE_OPENETH=y enabled.

It could be a wrong configuration, so I tried to use the cargo-idf tool. But it depends on the same build, so it fails with the same error.

I recognized the macro is defined in soc/esp32/../reg_base.h. But this header is not be included when building for the esp32c3 in my configuration.

Error while building with the pio feature

Hey there! While building the library I stumbled upon an error:

cargo b
   Compiling esp-idf-sys v0.24.1
error: failed to run custom build command for `esp-idf-sys v0.24.1`

Caused by:
  process didn't exit successfully: `.../code/esp/rust-esp32-std-mini/target/debug/build/esp-idf-sys-17ca833ec6c37798/build-script-build` (exit status: 1)
  --- stdout
  Found compatible PlatformIO Core 5.2.2 -> /.../.platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  cargo:rerun-if-changed=./patches/ping_setsockopt_fix.diff
  cargo:rerun-if-changed=/.../rust-esp32-std-mini/./sdkconfig.debug
  cargo:rerun-if-changed=/.../esp/rust-esp32-std-mini/./sdkconfig.defaults
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32-c3-devkitm-1; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Verbose mode can be enabled via `-v, --verbose` option
  CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-c3-devkitm-1.html
  PLATFORM: Espressif 32 (3.3.2) > Espressif ESP32-C3-DevKitM-1
  HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
  DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
  PACKAGES: 
   - framework-espidf 3.40300.0 (4.3.0) 
   - tool-cmake 3.16.4 
   - tool-esptoolpy 1.30100.210531 (3.1.0) 
   - tool-ninja 1.9.0 
   - toolchain-riscv-esp 1.80400.0 (8.4.0)
  Reading CMake configuration...
  Generating assembly for certificate bundle...
  LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
  LDF Modes: Finder ~ chain, Compatibility ~ soft
  Found 0 compatible libraries
  Scanning dependencies...
  No dependencies
  Building in debug mode


  --- stderr
  CMake Error at /../.platformio/packages/framework-espidf/tools/cmake/scripts/data_file_embed_asm.cmake:26 (file):
    file failed to open for reading (No such file or directory):

      /../rust-esp32-std-mini/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-ee61aad2301f479b/out/esp-idf/.pio/build/debug/x509_crt_bundle


  *** Error 1
  *** [.pio/build/debug/.pio/build/debug/x509_crt_bundle.o] Source `.pio/build/debug/x509_crt_bundle.S' not found, needed by target `.pio/build/debug/.pio/build/debug/x509_crt_bundle.o'.
  ========================== [FAILED] Took 3.09 seconds ==========================
  Environment    Status    Duration
  -------------  --------  ------------
  debug          FAILED    00:00:03.087
  ==================== 1 failed, 0 succeeded in 00:00:03.087 ====================
  Error: No such file or directory (os error 2)

  Stack backtrace:
     0: std::backtrace_rs::backtrace::libunwind::trace
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1: std::backtrace_rs::backtrace::trace_unsynchronized
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2: std::backtrace::Backtrace::create
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/backtrace.rs:327:13
     3: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
               at /Users/basti/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.44/src/error.rs:530:25
     4: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/core/src/result.rs:1915:27
     5: embuild::pio::project::SconsVariables::from_dump
               at /Users/basti/.cargo/registry/src/github.com-1ecc6299db9ec823/embuild-0.25.1/src/pio/project.rs:85:36
     6: build_script_build::build_driver::build
               at ./build/pio.rs:54:30
     7: build_script_build::main
               at ./build/build.rs:25:24
     8: core::ops::function::FnOnce::call_once
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/core/src/ops/function.rs:227:5
     9: std::sys_common::backtrace::__rust_begin_short_backtrace
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/sys_common/backtrace.rs:123:18
    10: std::rt::lang_start::{{closure}}
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:146:18
    11: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/core/src/ops/function.rs:259:13
    12: std::panicking::try::do_call
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:403:40
    13: std::panicking::try
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:367:19
    14: std::panic::catch_unwind
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panic.rs:133:14
    15: std::rt::lang_start_internal::{{closure}}
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:128:48
    16: std::panicking::try::do_call
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:403:40
    17: std::panicking::try
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panicking.rs:367:19
    18: std::panic::catch_unwind
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/panic.rs:133:14
    19: std::rt::lang_start_internal
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:128:20
    20: std::rt::lang_start
               at /rustc/c390d69a615f095208ac94841f3310268521b2ee/library/std/src/rt.rs:145:17
    21: <unknown>
               at ./build/build.rs:52:6

I am building this library via the pio feature and also have the binstart feature enabled. This log is from building the newest version (v0.24.1) but I experienced the error with every previous version I tried as well.

Cannot compile `esp-idf-sys` when parent project has no commits

Creating a new cargo project and then including esp-idf-sys without creating an initial commit in the project causes esp-idf-sys not to compile.

Removing git from the project or adding an initial commit lets the project compile fine. Running the build in verbose mode (cargo build -vvv) returns the following:

[esp-idf-sys 0.16.4] Found compatible PlatformIO Core 5.1.1 -> /Users/davidcole/.platformio/penv/bin/platformio
[esp-idf-sys 0.16.4] cargo:rerun-if-changed=./patches/esp32c3_atomics_emul.diff
[esp-idf-sys 0.16.4] cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
[esp-idf-sys 0.16.4] cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
[esp-idf-sys 0.16.4] cargo:rerun-if-changed=./patches/master_restore_link_fragments_for_pio.diff
[esp-idf-sys 0.16.4] cargo:rerun-if-changed=./patches/master_missing_xtensa_atomics_fix.diff
[esp-idf-sys 0.16.4] Warning! Ignore unknown configuration option `patches` in section [env]
[esp-idf-sys 0.16.4] Processing debug (board: esp32cam; platform: espressif32; framework: espidf)
[esp-idf-sys 0.16.4] --------------------------------------------------------------------------------
[esp-idf-sys 0.16.4] Verbose mode can be enabled via `-v, --verbose` option
[esp-idf-sys 0.16.4] CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32cam.html
[esp-idf-sys 0.16.4] PLATFORM: Espressif 32 (3.3.1) > AI Thinker ESP32-CAM
[esp-idf-sys 0.16.4] HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
[esp-idf-sys 0.16.4] DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
[esp-idf-sys 0.16.4] PACKAGES:
[esp-idf-sys 0.16.4]  - framework-espidf 3.40300.0 (4.3.0)
[esp-idf-sys 0.16.4]  - tool-cmake 3.16.4
[esp-idf-sys 0.16.4]  - tool-esptoolpy 1.30100.210531 (3.1.0)
[esp-idf-sys 0.16.4]  - tool-ninja 1.9.0
[esp-idf-sys 0.16.4]  - toolchain-esp32ulp 1.22851.191205 (2.28.51)
[esp-idf-sys 0.16.4]  - toolchain-xtensa32 2.80400.210211 (8.4.0)
[esp-idf-sys 0.16.4] Reading CMake configuration...
[esp-idf-sys 0.16.4] -- Found Git: /usr/bin/git (found version "2.30.1 (Apple Git-130)")
[esp-idf-sys 0.16.4] -- The C compiler identification is GNU 8.4.0
[esp-idf-sys 0.16.4] -- The CXX compiler identification is GNU 8.4.0
[esp-idf-sys 0.16.4] -- The ASM compiler identification is GNU
[esp-idf-sys 0.16.4] -- Found assembler: /Users/davidcole/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
[esp-idf-sys 0.16.4] -- Check for working C compiler: /Users/davidcole/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
[esp-idf-sys 0.16.4] -- Check for working C compiler: /Users/davidcole/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc -- works
[esp-idf-sys 0.16.4] -- Detecting C compiler ABI info
[esp-idf-sys 0.16.4] -- Detecting C compiler ABI info - done
[esp-idf-sys 0.16.4] -- Detecting C compile features
[esp-idf-sys 0.16.4] -- Detecting C compile features - done
[esp-idf-sys 0.16.4] -- Check for working CXX compiler: /Users/davidcole/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-g++
[esp-idf-sys 0.16.4] -- Check for working CXX compiler: /Users/davidcole/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-g++ -- works
[esp-idf-sys 0.16.4] -- Detecting CXX compiler ABI info
[esp-idf-sys 0.16.4] -- Detecting CXX compiler ABI info - done
[esp-idf-sys 0.16.4] -- Detecting CXX compile features
[esp-idf-sys 0.16.4] -- Detecting CXX compile features - done
[esp-idf-sys 0.16.4] -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
[esp-idf-sys 0.16.4] -- Building ESP-IDF components for target esp32
[esp-idf-sys 0.16.4] -- Project sdkconfig file /Users/davidcole/projects/rust/esp32/esp-test-error/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-87210aafeca08afe/out/esp-idf/sdkconfig.debug
[esp-idf-sys 0.16.4] -- Found PythonInterp: /Users/davidcole/.platformio/penv/bin/python (found version "3.9.6")
[esp-idf-sys 0.16.4] -- Found Perl: /usr/bin/perl (found version "5.30.2")
[esp-idf-sys 0.16.4] -- App "esp-idf" version: 1
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.api.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/projects/rust/esp32/esp-test-error/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-87210aafeca08afe/out/esp-idf/.pio/build/debug/esp-idf/esp32/esp32_out.ld
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp32/ld/esp32.project.ld.in
[esp-idf-sys 0.16.4] -- Adding linker script /Users/davidcole/.platformio/packages/framework-espidf/components/esp32/ld/esp32.peripherals.ld
[esp-idf-sys 0.16.4] -- Components: __pio_env app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_ipc esp_local_ctrl esp_netif esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos hal heap idf_test jsmn json libsodium log lwip mbedtls mdns mqtt newlib nghttp nvs_flash openssl partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs src tcp_transport tcpip_adapter tinyusb ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
[esp-idf-sys 0.16.4] -- Component paths: /Users/davidcole/projects/rust/esp32/esp-test-error/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-87210aafeca08afe/out/esp-idf/.pio/build/debug/__pio_env /Users/davidcole/.platformio/packages/framework-espidf/components/app_trace /Users/davidcole/.platformio/packages/framework-espidf/components/app_update /Users/davidcole/.platformio/packages/framework-espidf/components/asio /Users/davidcole/.platformio/packages/framework-espidf/components/bootloader /Users/davidcole/.platformio/packages/framework-espidf/components/bootloader_support /Users/davidcole/.platformio/packages/framework-espidf/components/bt /Users/davidcole/.platformio/packages/framework-espidf/components/cbor /Users/davidcole/.platformio/packages/framework-espidf/components/cmock /Users/davidcole/.platformio/packages/framework-espidf/components/coap /Users/davidcole/.platformio/packages/framework-espidf/components/console /Users/davidcole/.platformio/packages/framework-espidf/components/cxx /Users/davidcole/.platformio/packages/framework-espidf/components/driver /Users/davidcole/.platformio/packages/framework-espidf/components/efuse /Users/davidcole/.platformio/packages/framework-espidf/components/esp-tls /Users/davidcole/.platformio/packages/framework-espidf/components/esp32 /Users/davidcole/.platformio/packages/framework-espidf/components/esp_adc_cal /Users/davidcole/.platformio/packages/framework-espidf/components/esp_common /Users/davidcole/.platformio/packages/framework-espidf/components/esp_eth /Users/davidcole/.platformio/packages/framework-espidf/components/esp_event /Users/davidcole/.platformio/packages/framework-espidf/components/esp_gdbstub /Users/davidcole/.platformio/packages/framework-espidf/components/esp_hid /Users/davidcole/.platformio/packages/framework-espidf/components/esp_http_client /Users/davidcole/.platformio/packages/framework-espidf/components/esp_http_server /Users/davidcole/.platformio/packages/framework-espidf/components/esp_https_ota /Users/davidcole/.platformio/packages/framework-espidf/components/esp_https_server /Users/davidcole/.platformio/packages/framework-espidf/components/esp_hw_support /Users/davidcole/.platformio/packages/framework-espidf/components/esp_ipc /Users/davidcole/.platformio/packages/framework-espidf/components/esp_local_ctrl /Users/davidcole/.platformio/packages/framework-espidf/components/esp_netif /Users/davidcole/.platformio/packages/framework-espidf/components/esp_pm /Users/davidcole/.platformio/packages/framework-espidf/components/esp_ringbuf /Users/davidcole/.platformio/packages/framework-espidf/components/esp_rom /Users/davidcole/.platformio/packages/framework-espidf/components/esp_serial_slave_link /Users/davidcole/.platformio/packages/framework-espidf/components/esp_system /Users/davidcole/.platformio/packages/framework-espidf/components/esp_timer /Users/davidcole/.platformio/packages/framework-espidf/components/esp_websocket_client /Users/davidcole/.platformio/packages/framework-espidf/components/esp_wifi /Users/davidcole/.platformio/packages/framework-espidf/components/espcoredump /Users/davidcole/.platformio/packages/framework-espidf/components/esptool_py /Users/davidcole/.platformio/packages/framework-espidf/components/expat /Users/davidcole/.platformio/packages/framework-espidf/components/fatfs /Users/davidcole/.platformio/packages/framework-espidf/components/freemodbus /Users/davidcole/.platformio/packages/framework-espidf/components/freertos /Users/davidcole/.platformio/packages/framework-espidf/components/hal /Users/davidcole/.platformio/packages/framework-espidf/components/heap /Users/davidcole/.platformio/packages/framework-espidf/components/idf_test /Users/davidcole/.platformio/packages/framework-espidf/components/jsmn /Users/davidcole/.platformio/packages/framework-espidf/components/json /Users/davidcole/.platformio/packages/framework-espidf/components/libsodium /Users/davidcole/.platformio/packages/framework-espidf/components/log /Users/davidcole/.platformio/packages/framework-espidf/components/lwip /Users/davidcole/.platformio/packages/framework-espidf/components/mbedtls /Users/davidcole/.platformio/packages/framework-espidf/components/mdns /Users/davidcole/.platformio/packages/framework-espidf/components/mqtt /Users/davidcole/.platformio/packages/framework-espidf/components/newlib /Users/davidcole/.platformio/packages/framework-espidf/components/nghttp /Users/davidcole/.platformio/packages/framework-espidf/components/nvs_flash /Users/davidcole/.platformio/packages/framework-espidf/components/openssl /Users/davidcole/.platformio/packages/framework-espidf/components/partition_table /Users/davidcole/.platformio/packages/framework-espidf/components/perfmon /Users/davidcole/.platformio/packages/framework-espidf/components/protobuf-c /Users/davidcole/.platformio/packages/framework-espidf/components/protocomm /Users/davidcole/.platformio/packages/framework-espidf/components/pthread /Users/davidcole/.platformio/packages/framework-espidf/components/sdmmc /Users/davidcole/.platformio/packages/framework-espidf/components/soc /Users/davidcole/.platformio/packages/framework-espidf/components/spi_flash /Users/davidcole/.platformio/packages/framework-espidf/components/spiffs /Users/davidcole/projects/rust/esp32/esp-test-error/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-87210aafeca08afe/out/esp-idf/src /Users/davidcole/.platformio/packages/framework-espidf/components/tcp_transport /Users/davidcole/.platformio/packages/framework-espidf/components/tcpip_adapter /Users/davidcole/.platformio/packages/framework-espidf/components/tinyusb /Users/davidcole/.platformio/packages/framework-espidf/components/ulp /Users/davidcole/.platformio/packages/framework-espidf/components/unity /Users/davidcole/.platformio/packages/framework-espidf/components/vfs /Users/davidcole/.platformio/packages/framework-espidf/components/wear_levelling /Users/davidcole/.platformio/packages/framework-espidf/components/wifi_provisioning /Users/davidcole/.platformio/packages/framework-espidf/components/wpa_supplicant /Users/davidcole/.platformio/packages/framework-espidf/components/xtensa
[esp-idf-sys 0.16.4] -- Configuring incomplete, errors occurred!
[esp-idf-sys 0.16.4] See also "/Users/davidcole/projects/rust/esp32/esp-test-error/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-87210aafeca08afe/out/esp-idf/.pio/build/debug/CMakeFiles/CMakeOutput.log".
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4] fatal: not a git repository (or any of the parent directories): .git
[esp-idf-sys 0.16.4] CMake Error at .pio/build/debug/CMakeFiles/git-data/grabRef.cmake:48 (file):
[esp-idf-sys 0.16.4]   file failed to open for reading (No such file or directory):
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4]     /Users/davidcole/projects/rust/esp32/esp-test-error/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-87210aafeca08afe/out/esp-idf/.pio/build/debug/CMakeFiles/git-data/head-ref
[esp-idf-sys 0.16.4] Call Stack (most recent call first):
[esp-idf-sys 0.16.4]   /Users/davidcole/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
[esp-idf-sys 0.16.4]   /Users/davidcole/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
[esp-idf-sys 0.16.4]   /Users/davidcole/.platformio/packages/framework-espidf/tools/cmake/project.cmake:49 (git_describe)
[esp-idf-sys 0.16.4]   /Users/davidcole/.platformio/packages/framework-espidf/tools/cmake/project.cmake:392 (__project_get_revision)
[esp-idf-sys 0.16.4]   CMakeLists.txt:3 (project)
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4] CMake Warning (dev) at /Users/davidcole/.platformio/packages/framework-espidf/components/mbedtls/CMakeLists.txt:114 (target_sources):
[esp-idf-sys 0.16.4]   Policy CMP0076 is not set: target_sources() command converts relative paths
[esp-idf-sys 0.16.4]   to absolute.  Run "cmake --help-policy CMP0076" for policy details.  Use
[esp-idf-sys 0.16.4]   the cmake_policy command to set the policy and suppress this warning.
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4]   A private source from a directory other than that of target "mbedcrypto"
[esp-idf-sys 0.16.4]   has a relative path.
[esp-idf-sys 0.16.4] This warning is for project developers.  Use -Wno-dev to suppress it.
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4] ========================== [FAILED] Took 3.13 seconds ==========================
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4] Environment    Status    Duration
[esp-idf-sys 0.16.4] -------------  --------  ------------
[esp-idf-sys 0.16.4] debug          FAILED    00:00:03.132
[esp-idf-sys 0.16.4] ==================== 1 failed, 0 succeeded in 00:00:03.132 ====================
[esp-idf-sys 0.16.4] Error: No such file or directory (os error 2)
[esp-idf-sys 0.16.4]
[esp-idf-sys 0.16.4] Stack backtrace:
[esp-idf-sys 0.16.4]    0: std::backtrace::Backtrace::create
[esp-idf-sys 0.16.4]    1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
[esp-idf-sys 0.16.4]              at /Users/davidcole/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.42/src/error.rs:519:25
[esp-idf-sys 0.16.4]    2: pio::project::SconsVariables::from_dump
[esp-idf-sys 0.16.4]              at /Users/davidcole/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pio-0.20.5/src/project.rs:80:10
[esp-idf-sys 0.16.4]    3: build_script_build::main
[esp-idf-sys 0.16.4]              at ./build.rs:56:30
[esp-idf-sys 0.16.4]    4: core::ops::function::FnOnce::call_once
[esp-idf-sys 0.16.4]              at /Users/georgik/projects/rust/library/core/src/ops/function.rs:227:5
[esp-idf-sys 0.16.4]    5: std::sys_common::backtrace::__rust_begin_short_backtrace
[esp-idf-sys 0.16.4]              at /Users/georgik/projects/rust/library/std/src/sys_common/backtrace.rs:125:18
[esp-idf-sys 0.16.4]    6: std::rt::lang_start::{{closure}}
[esp-idf-sys 0.16.4]              at /Users/georgik/projects/rust/library/std/src/rt.rs:49:18
[esp-idf-sys 0.16.4]    7: std::rt::lang_start_internal
[esp-idf-sys 0.16.4]    8: std::rt::lang_start
[esp-idf-sys 0.16.4]              at /Users/georgik/projects/rust/library/std/src/rt.rs:48:5
[esp-idf-sys 0.16.4]    9: _main

I've attached a zip file containing a project to reproduce the error. Note that even after a commit is added the project still won't compile due to no app_main function (but that's not part of the issue).

esp-test-error.zip

Error: 'git remote show' yielded invalid output

native build failed:

[esp-idf-sys 0.24.5] PATH=/home/maxu/.espressif/tools/cmake/3.20.3/bin:/home/maxu/.espressif/python_env/idf5.0_py3.7_env/bin:/home/maxu/.espressif/esp-idf-master/tools:$PATH
[esp-idf-sys 0.24.5] Error: 'git remote show' yielded invalid output
error: failed to run custom build command for esp-idf-sys v0.24.5

Generate Rust bindings for MQTT ESP-IDF APIs

Hi, esp-rs team,
I'm implementing a project with ESP32C3 RUST, and I will apply the MQTTs APIs of native ESP-IDF. I check the code, it seems not support yet. I'm not sure if im right?
If yes, could you give me some advice how to implement MQTTs with esp-idf-sys?
Or there's no choice but to move back to C currently?

LoadProhibited exception when using `EspMutex`

The implementation for EspMutex was recently changed from using a pthread_mutex_t to a *mut pthread_mutex_t. This is incorrect as when locking, the pthread_mutex_lock function calls pthread_mutex_init_if_static which dereferences the mutex pointer. Because this pointer is initially set to PTHREAD_MUTEX_INITIALIZER (0xFFFFFFFF), this causes a load to this address which is invalid and causes a LoadProhibited exception.

Can't compile

Can't compile. Don't know what to do with these errors. Let me know if you need any more info.

--- stdout
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  Found compatible PlatformIO Core 5.2.4 -> /home/newuser/MHA/ESP32/.embuild/platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/missing_riscv_atomics_fix.diff
  cargo:rerun-if-changed=/home/newuser/MHA/ESP32/sdkconfig.defaults
  cargo:rerun-if-changed=/home/newuser/MHA/ESP32/sdkconfig.defaults.esp32
  cargo:rerun-if-changed=/home/newuser/MHA/ESP32/sdkconfig.defaults.esp32s2
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32cam; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Verbose mode can be enabled via `-v, --verbose` option
  CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32cam.html
  PLATFORM: Espressif 32 (3.5.0) > AI Thinker ESP32-CAM
  HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
  DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
  PACKAGES: 
   - framework-espidf 3.40302.0 (4.3.2) 
   - tool-cmake 3.16.4 
   - tool-esptoolpy 1.30100.210531 (3.1.0) 
   - tool-ninja 1.7.1 
   - toolchain-esp32ulp 1.22851.191205 (2.28.51) 
   - toolchain-riscv32-esp 8.4.0+2021r2-patch2 
   - toolchain-xtensa-esp32 8.4.0+2021r2-patch2 
   - toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
  Reading CMake configuration...

--- stderr
  -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
  -- Building ESP-IDF components for target esp32
-- Configuring incomplete, errors occurred!
  See also "/home/newuser/MHA/ESP32/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-4d766012aa29bb86/out/esp-idf/.pio/build/debug/CMakeFiles/CMakeOutput.log".

  CMake Error at .pio/build/debug/CMakeFiles/git-data/grabRef.cmake:48 (file):
    file failed to open for reading (No such file or directory):
/home/newuser/MHA/ESP32/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-4d766012aa29bb86/out/esp-idf/.pio/build/debug/CMakeFiles/git-data/head-ref
  Call Stack (most recent call first):
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/build.cmake:67 (git_describe)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/build.cmake:165 (__build_get_idf_git_revision)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/idf.cmake:50 (__build_init)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/project.cmake:7 (include)
    CMakeLists.txt:2 (include)


  CMake Error at .pio/build/debug/CMakeFiles/git-data/grabRef.cmake:48 (file):
    file failed to open for reading (No such file or directory):

      /home/newuser/MHA/ESP32/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-4d766012aa29bb86/out/esp-idf/.pio/build/debug/CMakeFiles/git-data/head-ref
  Call Stack (most recent call first):
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/project.cmake:52 (git_describe)
    /home/newuser/MHA/ESP32/.embuild/platformio/packages/framework-espidf/tools/cmake/project.cmake:395 (__project_get_revision)
    CMakeLists.txt:3 (project)



  ========================== [FAILED] Took 2.80 seconds ==========================
  Environment    Status    Duration
  -------------  --------  ------------
  debug          FAILED    00:00:02.799
  ==================== 1 failed, 0 succeeded in 00:00:02.799 ====================
  Error: No such file or directory (os error 2)

Error compiling - PlatformIO

Hello

I am attempting to make my own ESP32 Rust project, however when I try to compile it using cargo build I get the following error:

Caused by:
  process didn't exit successfully: `/home/carl/Documents/git/github/davidcarl/ESP32-Build/target/debug/build/esp-idf-sys-b9e81c780502d3bf/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  Found compatible PlatformIO Core 5.2.5 -> /home/carl/Documents/git/github/davidcarl/ESP32-Build/.embuild/platformio/penv/bin/platformio

I am able to build the rust-esp32-std-demo project, and I have attempted to gut this project for all the necessary dependencies, however I run into this error now.

I have attempted to reinstall my toolchain (multipletimes), cargo clean and cargo update however it still just keep not working.

Thanks in advanced

ESP-NOW support

Hi!

I was wondering if there are any plans to support ESP-NOW which is part of ESP-IDF too.

I've built a couple of projects on it (on top of Arduino stack) and was very happy with the possibilities of having a p2p broadcast network that did not require an intermediate wifi router while having quite efficient communication between ESP devices.

Support for starting build in activated ESP-IDF environment

Use case: User deploys ESP-IDF starts the environment using export.[sh|bat|.ps1]. The script adds path to tools to PATH and configures some additional environment variables. User switches to the directory with Rust project and enters: cargo build.

Observed behavior: The build fails, because embuild attempts to clone new ESP-IDF and activates new virtual environment inside existing virtual environment which fails.

Desired behavior: The build is able to determine that it's running inside activated ESP-IDF with all variables and tools set, so it's not necessary to perform installation procedure and invokes the build with tools available on PATH.

External component

Hey, guys! Thanks for building such a great library! I just have a quick question - is there a way to use external (custom) ESP-IDF component in building this crate? Like importing with some env variable or anything else? For a moment I see that all of framework components and their headers are hardcoded in binding.h for bindgen and without modification of sources I won't be able to integrate smth. Thanks in advance!

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.