Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nicolasbauw/rust-asm-ffi

Using FFI to Call Assembly Functions from Rust
https://github.com/nicolasbauw/rust-asm-ffi

arm assembly cross-compilation ffi risc-v rust

Last synced: 6 days ago
JSON representation

Using FFI to Call Assembly Functions from Rust

Awesome Lists containing this project

README

        

# Using FFI to Call Assembly Functions from Rust

This is a mini-howto for people wanting to call assembly functions from their Rust code.
- assembly is not inline assembly, but a separate .s source file
- just replace mnemonics to fit your target CPU (here, three examples for armv6, aarch64 and riscv64)

Cross-compilation for Raspberry Pi 1B:
```
rustup target add arm-unknown-linux-musleabihf
brew install arm-linux-gnueabihf-binutils
cargo build --target="arm-unknown-linux-musleabihf" --release
```

Linux users could replace musleabihf by gnueabihf.