gnzlbg / cargo-asm

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

"unknown target" error when attempting disassembly of any function #184

Open GregWoods opened 4 years ago

GregWoods commented 4 years ago

Although cargo asm doesn't work for embedded, cargo asm --target thumbv7em-none-eabihf does work. It produces a huge list of functions, both mine, and for all the dependencies.

If I now try to add a path by copy-pasting my 'main' function from the huge list, I get an error...

cargo asm --target thumbv7em-none-eabihf stm32f4_05_serial::__cortex_m_rt_main

[ERROR][cargo_asm::target]
[C:\Users\gregw\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-asm-0.1.16\src\target.rs:37]
: unknown target

I also tried combinations of:

cargo asm --target thumbv7em-none-eabihf stm32f4_05_serial::__cortex_m_rt_main cargo asm --target=thumbv7em-none-eabihf stm32f4_05_serial::__cortex_m_rt_main cargo asm --target thumbv7em-none-eabihf -- stm32f4_05_serial::__cortex_m_rt_main cargo asm --target thumbv7em-none-eabihf stm32f4_05_serial::__cortex_m_rt_main()

Any suggestions?

JOE1994 commented 4 years ago

I had the exact same issue, and the reason was that I wasn't using the latest version of cargo-asm.

Instead of doing cargo install cargo-asm (which probably fetches installation from Crates.io), Try running cargo install --git https://github.com/gnzlbg/cargo-asm.git.

After overriding my installation of cargo-asm, the first option among the four combinations (cargo asm --target thumbv7em-none-eabihf stm32f4_05_serial::__cortex_m_rt_main) works fine for me :smiley:

I hope this works for you as well