avr-rust / delay

arduino-like delay routines based on busy-wait loops
Apache License 2.0
15 stars 11 forks source link

llvm_asm macro has been deprecated #10

Closed ergpopler closed 2 years ago

ergpopler commented 4 years ago

llvm_asm! has been deprecated, and it no longer works...

and trying to get it to work makes it not work in other ways.

dylanmckay commented 3 years ago

Hey there,

I notice that the llvm_asm! macro has been semi deprecated, but it still should be working.

It works for me with current master at 2b14a0836cdbf978d8da24b34a3bcfd07bd7e901 and up-to-date nightly compiler version:

rustc 1.49.0-nightly (07e968b64 2020-10-27)
cargo 1.49.0-nightly (dd83ae55c 2020-10-20)

I notice in https://github.com/rust-lang/rust/issues/70173 that some time ago people temporarily started getting errors saying that llvm_asm! is gone, but that seems to be an old temporary rust nightly issue.

I can compile the crate fine on my machine.

Re. updating to the new asm! macro:

The Rust toolchain needs currently not-implemented target-specific support for enabling the asm! macro on AVR:

error[E0472]: asm! is unsupported on this target
  --> src/lib.rs:36:13
   |
36 |             asm!("nop");
   |             ^

What version of nightly are you using/does upgrading fix the problem?

ArthurFleischman commented 3 years ago

any improvements?

dylanmckay commented 3 years ago

The llvm_asm macro should still work. I added an example in d9eff3810b1101739045c45299b2de5cd107bcf1 and it compiles on my machine fine. I vaguely remember that a temporary llvm_asm macro regression caused it to stop working around this time. The asm macro is still not supported by AVR.

andrewshadura commented 3 years ago

I’m getting an error with the latest nightly with both 0.3.1 and 0.3.2:

error: couldn't allocate input reg for constraint 'w'
  --> .../avr_delay-0.3.2/src/lib.rs:34:17
   |
34 |         unsafe {llvm_asm!("1: sbiw $0,1
   |                 ^

error: couldn't allocate input reg for constraint 'w'
  --> .../avr_delay-0.3.2/src/lib.rs:41:13
   |
41 |     unsafe {llvm_asm!("1: sbiw $0,1
   |             ^
benstockil commented 3 years ago

Yeah, I'm getting the same issue as @andrewshadura. Is there a way around this error?

polawat commented 3 years ago

I got a similar issue and got it to work bychanging the nightly version to nightly-2021-01-07

rustup override set nightly-2021-01-07

zag2art commented 2 years ago

https://github.com/rust-lang/rust/pull/92816 Any improvements according to this?

stappersg commented 2 years ago

Any improvements according to this?

https://github.com/Rahix/avr-device/issues/91

stappersg commented 2 years ago

18 has been merged, now dealing with #19 ...

stappersg commented 2 years ago

This not an issue any more.