rust-embedded / cortex-m-semihosting

Semihosting for ARM Cortex-M processors
Apache License 2.0
40 stars 19 forks source link

Semihosting broken with rust-lld #23

Closed MabezDev closed 6 years ago

MabezDev commented 6 years ago

After changing my project to use lld, the semi hosting calls don't go through it hangs on the __syscall(_nr, _arg) in lib.rs:150. I switched back to gcc to confirm they still work.

Flags for rust-lld

rustflags = ["-C", "link-arg=-Tlink.x"]

Flags for GCC

rustflags = [
  "-C", "link-arg=-Tlink.x",
  "-C", "linker=arm-none-eabi-ld",
  "-Z", "linker-flavor=ld",
  "-Z", "thinlto=no",
]

Edit:

I should mention I am only using panic-semihosting, I haven't tested normal semihosting yet.

japaric commented 6 years ago

Are you using the latest version of cortex-m-semihosting? Check your Cargo.lock file; if not, run cargo update. Earlier versions suffer from this LLD bug.

MabezDev commented 6 years ago

Good call, updating cortex-m to 5.6 fixed the issue. Thanks