lights0123 / async-avr

async/await for AVR with Rust
https://lights0123.com/blog/2020/07/25/async-await-for-avr-with-rust/
Apache License 2.0
33 stars 5 forks source link

Switch to crates.io version of avr-device #1

Closed Rahix closed 4 years ago

Rahix commented 4 years ago

Hey,

I've published avr-device to crates.io and this removes all the build-dependency madness. In this PR, I've updated your repo to reflect the changes. You might want to update your blog-post as well :)

Disclaimer: I could only compile-test the change. While this shouldn't break anything, I suggest, you quickly test for yourself if everything is still working ...

audioXD commented 4 years ago

Currently it doesn't build on nightly, since the version is rustc 1.46.0-nightly (346aec9b0 2020-07-11), but the minimum version is rustc 1.47.0-nightly (0820e54a8 2020-07-23).

lights0123 commented 4 years ago

@audioXD now that rustfmt is available in the latest nightly, we can finally get rid of that!

lights0123 commented 4 years ago

@Rahix thanks, that's much better!

One thing to think about is using #[lang = "start"] instead of a macro. I used it in another project, and it allows you to remove #![no_main] and anything special around the main function. The reason the ARM stuff doesn't use it is because they're designed to compile on stable, which doesn't support defining that. If you think that we'll sometime compile on stable, sure, keep it, but if not, maybe consider switching to that.

Rahix commented 4 years ago

The macro also allows much more customization, like the static mut transformations which is really helpful in embedded applications. Also, when you start writing custom runtime code, this gives more flexibility.

audioXD commented 4 years ago

@lights0123 I had that comment because when i build with the current nightly version that's not the actual latest I get get an error.

[audioxd@Tims-PC-001 async-avr]$ rustup override set nightly
info: using existing install for 'nightly-x86_64-unknown-linux-gnu'
info: override toolchain for '/home/audioxd/Documents/Projects/async-avr' set to 'nightly-x86_64-unknown-linux-gnu'

  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.46.0-nightly (346aec9b0 2020-07-11)

[audioxd@Tims-PC-001 async-avr]$ cargo build --target=avr-atmega328p.json -Z build-std="core" --examples
***SKIPED LINES***

error: could not compile `async-avr`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: linking with `avr-gcc` failed: exit code: 1
  |
  = note: "avr-gcc" "-Os" "-mmcu=atmega328p" "-Wl,--eh-frame-hdr" "-L" "/home/audioxd/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "/home/audioxd/Documents/Projects/async-avr/target/avr-atmega328p/debug/examples/serial-12f51f827fcd8952.serial.dp74pwxw-cgu.2.rcgu.o" "-o" "/home/audioxd/Documents/Projects/async-avr/target/avr-atmega328p/debug/examples/serial-12f51f827fcd8952.elf" "-Wl,--gc-sections" "-L" "/home/audioxd/Documents/Projects/async-avr/target/avr-atmega328p/debug/deps" "-L" "/home/audioxd/Documents/Projects/async-avr/target/debug/deps" "-L" "/home/audioxd/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-Wl,--start-group" "-Wl,--end-group" "-Wl,-Bstatic" "/home/audioxd/Documents/Projects/async-avr/target/avr-atmega328p/debug/deps/libcompiler_builtins-49d9ec43f42b08f8.rlib" "-Wl,-Bdynamic" "-Wl,--gc-sections"
  = note: /usr/bin/avr-ld: unrecognized option '--eh-frame-hdr'
          /usr/bin/avr-ld: use the --help option for usage information
          collect2: error: ld returned 1 exit status

I feel like it ignores the target file, more specificaly the"eh-frame-header": false. So I suggest using rustup override set nightly-2020-07-24

lights0123 commented 4 years ago

@audioXD you haven't updated your nightly rust since the 11th, run rustup update nightly

audioXD commented 4 years ago

@lights0123
NWM I just ran rustup update nightly --force and got the acctual latest version. And yes i have tried running it without --force

lights0123 commented 4 years ago

@audioXD did you have miri installed? --force will force installation, even if certain components aren't available. Miri still isn't available for nightly since 2020-07-18, so that could be why

audioXD commented 4 years ago

@lights0123 Oh... Yes i did :p. I also notices that it has to be built with the --release flag