gnzlbg / cargo-asm

cargo subcommand showing the assembly or llvm-ir generated for Rust code
https://github.com/gnzlbg/cargo-asm
Other
1.17k stars 36 forks source link

Allow OS-less targets (i.e. no_std) #104

Closed therealprof closed 5 years ago

therealprof commented 5 years ago

Signed-off-by: Daniel Egger daniel@eggers-club.de

therealprof commented 5 years ago

Something weird is still going on (cf. the other opened issues #103 and #102) but at least this will allow cargo-asm to work slightly better on no_std targets, going from:

# cargo asm  --features="stm32f042,rt" --lib --target=thumbv6m-none-eabi --rust "stm32f0xx_hal::serial::write"
[ERROR][cargo_asm::target][src/target.rs:37]: unknown target

to

# cargo asm  --features="stm32f042,rt" --lib --target=thumbv6m-none-eabi --rust "stm32f0xx_hal::serial::write"
file /rustc/fc50f328b0353b285421b8ff5d4100966387a997/src/libcore/ptr.rs does not exist!
stm32f0xx_hal::serial::write (src/serial.rs:555):
 ldr     r2, [r0, #28]
 lsls    r2, r2, #24
 bmi     .LBB82_2
 movs    r0, #1
 bx      lr
.LBB82_2:
 movs    r2, #40
 strb    r1, [r0, r2]
 movs    r0, #0
 bx      lr
gnzlbg commented 5 years ago

Thanks! And sorry for the delay!