embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.51k stars 767 forks source link

Xtensa timer linker issues #1028

Closed brandonros closed 2 years ago

brandonros commented 2 years ago
#![no_std]
#![no_main]

use core::fmt::Write;
use core::cell::RefCell;
use critical_section::Mutex;
use esp32_hal::{
    clock::ClockControl,
    pac::{Peripherals, TIMG0, UART0},
    prelude::*,
    timer::{Timer, Timer0, Timer1, TimerGroup},
    Rtc,
    Serial,
};
use esp_backtrace as _;
use embassy_executor::Executor;
use embassy_executor::raw::TaskStorage;
use nb::block;
use static_cell::StaticCell;
use xtensa_lx_rt::entry;

static EXECUTOR: StaticCell<Executor> = StaticCell::new();

static TIMER0: Mutex<RefCell<Option<Timer<Timer0<TIMG0>>>>> = Mutex::new(RefCell::new(None));
static TIMER1: Mutex<RefCell<Option<Timer<Timer1<TIMG0>>>>> = Mutex::new(RefCell::new(None));
static SERIAL0: Mutex<RefCell<Option<Serial<UART0>>>> = Mutex::new(RefCell::new(None));

async fn task1() {
    loop {
        /*critical_section::with(|cs| {
            // get serial0
            let mut serial0 = SERIAL0.borrow_ref_mut(cs);
            let serial0 = serial0.as_mut().unwrap();
            // write
            writeln!(serial0, "Hello world1!").unwrap();
            // sleep
            Timer::after(Duration::from_millis(500)).await;
        });*/
        embassy_time::Timer::after(embassy_time::Duration::from_millis(500)).await;
    }
}

async fn task2() {
    loop {
        critical_section::with(|cs| {
            // get timer0
            let mut timer1 = TIMER1.borrow_ref_mut(cs);
            let timer1 = timer1.as_mut().unwrap();
            // start timer
            timer1.start(1u64.secs());
            // get serial0
            let mut serial0 = SERIAL0.borrow_ref_mut(cs);
            let serial0 = serial0.as_mut().unwrap();
            // write
            writeln!(serial0, "Hello world2!").unwrap();
            // sleep
            block!(timer1.wait()).unwrap();
        });
    }
}

unsafe fn make_static<T>(t: &T) -> &'static T {
    return core::mem::transmute(t);
}

#[entry]
fn main() -> ! {
    let peripherals = Peripherals::take().unwrap();
    // disable watchdogs
    let system = peripherals.DPORT.split();
    let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
    let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks);
    let mut wdt = timer_group0.wdt;
    let mut rtc = Rtc::new(peripherals.RTC_CNTL);
    wdt.disable();
    rtc.rwdt.disable();
    // init static variables
    critical_section::with(|cs| {
        TIMER0.borrow_ref_mut(cs).replace(timer_group0.timer0);
        TIMER1.borrow_ref_mut(cs).replace(timer_group0.timer1);
        SERIAL0.borrow_ref_mut(cs).replace(Serial::new(peripherals.UART0));
    });
    // start embasssy executor + tasks
    let executor = EXECUTOR.init(Executor::new());
    let task1_task = TaskStorage::new();
    let task1_task = unsafe { make_static(&task1_task) };
    let task2_task = TaskStorage::new();
    let task2_task = unsafe { make_static(&task2_task) };
    executor.run(|spawner| {
        let spawn_task1_token = task1_task.spawn(|| {
            return task1();
        });
        let spawn_task2_token = task2_task.spawn(|| {
            return task2();
        });
        spawner.spawn(spawn_task1_token).unwrap();
        spawner.spawn(spawn_task2_token).unwrap();
    });
}
[package]
name = "esp32_isotp_ble_bridge_rs"
version = "0.1.0"
authors = ["Brandon Ros <brandonros1@gmail.com>"]
edition = "2021"
license = "MIT OR Apache-2.0"

