japaric-archived / photon-quickstart

Cargo template for developing photon applications
Apache License 2.0
43 stars 5 forks source link

can't perform LTO when compiling incrementally #17

Closed autodidaddict closed 6 years ago

autodidaddict commented 6 years ago

I'm on Rust nightly 1.25, following the instructions you indicate. I'm on Ubuntu linux and I have the particle CLI installed. Getting the following message when attempting to run xargo build --example function:

error: can't perform LTO when compiling incrementally

error: Could not compile `my-app`.
autodidaddict commented 6 years ago

When I manually set cargo incremental to 0, I get the following error:

$ CARGO_INCREMENTAL=0 xargo build --example function
   Compiling my-app v0.1.0 (file:///home/kevin/Code/Rust/particle/my-app)
error: internal compiler error: librustc_metadata/cstore_impl.rs:131: get_optimized_mir: missing MIR for `DefId(2/0:6 ~ photon[2100]::lang_items[0]::start[0])`

thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:535:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.25.0-nightly (bd98fe0c0 2018-02-06) running on x86_64-unknown-linux-gnu

error: Could not compile `my-app`.
japaric commented 6 years ago

Thanks for the report.

I have fixed the last problem you reported in the photon crate. Run a cargo update and try to build again. I'll patch the incremental stuff in a bit.

autodidaddict commented 6 years ago

Works like a champ now! Thanks so much

autodidaddict commented 6 years ago

@japaric when I try and push the binary to the device (for whatever reason I can't flash remotely on Ubuntu.. it just times out), I get the following:

Download done.
File downloaded successfully
dfu-util: Error during download get_status

Error writing firmware...dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!

dfu-util: Error during download get_status

it looks like after it fails it goes back to the factory default firmware. I tried this with function and with blinky

japaric commented 6 years ago

Error writing firmware...dfu-util: Invalid DFU suffix signature

Perhaps they changed how they add / compute the CRC of the binary file in recent versions. This is functionality we replicate in the elf2bin tool. If you go to an older version (3 or 4 months old) of particle-cli things may work.

Also note that v0.6.2 of the firmware should be installed on the Photon. Newer versions of the firmware will probably not work with photon-quickstart.