esp-rs / rust

Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266
https://www.rust-lang.org
Other
744 stars 39 forks source link

Can't use inline assembly #64

Closed NathanMcMillan54 closed 3 years ago

NathanMcMillan54 commented 3 years ago

When I try to compile anything that uses an assembly macro on any xtensa target, I get this error:

error[E0472]: inline assembly is unsupported on this target

This is my .cargo/config.toml:

[target.xtensa-esp32-none-elf]
rustflags = [
    "-C", "link-arg=-nostartfiles",
]

And I compiled with:

cargo xbuild --target xtensa-esp32-none-elf

Did I compile the compiler wrong? Or did I compile the project wrong?

MabezDev commented 3 years ago

Typed Inline asm has not been ported to the xtensa arch yet, see #32. You can however use the llvm_asm! macro.

NathanMcMillan54 commented 3 years ago

But when I try to compile xtensa-lx-rt I get this error because of the global_asm! macro. How does that get compiled?

MabezDev commented 3 years ago

I see, it seems global_asm! has been ported to the asm! format, without providing a global_llvm_asm! alternative. I'll see what I can do to work around this.

MabezDev commented 3 years ago

Hi @NathanMcMillan54, sorry about the trouble - I have added support for the new asm! format and merged it into the esp branch. New releases of xtensa-lx, xtensa-lx-rt have been released too with support for this assembly syntax.

Please report back if you run into any issues - hope this helps :)

NathanMcMillan54 commented 3 years ago

Oh thanks! I'll see if it worked

NathanMcMillan54 commented 3 years ago

This isn't related to this issue, when I recompiled Xtensa Rust and try to compile anything I get this error:

error: linking with `xtensa-esp32-elf-gcc` failed: exit status: 1
  |
  = note: "xtensa-esp32-elf-gcc" .... a ton of file paths....

    ....

  = note: xtensa-esp32-elf-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
          compilation terminated.

Is liblto_plugin.so a file I need to install?

MabezDev commented 3 years ago

Seems like you have an old version on xtensa gcc? Try with the latest from here: https://github.com/espressif/crosstool-NG/releases.

NathanMcMillan54 commented 3 years ago

Thanks! I'll try that