[patch.crates-io]
esp32-hal = { git = "https://github.com/esp-rs/esp-hal", branch = "main" }
embassy-futures = { git = "https://github.com/embassy-rs/embassy" }
embassy-executor = { git = "https://github.com/embassy-rs/embassy" }
embassy-sync = { git = "https://github.com/embassy-rs/embassy" }
embassy-time = { git = "https://github.com/embassy-rs/embassy" }
embassy-macros = { git = "https://github.com/embassy-rs/embassy" }
embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy" }

[dependencies]
esp32-hal = { version = "0.5.0", features = ["rt", "vectored"] }
esp-backtrace = { version = "0.2.0", features = ["esp32", "panic-handler", "print-uart"] }
xtensa-atomic-emulation-trap = "0.2.0"
xtensa-lx-rt = { version = "0.13.0", features = ["esp32"], optional = true }
embassy-executor = { version = "0.1.0", features = ["nightly"] }
static_cell = "1.0.0"
critical-section = "1.1.1"
embassy-sync = { version = "0.1.0" }
embassy-time = { version = "0.1.0", features = ["unstable-traits"] }

[features]
default = ["rt"]
rt = ["xtensa-lx-rt"]
Brandons-MacBook-Air:esp32-isotp-ble-bridge-rs brandonros 2022-10-26 00:02:07 $ cargo run
warning: Patch `embassy-embedded-hal v0.1.0 (https://github.com/embassy-rs/embassy#ce1cba76)` was not used in the crate graph.
Patch `embassy-futures v0.1.0 (https://github.com/embassy-rs/embassy#ce1cba76)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
   Compiling esp32_isotp_ble_bridge_rs v0.1.0 (/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs)
error: linking with `xtensa-esp32-elf-gcc` failed: exit status: 1
  |
  = note: "xtensa-esp32-elf-gcc" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.13li4ibzmjfapmvu.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.15cuta8jzclvdsca.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.1k4cmcvl2lxjxcpp.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.1tl7sgx3uk8xdehb.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.1ujmixfqb9y0g3hh.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.1vxiiu2q13a48q0q.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.1wopjl0ts3td9kc8.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.1z4ar81ma40452u0.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.1zcbtzvcqqe6jh5a.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.22xg5obz4jhac5e1.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.2joquvwumuqb6dy2.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.2o4dlmz68c0vzk4v.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.2snmeszvg5agat7o.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.2tu86de1hxyftr27.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3b91p66n29xfzhfv.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3fxstlrv5d1fakdk.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3fy0grjg8f9tid6d.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3hw8wj70060mke7u.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3k7u8jg4ybv3ogzi.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3pyadsmijm1dq1z9.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3rb2dqj3h3bmyvoz.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3vxbp9ddvfv4m6jj.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.3yifhb9ua5xad5v0.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.47zy57mkrjbbc9ps.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.4iz6ek4dsd45sfrh.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.4nr84r5fb46o5l4l.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.4qzc3usg1ytw9zrw.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.4v8bsjbti4tl42j1.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.50w7k7n3egt4dx0x.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.55xcdkpz94qb0te5.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.56briwfdupdwc2y8.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.6esjoknj98tvpu7.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.a4vwyaz34eokg2s.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.e0l9eokzofk42i8.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.htzhai8ibvlmarv.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.juk4eqy8pufnzsq.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.lrzz81evr4yil4z.rcgu.o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1.onuw6istvroyjv5.rcgu.o" "-Wl,--as-needed" "-L" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps" "-L" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/debug/deps" "-L" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/build/xtensa-lx-rt-73885c5ce5e53b90/out" "-L" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/build/esp32-hal-520e8ed3a98e18d1/out" "-L" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/build/esp32-caff1f2e34f2b6f3/out" "-L" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/build/xtensa-lx-d741274244c621fb/out" "-L" "/Users/brandonros/.rustup/toolchains/esp/lib/rustlib/xtensa-esp32-none-elf/lib" "-Wl,-Bstatic" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libembassy_time-afea6a5cbf7cc4eb.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libembedded_hal-b8cc834576ee2f89.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libfutures_util-5ec3d12a9086eaaf.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libpin_project_lite-5834c61dd56996c7.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libfutures_task-3e88d6b7d23f6c4b.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libpin_utils-970e92842f9dbb83.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libfutures_core-1bfe02c1a7391968.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libembassy_executor-d333ff193dd74802.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libstatic_cell-e2e248fa9462e1ae.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libatomic_polyfill-bad5d3c8628cd6e4.rlib" "-Wl,--start-group" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libesp_backtrace-120c7ae80abd2236.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libesp_println-c60db6016ee2d3d8.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libesp32_hal-4bc9c585f7f31555.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libesp_hal_common-400b5aa97f2735b5.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libcfg_if-640ca2173be544ec.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libxtensa_lx_rt-c24a14641b637615.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libr0-247f2c5fe383a05d.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libembedded_dma-5200cce34dcb54ef.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libstable_deref_trait-d93859dc30d7c765.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libfugit-5ff9d1d2d568b585.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libgcd-d6ea915ce3ea62da.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libesp32-43706ae7b2202d48.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libxtensa_lx-195ea8497f3b59fc.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libspin-03c45b8613c989db.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/liblock_api-cd099748c6ab8137.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libscopeguard-2cfe362ea059ca0a.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libmutex_trait-adb6c6f1b12c53d7.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libbare_metal-4b717d1e0fa9dd79.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libvcell-769e3a77cf132604.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libembedded_hal-fcf82360910268c6.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libvoid-784d1693b6c7c6b0.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libnb-5b606cad9fa070e2.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libnb-54155659fa92d199.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libcritical_section-cad6e53ec39cb11a.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/librustc_std_workspace_core-c0749c4a668b674e.rlib" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libcore-6c69c78751649ab6.rlib" "-Wl,--end-group" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libcompiler_builtins-6e148239eb699df2.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/Users/brandonros/.rustup/toolchains/esp/lib/rustlib/xtensa-esp32-none-elf/lib" "-o" "/Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/esp32_isotp_ble_bridge_rs-5728fbcba8b986d1" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "-nostartfiles" "-Wl,-Tlinkall.x"
  = note: /Users/brandonros/.espressif/tools/xtensa-esp32-elf-gcc/8_4_0-esp-2021r2-patch3-aarch64-apple-darwin/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libembassy_time-afea6a5cbf7cc4eb.rlib(embassy_time-afea6a5cbf7cc4eb.embassy_time.f798f7b8-cgu.8.rcgu.o):(.literal._ZN12embassy_time5timer13schedule_wake17hbf5829a2ccb62437E+0x0): undefined reference to `_embassy_time_schedule_wake'
          /Users/brandonros/.espressif/tools/xtensa-esp32-elf-gcc/8_4_0-esp-2021r2-patch3-aarch64-apple-darwin/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /Users/brandonros/Desktop/esp32-isotp-ble-bridge-rs/target/xtensa-esp32-none-elf/debug/deps/libembassy_time-afea6a5cbf7cc4eb.rlib(embassy_time-afea6a5cbf7cc4eb.embassy_time.f798f7b8-cgu.12.rcgu.o):(.literal._ZN12embassy_time6driver3now17h9d2f6b0b9d8823aaE+0x0): undefined reference to `_embassy_time_now'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `esp32_isotp_ble_bridge_rs` due to previous error
Brandons-MacBook-Air:esp32-isotp-ble-bridge-rs brandonros 2022-10-26 00:02:55 $ 

loosely related to https://github.com/embassy-rs/embassy/pull/805

@MabezDev

brandonros commented 2 years ago

I think I was missing "-C", "link-arg=-Tesp32_rom_functions.x",?

[target.xtensa-esp32-none-elf]
runner = "espflash --monitor /dev/tty.usbserial-02728E37 --monitor-speed 115200"

[build]
rustflags = [
  "-C", "link-arg=-nostartfiles",
  "-C", "link-arg=-Wl,-Tlinkall.x",
  "-C", "link-arg=-Tesp32_rom_functions.x",
]
target = "xtensa-esp32-none-elf"

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