esp-rs / esp-template

A minimal esp-hal application template for use with cargo-generate
Apache License 2.0
143 stars 29 forks source link

Porting a esp-hal example to a standalone esp-template generated repo? #153

Closed brainstorm closed 7 months ago

brainstorm commented 7 months ago

Hello!

I was trying to have one of the great embassy esp-hal examples from esp-hal as a standalone project that I wish to develop further but I ran into the following rust-lld issue (similar to https://github.com/esp-rs/esp-hal/issues/1336 ?):

**$ . ~/export-esp.sh**
$ env | grep ^PATH PATH=/home/rvalls/.rustup/toolchains/esp/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin:/home/rvalls/.cargo/bin:/home/rvalls/.local/bin:/home/rvalls/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/rvalls/bin:/home/rvalls/.cargo/bin:/home/rvalls/.local/bin
**$ espup update**
[2024-03-24T02:17:11Z WARN ] ⚠️   A new version of espup ('v0.11.0') is available
[2024-03-24T02:17:11Z INFO ] 💽  Updating Espressif Rust ecosystem
[2024-03-24T02:17:11Z INFO ] 💡  Querying GitHub API: 'https://api.github.com/repos/esp-rs/rust-build/releases/latest'
[2024-03-24T02:17:11Z INFO ] 💡  Querying GitHub API: 'https://api.github.com/repos/esp-rs/rust-build/releases'
[2024-03-24T02:17:12Z INFO ] 🔧  Checking Rust installation
[2024-03-24T02:17:12Z WARN ] ⚠️   Previous installation of LLVM exists in: '/home/rvalls/.rustup/toolchains/esp/xtensa-esp32-elf-clang/esp-16.0.0-20230516'. Reusing this installation
[2024-03-24T02:17:12Z INFO ] 🔧  Installing RISC-V targets ('riscv32imc-unknown-none-elf' and 'riscv32imac-unknown-none-elf') for 'nightly' toolchain
[2024-03-24T02:17:12Z WARN ] ⚠️   Previous installation of GCC exists in: '/home/rvalls/.rustup/toolchains/esp/xtensa-esp32-elf/esp-12.2.0_20230208'. Reusing this installation
[2024-03-24T02:17:12Z WARN ] ⚠️   Previous installation of GCC exists in: '/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s2-elf/esp-12.2.0_20230208'. Reusing this installation
[2024-03-24T02:17:12Z WARN ] ⚠️   Previous installation of GCC exists in: '/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s3-elf/esp-12.2.0_20230208'. Reusing this installation
[2024-03-24T02:17:12Z WARN ] ⚠️   Previous installation of GCC exists in: '/home/rvalls/.rustup/toolchains/esp/riscv32-esp-elf/esp-12.2.0_20230208'. Reusing this installation
[2024-03-24T02:17:12Z WARN ] ⚠️   Previous installation of Xtensa Rust 1.76.0.1 exists in: '/home/rvalls/.rustup/toolchains/esp'. Reusing this installation
[2024-03-24T02:17:13Z INFO ] 🔧  Creating export file
[2024-03-24T02:17:13Z WARN ] 💡  Please, set up the environment variables by running: ' /home/rvalls/export-esp.sh'
[2024-03-24T02:17:13Z WARN ] ⚠️   This step must be done every time you open a new terminal
[2024-03-24T02:17:13Z INFO ] ✅  Update successfully completed!
**$ cargo generate esp-rs/esp-template**
⚠️   Favorite `esp-rs/esp-template` not found in config, using it as a git repository: https://github.com/esp-rs/esp-template.git
🤷   Project Name: esp-hal-embassy-i2s-example
🔧   Destination: /home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example ...
🔧   project-name: esp-hal-embassy-i2s-example ...
🔧   Generating template ...
✔ 🤷   Which MCU to target? · esp32c6
✔ 🤷   Configure advanced template options? · true
✔ 🤷   Enable allocations via the esp-alloc crate? · false
✔ 🤷   Configure project to use Dev Containers (VS Code and GitHub Codespaces)? · true
✔ 🤷   Configure project to support Wokwi simulation with Wokwi VS Code extension? · true
✔ 🤷   Add CI files for GitHub Action? · true
✔ 🤷   Setup logging using the log crate? · false
✔ 🤷   Enable WiFi/Bluetooth/ESP-NOW via the esp-wifi crate? · true

For more information and examples of esp-wifi showcasing Wifi,BLE and ESP-NOW, see https://github.com/esp-rs/esp-wifi/blob/main/examples.md

🔧   Moving generated files into: `/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example`...
🔧   Initializing a fresh Git repository
✨   Done! New project created /home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example

Then I just went and copied the example file over to main.rs on the template (knowing that some error related to embassy not being supported in this template was about to come (see issue #110))... which I could just cargo add a posteriori (I guessed/thought):

$ cp ~/dev/personal/esp-hal/examples/src/bin/embassy_i2s_read.rs src/main.rs

But to my surprise I saw a rust-lld error instead:

**$ cargo build**
    Updating crates.io index
   Compiling compiler_builtins v0.1.108
   Compiling core v0.0.0 (/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling proc-macro2 v1.0.79
(...)
   Compiling rustc-std-workspace-core v1.99.0 (/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling stable_deref_trait v1.2.0
   Compiling critical-section v1.1.2
   Compiling embedded-hal v1.0.0
(...)
   Compiling esp-hal-procmacros v0.9.0
   Compiling toml-cfg v0.2.0
   Compiling esp-wifi v0.4.0
   Compiling esp-hal-embassy-i2s-example v0.1.0 (/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/rvalls/.rustup/toolchains/esp/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin:/home/rvalls/.cargo/bin:/home/rvalls/.local/bin:/home/rvalls/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/rvalls/bin:/home/rvalls/.cargo/bin:/home/rvalls/.local/bin" VSLANG="1033" "rust-lld" "-flavor" "gnu" "/tmp/rustcmA6mXR/symbols.o" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/esp_hal_embassy_i2s_example-063c142ca19d7376.2i3849alp71bki3x.rcgu.o" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/esp_hal_embassy_i2s_example-063c142ca19d7376.2tdcd2j7axrtifay.rcgu.o" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/esp_hal_embassy_i2s_example-063c142ca19d7376.3viqmoyfka65imux.rcgu.o" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/esp_hal_embassy_i2s_example-063c142ca19d7376.4f6h3h3098xbdqid.rcgu.o" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/esp_hal_embassy_i2s_example-063c142ca19d7376.59saekkyk5q2rd7a.rcgu.o" "--as-needed" "-L" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps" "-L" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/debug/deps" "-L" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/build/esp-hal-5ffbef3d8649df06/out" "-L" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/build/esp32c6-5569b8076c7b815f/out" "-L" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/build/esp-wifi-sys-a6d9566cb1318e60/out" "-L" "/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "-Bstatic" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libesp_wifi-2795eb27ea25a704.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/liblibm-2015de921c444a0b.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libembedded_io-87faa3d2a6427b84.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libno_std_net-3064c7faece8791f.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libsmoltcp-37080918bd54803c.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libbitflags-c467ee6634653d67.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libmanaged-18ba70d6966f6ba0.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libportable_atomic_enum-ad4dc5abb852340e.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libnum_traits-3e1ac18aa0ab86e9.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libenumset-599eab6d00930b77.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libheapless-93d9d07c677fdbd5.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libhash32-054fa853e052153e.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libbyteorder-e474db96e9af9670.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libesp_wifi_sys-a2ec3eccdd367a0b.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/liblinked_list_allocator-22ed2403ebfd1778.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libesp_hal-d92a9163da885e22.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/librand_core-b2464270680fa59a.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libbitflags-87a42667e1ca2724.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/liblog-51c5419cb430d9de.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libbitfield-22d70d2a4b3d8b7b.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libcfg_if-3dce8855bb98cfd7.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libesp32c6-3b2ee938b3e8a068.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libvcell-22d0d314927e28f0.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libportable_atomic-5c2f2ca8489b2c1d.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libstrum-287db113fd8dd338.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libfugit-5ec28a2cd153fb83.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libgcd-d2ffb5dd905fedd3.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libembedded_hal-7bf665611b297a21.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libvoid-338761b8dbd20b26.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libnb-370af9ffead1760a.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libnb-84f55ae8c8fdd79e.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libembedded_dma-e2308f15a1ad2e63.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libstable_deref_trait-70d814b63e1d7b71.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libesp_riscv_rt-ecf0d3681c5587f7.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libriscv-74f9c4899e1a5422.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libembedded_hal-6d93fec87c694a05.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libesp_backtrace-5a560b67b1172cea.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libesp_println-0f7f805d4a27acc2.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libcritical_section-849b9bff03a16e6c.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/librustc_std_workspace_core-ee354db369433393.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libcore-e1f853f9323ffd53.rlib" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/libcompiler_builtins-3d65f49731891c93.rlib" "-Bdynamic" "-lble_app" "-lbtbb" "-lcoexist" "-lcore" "-lespnow" "-lmesh" "-lnet80211" "-lphy" "-lpp" "-lsmartconfig" "-lwapi" "-lwpa_supplicant" "-z" "noexecstack" "-L" "/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "-o" "/home/rvalls/dev/personal/pancake-legend-lights/src/esp-hal-embassy-i2s-example/target/riscv32imac-unknown-none-elf/debug/deps/esp_hal_embassy_i2s_example-063c142ca19d7376" "--gc-sections" "-Tlinkall.x" "-Trom_functions.x" "-nostartfiles" "-Tlinkall.x" "-Trom_functions.x"
  = note: rust-lld: error: unknown argument '-nostartfiles'

error: could not compile `esp-hal-embassy-i2s-example` (bin "esp-hal-embassy-i2s-example") due to 1 previous error

My local setup seems to be ok since the esp-hal example works out of the box, btw:

**esp-hal$ cargo xtask run-example esp-hal esp32c6 embassy_i2s_read**
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling memchr v2.7.1
   Compiling serde v1.0.197
   Compiling utf8parse v0.2.1
   Compiling anstyle v1.0.6
   Compiling colorchoice v1.0.0
   Compiling rustversion v1.0.14
   Compiling regex-syntax v0.8.2
   Compiling anstyle-query v1.0.2
   Compiling autocfg v1.1.0
   Compiling strsim v0.11.0
   Compiling heck v0.5.0
   Compiling heck v0.4.1
   Compiling log v0.4.21
   Compiling anyhow v1.0.81
   Compiling anstyle-parse v0.2.3
   Compiling clap_lex v0.7.0
   Compiling equivalent v1.0.1
   Compiling semver v1.0.22
   Compiling hashbrown v0.14.3
   Compiling anstream v0.6.13
   Compiling winnow v0.6.5
   Compiling toml_datetime v0.6.5
   Compiling ryu v1.0.17
   Compiling itoa v1.0.10
   Compiling humantime v2.1.0
   Compiling iana-time-zone v0.1.60
   Compiling clap_builder v4.5.2
   Compiling num-traits v0.2.18
   Compiling aho-corasick v1.1.3
   Compiling csv-core v0.1.11
   Compiling quote v1.0.35
   Compiling indexmap v2.2.5
   Compiling syn v2.0.53
   Compiling chrono v0.4.35
   Compiling regex-automata v0.4.6
   Compiling toml_edit v0.22.9
   Compiling regex v1.10.3
   Compiling env_filter v0.1.0
   Compiling env_logger v0.11.3
   Compiling serde_derive v1.0.197
   Compiling clap_derive v4.5.3
   Compiling strum_macros v0.26.2
   Compiling strum v0.26.2
   Compiling clap v4.5.3
   Compiling basic-toml v0.1.9
   Compiling csv v1.3.0
   Compiling minijinja v1.0.14
   Compiling xtask v0.0.0 (/home/rvalls/dev/personal/esp-hal/xtask)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 19.79s
     Running `target/debug/xtask run-example esp-hal esp32c6 embassy_i2s_read`
[2024-03-24T02:50:07Z WARN  xtask] Package 'esp-hal' specified, using 'examples' instead
[2024-03-24T02:50:07Z INFO  xtask] Building example '/home/rvalls/dev/personal/esp-hal/examples/src/bin/embassy_i2s_read.rs' for 'esp32c6'
[2024-03-24T02:50:07Z INFO  xtask]   Features: async,embassy,embassy-executor-thread,embassy-time-timg0,embassy-generic-timers
   Compiling compiler_builtins v0.1.108
   Compiling core v0.0.0 (/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.4
   Compiling typenum v1.17.0
   Compiling syn v1.0.109
   Compiling ident_case v1.0.1
   Compiling rustversion v1.0.14
   Compiling strsim v0.10.0
   Compiling fnv v1.0.7
   Compiling cfg-if v1.0.0
   Compiling heapless v0.8.0
   Compiling heck v0.4.1
   Compiling serde v1.0.197
   Compiling portable-atomic v1.6.0
   Compiling crc32fast v1.4.0
   Compiling embedded-hal-async v1.0.0
   Compiling static_assertions v1.1.0
   Compiling hashbrown v0.14.3
   Compiling adler v1.0.2
   Compiling equivalent v1.0.1
   Compiling embassy-time-driver v0.1.0
   Compiling miniz_oxide v0.7.2
   Compiling twox-hash v1.6.3
   Compiling riscv v0.11.1
   Compiling autocfg v1.1.0
   Compiling lazy_static v1.4.0
   Compiling embedded-io-async v0.6.1
   Compiling winnow v0.5.40
   Compiling toml_datetime v0.6.5
   Compiling generic-array v0.14.7
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling az v1.2.1
   Compiling byteorder v1.5.0
   Compiling quote v1.0.35
   Compiling litrs v0.4.1
   Compiling indexmap v2.2.5
   Compiling flate2 v1.0.28
   Compiling embassy-executor v0.5.0
   Compiling memchr v2.7.1
   Compiling embassy-sync v0.5.0
   Compiling paste v1.0.14
   Compiling esp32c6 v0.12.0 (https://github.com/esp-rs/esp-pacs?rev=963c280621f0b7ec26546a5eff24a5032305437f#963c2806)
   Compiling syn v2.0.53
   Compiling num-traits v0.2.18
   Compiling esp-println v0.9.1
   Compiling embassy-time-queue-driver v0.1.0
   Compiling embedded-hal-bus v0.1.0
   Compiling esp-backtrace v0.11.1
   Compiling document-features v0.2.8
   Compiling toml_edit v0.21.1
   Compiling darling_core v0.20.8
   Compiling proc-macro-crate v3.1.0
   Compiling strum_macros v0.26.2
   Compiling serde_derive v1.0.197
   Compiling num_enum_derive v0.7.2
   Compiling derive_more v0.99.17
   Compiling riscv-rt-macros v0.2.1
   Compiling darling_macro v0.20.8
   Compiling darling v0.20.8
   Compiling strum v0.26.2
   Compiling embassy-executor-macros v0.4.1
   Compiling enumset_derive v0.8.1
   Compiling ruzstd v0.6.0
   Compiling object v0.33.0
   Compiling rustc-std-workspace-core v1.99.0 (/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/rvalls/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling basic-toml v0.1.9
   Compiling esp-hal-procmacros v0.9.0 (/home/rvalls/dev/personal/esp-hal/esp-hal-procmacros)
   Compiling esp-metadata v0.1.0 (/home/rvalls/dev/personal/esp-hal/esp-metadata)
   Compiling esp-hal v0.16.1 (/home/rvalls/dev/personal/esp-hal/esp-hal)
   Compiling zeroize v1.7.0
   Compiling critical-section v1.1.2
   Compiling nb v1.1.0
   Compiling subtle v2.5.0
   Compiling rand_core v0.6.4
   Compiling embedded-hal v1.0.0
   Compiling stable_deref_trait v1.2.0
   Compiling void v1.0.2
   Compiling const-oid v0.9.6
   Compiling embedded-io v0.6.1
   Compiling futures-task v0.3.30
   Compiling nb v0.1.3
   Compiling pin-utils v0.1.0
   Compiling pin-project-lite v0.2.13
   Compiling base16ct v0.2.0
   Compiling embedded-hal v0.2.7
   Compiling futures-core v0.3.30
   Compiling log v0.4.21
   Compiling bytemuck v1.15.0
   Compiling ff v0.13.0
   Compiling der v0.7.8
   Compiling futures-util v0.3.30
   Compiling hash32 v0.3.1
   Compiling gcd v2.3.0
   Compiling display-interface v0.4.1
   Compiling group v0.13.0
   Compiling rgb v0.8.37
   Compiling vcell v0.1.3
   Compiling fugit v0.3.7
   Compiling embedded-hal-nb v1.0.0
   Compiling embedded-can v0.4.1
   Compiling embedded-dma v0.2.0
   Compiling bitfield v0.14.0
   Compiling bitflags v2.5.0
   Compiling embassy-futures v0.1.1
   Compiling smart-leds-trait v0.3.0
   Compiling esp-riscv-rt v0.7.0 (/home/rvalls/dev/personal/esp-hal/esp-riscv-rt)
   Compiling enumset v1.1.3
   Compiling byte-slice-cast v0.3.5
   Compiling display-interface-i2c v0.4.0
   Compiling num_enum v0.7.2
   Compiling micromath v2.1.0
   Compiling linked_list_allocator v0.10.5
   Compiling display-interface-spi v0.4.1
   Compiling esp-alloc v0.3.0
   Compiling static_cell v2.0.0
   Compiling smart-leds v0.4.0
   Compiling hex-literal v0.4.1
   Compiling usb-device v0.3.2
   Compiling crypto-common v0.1.6
   Compiling crypto-bigint v0.5.5
   Compiling sec1 v0.7.3
   Compiling block-buffer v0.10.4
   Compiling micromath v1.1.1
   Compiling inout v0.1.3
   Compiling cipher v0.4.4
   Compiling usbd-serial v0.2.1
   Compiling digest v0.10.7
   Compiling float-cmp v0.9.0
   Compiling accelerometer v0.12.0
   Compiling aes v0.8.4
   Compiling sha2 v0.10.8
   Compiling hmac v0.12.1
   Compiling embedded-graphics-core v0.4.0
   Compiling lis3dh-async v0.9.2
   Compiling embassy-time v0.3.0
   Compiling ssd1306 v0.8.4
   Compiling embedded-graphics v0.8.1
   Compiling elliptic-curve v0.13.8
   Compiling primeorder v0.13.6
   Compiling p256 v0.13.2
   Compiling p192 v0.13.0
warning: unused import: `crate::prelude`
    --> /home/rvalls/dev/personal/esp-hal/esp-hal/src/gpio.rs:3098:9
     |
3098 |     use crate::prelude::*;
     |         ^^^^^^^^^^^^^^
     |
     = note: `#[warn(unused_imports)]` on by default

   Compiling esp-hal-smartled v0.9.0 (/home/rvalls/dev/personal/esp-hal/esp-hal-smartled)
   Compiling examples v0.0.0 (/home/rvalls/dev/personal/esp-hal/examples)
warning: `esp-hal` (lib) generated 1 warning
    Finished `release` profile [optimized + debuginfo] target(s) in 35.49s
     Running `espflash flash --monitor target/riscv32imac-unknown-none-elf/release/embassy_i2s_read`
[2024-03-24T02:50:43Z INFO ] 🚀 A new version of espflash is available: v3.0.0
[2024-03-24T02:50:43Z INFO ] Serial port: '/dev/ttyUSB0'
[2024-03-24T02:50:43Z INFO ] Connecting...
[2024-03-24T02:50:43Z INFO ] Using flash stub
Chip type:         esp32c6 (revision v0.0)
Crystal frequency: 40MHz
Flash size:        8MB
Features:          WiFi 6, BT 5
MAC address:       60:55:f9:f7:00:4c
App/part. size:    36,816/8,323,072 bytes, 0.44%
[00:00:01] [========================================]      13/13      0x0                                                                                           [00:00:00] [========================================]       1/1       0x8000                                                                                        [00:00:01] [========================================]      21/21      0x10000                                                                                       [2024-03-24T02:50:47Z INFO ] Flashing has completed!
Commands:
    CTRL+R    Reset chip
    CTRL+C    Exit

ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xd48
0x4086c410 - __stack_chk_guard
    at ??:??
load:0x4086e610,len:0x2d68
0x4086e610 - _stack_start
    at ??:??
load:0x40875720,len:0x1800
0x40875720 - _stack_start
    at ??:??
SHA-256 comparison failed:
Calculated: 377c26481ad6ab0cce508450f353a55f4bd7eb9159aaf85fde3111071f164514
Expected: 0af544a033ab3492852b8232c904c578d5f07c9d4a423a64473f060db374ab32
Attempting to boot anyway...
entry 0x4086c410
0x4086c410 - __stack_chk_guard
    at ??:??
I (42) boot: ESP-IDF v5.1-beta1-378-gea5e0ff298-dirt 2nd stage bootloader
I (42) boot: compile time Jun  7 2023 08:02:08
I (43) boot: chip revision: v0.0
I (47) boot.esp32c6: SPI Speed      : 40MHz
I (52) boot.esp32c6: SPI Mode       : DIO
I (57) boot.esp32c6: SPI Flash Size : 8MB
I (61) boot: Enabling RNG early entropy source...
I (67) boot: Partition Table:
I (70) boot: ## Label            Usage          Type ST Offset   Length
I (78) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (85) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (92) boot:  2 factory          factory app      00 00 00010000 007f0000
I (100) boot: End of partition table
I (104) esp_image: segment 0: paddr=00010020 vaddr=42000020 size=0684ch ( 26700) map
I (118) esp_image: segment 1: paddr=00016874 vaddr=40800000 size=00014h (    20) load
I (121) esp_image: segment 2: paddr=00016890 vaddr=42006890 size=017e4h (  6116) map
I (131) esp_image: segment 3: paddr=0001807c vaddr=40800014 size=00f30h (  3888) load
I (139) boot: Loaded app from partition at offset 0x10000
I (144) boot: Disabling RNG early entropy source...
Init!
Start
available 4080
got 4080 bytes, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]..[0, 0, 83, fa, 0, 80, 83, fa, 0, 80]
available 4080
got 4080 bytes, [80, fa, 0, 0, 80, fa, 0, 0, 7c, fa]..[0, 80, 74, f8, 0, 0, 74, f8, 0, 0]
available 4080
got 4080 bytes, [74, f8, 0, 0, 74, f8, 0, 0, 73, f8]..[0, 80, 9b, f9, 0, 80, 9b, f9, 0, 80]
available 4080
got 4080 bytes, [98, f9, 0, 0, 98, f9, 0, 0, 9b, f9]..[0, 0, 54, fb, 0, 0, 54, fb, 0, 0]
available 4080
got 4080 bytes, [54, fb, 0, 0, 54, fb, 0, 0, 57, fb]..[0, 80, cb, fc, 0, 80, cb, fc, 0, 80]
available 4080
got 4080 bytes, [cf, fc, 0, 80, cf, fc, 0, 80, cf, fc]..[0, 0, d0, fd, 0, 0, d0, fd, 0, 0]
available 4080
got 4080 bytes, [d7, fd, 0, 80, d7, fd, 0, 80, d7, fd]..[0, 80, 9c, fe, 0, 0, 9c, fe, 0, 0]
available 4080
got 4080 bytes, [9c, fe, 0, 0, 9c, fe, 0, 0, 9c, fe]..[0, 80, 17, ff, 0, 80, 17, ff, 0, 80]
available 4080
got 4080 bytes, [17, ff, 0, 80, 17, ff, 0, 80, 18, ff]..[0, 0, 70, ff, 0, 0, 70, ff, 0, 0]
available 4080
got 4080 bytes, [74, ff, 0, 0, 74, ff, 0, 0, 73, ff]..[0, 80, a3, ff, 0, 80, a3, ff, 0, 80]
available 4080
got 4080 bytes, [a3, ff, 0, 80, a3, ff, 0, 80, a3, ff]..[0, 0, c4, ff, 0, 0, c4, ff, 0, 0]
available 4080
got 4080 bytes, [c4, ff, 0, 0, c4, ff, 0, 0, c4, ff]..[0, 0, db, ff, 0, 80, db, ff, 0, 80]
available 4080
got 4080 bytes, [db, ff, 0, 80, db, ff, 0, 80, dc, ff]..[0, 0, e8, ff, 0, 0, e8, ff, 0, 0]
available 4080
got 4080 bytes, [e8, ff, 0, 0, e8, ff, 0, 0, eb, ff]..[0, 0, fc, ff, 0, 0, fc, ff, 0, 0]
available 4080
got 4080 bytes, [fc, ff, 0, 0, fc, ff, 0, 0, fb, ff]..[0, 80, f0, ff, 0, 0, f0, ff, 0, 0]
available 4080
got 4080 bytes, [f0, ff, 0, 0, f0, ff, 0, 0, f3, ff]..[0, 80, fb, ff, 0, 80, fb, ff, 0, 80]
available 4080
got 4080 bytes, [fb, ff, 0, 80, fb, ff, 0, 80, fb, ff]..[0, 80, f8, ff, 0, 0, f8, ff, 0, 0]
available 4080
got 4080 bytes, [f8, ff, 0, 0, f8, ff, 0, 0, f8, ff]..[0, 0, 3, 0, 0, 80, 3, 0, 0, 80]
available 4080
got 4080 bytes, [3, 0, 0, 80, 3, 0, 0, 80, 3, 0]..[0, 80, f7, ff, 0, 80, f7, ff, 0, 80]
available 4080
got 4080 bytes, [f8, ff, 0, 0, f8, ff, 0, 0, f8, ff]..[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
available 4080
got 4080 bytes, [3, 0, 0, 80, 3, 0, 0, 80, 3, 0]..[0, 0, 4, 0, 0, 0, 4, 0, 0, 0]
available 4080
got 4080 bytes, [7, 0, 0, 80, 7, 0, 0, 80, 8, 0]..[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
available 4080
got 4080 bytes, [ff, ff, 0, 80, ff, ff, 0, 80, ff, ff]..[0, 0, 8, 0, 0, 0, 8, 0, 0, 0]
available 4080
got 4080 bytes, [b, 0, 0, 80, b, 0, 0, 80, b, 0]..[0, 0, ff, ff, 0, 80, ff, ff, 0, 80]
available 4080
got 4080 bytes, [fc, ff, 0, 0, fc, ff, 0, 0, fc, ff]..[0, 80, 0, 0, 0, 0, 0, 0, 0, 0]
available 4080
got 4080 bytes, [3, 0, 0, 80, 3, 0, 0, 80, ff, ff]..[0, 80, ff, ff, 0, 80, ff, ff, 0, 80]
available 4080
got 4080 bytes, [fc, ff, 0, 0, fc, ff, 0, 0, fc, ff]..[0, 80, 0, 0, 0, 0, 0, 0, 0, 0]
available 4080
got 4080 bytes, [0, 0, 0, 0, 0, 0, 0, 0, 3, 0]..[0, 0, 8, 0, 0, 0, 8, 0, 0, 0]
available 4080
got 4080 bytes, [4, 0, 0, 0, 4, 0, 0, 0, 4, 0]..[0, 80, 4, 0, 0, 0, 4, 0, 0, 0]
available 4080
got 4080 bytes, [7, 0, 0, 80, 7, 0, 0, 80, 3, 0]..[0, 0, 8, 0, 0, 0, 8, 0, 0, 0]
available 4080
got 4080 bytes, [7, 0, 0, 80, 7, 0, 0, 80, 4, 0]..[0, 80, 7, 0, 0, 80, 7, 0, 0, 80]
available 4080
got 4080 bytes, [4, 0, 0, 0, 4, 0, 0, 0, 4, 0]..[0, 80, 4, 0, 0, 0, 4, 0, 0, 0]
available 4080
got 4080 bytes, [4, 0, 0, 0, 4, 0, 0, 0, 7, 0]..[0, 0, 7, 0, 0, 80, 7, 0, 0, 80]
available 4080
got 4080 bytes, [7, 0, 0, 80, 7, 0, 0, 80, 8, 0]..[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
available 4080
got 4080 bytes, [ff, ff, 0, 80, ff, ff, 0, 80, fc, ff]..[0, 0, 4, 0, 0, 0, 4, 0, 0, 0]
available 4080
got 4080 bytes, [7, 0, 0, 80, 7, 0, 0, 80, 4, 0]..[0, 0, 4, 0, 0, 0, 4, 0, 0, 0]
available 4080
got 4080 bytes, [4, 0, 0, 0, 4, 0, 0, 0, 4, 0]..[0, 0, 7, 0, 0, 80, 7, 0, 0, 80]
available 4080
got 4080 bytes, [7, 0, 0, 80, 7, 0, 0, 80, 7, 0]..[0, 0, 3, 0, 0, 80, 3, 0, 0, 80]
available 4080
got 4080 bytes, [3, 0, 0, 80, 3, 0, 0, 80, 0, 0]..[0, 80, 4, 0, 0, 0, 4, 0, 0, 0]
available 4080
got 4080 bytes, [ff, ff, 0, 80, ff, ff, 0, 80, 0, 0]..[0, 0, fc, ff, 0, 0, fc, ff, 0, 0]
(...) CTRL-C

For context I'm just trying to pipe I2S mems microphone data, see https://github.com/esp-rs/esp-println/issues/29#issuecomment-2016655068.

What I am doing wrong here w.r.t the rust-lld -nostartfiles error?

SergioGasquez commented 7 months ago

As mentioned in https://github.com/esp-rs/esp-hal/issues/1336#issuecomment-2014543276, looks like you are missing some .cargo/config.toml configurations.

Feel free to reopen the issue if you consider it is not completed.

brainstorm commented 7 months ago

@SergioGasquez Not the same issue, here's my .cargo/config.toml:

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

[build]
rustflags = [
  "-C", "link-arg=-Tlinkall.x",

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

target = "riscv32imac-unknown-none-elf"

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

could you please point out what I'm missing? Also I don't seem to be able to reopen the issue, perhaps that option is disabled in this repo?

bjoernQ commented 7 months ago

There is something strange going on.

-nostartfiles should only get added to .cargo/config.toml for Xtensa: https://github.com/esp-rs/esp-template/blob/21b13bc6089ef67d65e869b7fd03545de3289eff/.cargo/config.toml#L16-L18

And in the posted file above it's not present - so the big question would be what adds that option?

brainstorm commented 7 months ago

Since I cannot tell if the last question is aimed at me, I re-did the steps above just in case (with no advanced template options this time)... and got another rust-lld missing file, the rom_functions.x one too this time:

$ cargo generate esp-rs/esp-template
⚠️   Favorite `esp-rs/esp-template` not found in config, using it as a git repository: https://github.com/esp-rs/esp-template.git
🤷   Project Name: rust
🔧   Destination: /home/rvalls/dev/personal/pancake-legend-lights/src/rust ...
🔧   project-name: rust ...
🔧   Generating template ...
✔ 🤷   Which MCU to target? · esp32c6
✔ 🤷   Configure advanced template options? · false
🔧   Moving generated files into: `/home/rvalls/dev/personal/pancake-legend-lights/src/rust`...
🔧   Initializing a fresh Git repository
✨   Done! New project created /home/rvalls/dev/personal/pancake-legend-lights/src/rust

Here's the generated .cargo/config.toml

$ cat .cargo/config.toml 
[target.riscv32imac-unknown-none-elf]
runner = "espflash flash --monitor"

[build]
rustflags = [
  "-C", "link-arg=-Tlinkall.x",

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

target = "riscv32imac-unknown-none-elf"

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

Here's the end of cargo build (also fails the same way with --release):

(...)
  = note: rust-lld: error: unknown argument '-nostartfiles'
          rust-lld: error: cannot find linker script rom_functions.x

Are any of you two @bjoernQ and/or @SergioGasquez able to reproduce this issue or it's just me?

bjoernQ commented 7 months ago

I'm not able to reproduce it given the steps above. But since it seems cargo is picking up something which is not in your generated .cargo/config.toml maybe it's picking up something from another file: https://doc.rust-lang.org/cargo/reference/config.html - e.g. having a config.toml in $CARGO_HOME or in any of the other options provided

bjoernQ commented 7 months ago

Maybe the output of cargo -Z unstable-options config get might help

brainstorm commented 7 months ago

cargo -Z unstable-options config get

Thanks @bjoernQ, here it is:

$ cargo -Z unstable-options config get
build.rustflags = ["-C", "link-arg=-Tlinkall.x", "-C", "link-arg=-Trom_functions.x", "-C", "link-arg=-nostartfiles", "-C", "link-arg=-Tlinkall.x", "-C", "force-frame-pointers"]
build.target = "riscv32imac-unknown-none-elf"
env.ESP_LOGLEVEL = "INFO"
target.riscv32imac-unknown-none-elf.runner = "espflash flash --monitor"
target.xtensa-esp32s3-none-elf.runner = "espflash flash --monitor"
unstable.build-std = ["core", "core"]
# The following environment variables may affect the loaded values.
# CARGO_HOME=/home/rvalls/.cargo

On a quick look, I don't see any config overrides/definitions in /home/rvalls/.cargo:

$ cat ~/.cargo/
bin/                   .crates.toml           git/                   .package-cache         registry/              
.crates2.json          env                    .global-cache          .package-cache-mutate  
rvalls@framework:~/dev/personal/pancake-legend-lights/src/rust$ cat ~/.cargo/.crates.toml 
[v1]
"binocle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = ["binocle"]
"cargo-generate 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-generate"]
"du-dust 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = ["dust"]
"espflash 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["espflash"]
"espup 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = ["espup"]
"just 1.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["just"]
"qrrs 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = ["qrrs"]
"ravedude 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = ["ravedude"]
rvalls@framework:~/dev/personal/pancake-legend-lights/src/rust$ cat ~/.cargo/env 
#!/bin/sh
# rustup shell setup
# affix colons on either side of $PATH to simplify matching
case ":${PATH}:" in
    *:"$HOME/.cargo/bin":*)
        ;;
    *)
        # Prepending path in case a system-installed rustc needs to be overridden
        export PATH="$HOME/.cargo/bin:$PATH"
        ;;
esac

rvalls@framework:~/dev/personal/pancake-legend-lights/src/rust$ env | grep -i cargo
PATH=/home/rvalls/.rustup/toolchains/esp/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin:/home/rvalls/.rustup/toolchains/esp/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin:/home/rvalls/.cargo/bin:/home/rvalls/.local/bin:/home/rvalls/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/rvalls/bin:/home/rvalls/.cargo/bin:/home/rvalls/.local/bin

Thanks for the assistance either way!

bjoernQ commented 7 months ago

Just for reference this is what the effective config looks for me

❯ cargo -Z unstable-options config get
build.rustflags = ["-C", "link-arg=-Tlinkall.x", "-C", "link-arg=-Trom_functions.x", "-C", "force-frame-pointers"]
build.target = "riscv32imac-unknown-none-elf"
target.riscv32imac-unknown-none-elf.runner = "espflash flash --monitor"
unstable.build-std = ["core"]
# The following environment variables may affect the loaded values.
# CARGO_HOME=C:\Users\Bjoern\.cargo

e.g. target.xtensa-esp32s3-none-elf.runner = "espflash flash --monitor" looks suspicious and also the problematic "-C", "link-arg=-nostartfiles", is there

cargo -Z unstable-options config get --show-origin might help .... it should show where each setting is from

brainstorm commented 7 months ago

Aha! Thanks so much, there was this remaining .cargo leftover from a previous template generation on the top level of the project (I was generating sub-rust projects and posting the sub-.cargo dirs), I didn't know that top level .cargo (not $HOME/.cargo, but repo top level) took precedence, interesting behavior!:

$ cat .cargo/config.toml 
[target.xtensa-esp32s3-none-elf]
runner = "espflash flash --monitor"

[env]
ESP_LOGLEVEL="INFO"
[build]
rustflags = [
  "-C", "link-arg=-Tlinkall.x",
"-C", "link-arg=-Trom_functions.x",

  "-C", "link-arg=-nostartfiles",
]

target = "xtensa-esp32s3-none-elf"

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

Thanks so much for the help, apologies for the confusion!