An application binary interface (ABI) specifies the binary-level conventions that let compiled components work together. At a Rust–C boundary, both sides must agree on how to call functions and interpret shared memory; Rust’s memory-safety guarantees do not automatically extend across that boundary. section 8.1.2 section 8.0
An ABI includes several kinds of agreement:
- Calling convention: where arguments and return values are placed, such as registers or the stack. section 8.1.2
- Data layout: how fields and array elements are arranged in memory. section 8.1.2
- Symbol naming: the names functions and variables have in compiled output so the linker can find them. section 8.1.2
The procedure call standard (PCS) is the part of the ABI that governs function calls. On Cortex-M, a useful simplified model puts ordinary arguments in R0–R3 and a simple return value in R0, or R0 and R1 if needed. A 64-bit argument uses an aligned register pair; arguments that do not fit in registers go on the stack. With the hard-float ABI variant, f32 and f64 arguments instead use floating-point registers. section 8.1.2
// C function prototype: uint32_t c_function(uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e); // On call: // R0 = a // R1 = b // R2 = c // R3 = d // [e] is pushed on stack // Return value in R0
This call places four arguments in registers and the fifth on the stack, with the return value in R0. section 8.1.2
At a public interface between independently compiled components, the Arm PCS requires the stack to be aligned to 8 bytes. Incorrect alignment can cause faults when accessing 64-bit values. In a linker script, ALIGN(8) can align a data section such as .bss; the Rust compiler normally gives individual variables their natural alignment within the section. section 8.1.2 section 4.1.3
Choose a target whose architecture and ABI match the microcontroller. For example, select eabihf for an Arm microcontroller with hardware floating-point support and eabi otherwise. Check the device reference manual or datasheet for the architecture and features before choosing. section 2.1.5


