Rust errors / Everything else
Rust compiler error · checked with rustc 1.99.0
Rust error E0798: arguments for `"cmse-nonsecure-call"` function too large to pass via registers
What it meansFunctions marked as cmse-nonsecure-call place restrictions on their inputs and outputs.
What rustc prints
error[E0798]: arguments for `"cmse-nonsecure-call"` function too large to pass via registers --> main.rs:5:60 | 5 | f: extern "cmse-nonsecure-call" fn(u32, u32, u32, u32, u32) -> u32, | ^^^ does not fit in the available registers | = note: functions with the `"cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit argument registers
Real output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
Functions marked as cmse-nonsecure-call place restrictions on their inputs and outputs.
is relevant.
- inputs must fit in the 4 available 32-bit argument registers. Alignment
size 8 (i64, u64, f64).
- outputs must either fit in 4 bytes, or be a foundational type of
- no generics can be used in the signature
For more information, see arm's aapcs32.
Erroneous code example:
#![feature(abi_cmse_nonsecure_call)]
#[no_mangle]
pub fn test(
f: extern "cmse-nonsecure-call" fn(u32, u32, u32, u32, u32) -> u32,
) -> u32 {
f(1, 2, 3, 4, 5)
}
Arguments' alignment is respected. In the example below, padding is inserted so that the u64 argument is passed in registers r2 and r3. There is then no room left for the final f32 argument
#![feature(abi_cmse_nonsecure_call)]
#[no_mangle]
pub fn test(
f: extern "cmse-nonsecure-call" fn(u32, u64, f32) -> u32,
) -> u32 {
f(1, 2, 3.0)
}From rustc --explain E0798 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0061this function takes N arguments but M were supplied
- E0412cannot find type in this scope
- E0515cannot return reference to local variable
- E0728await is only allowed inside async functions and blocks
- E0787naked functions must contain a single `naked_asm!` invocation
- E0793reference to field of packed struct is unaligned
- E0797base expression required after `..`
Up next
Often hit nextE0061: this function takes N arguments but M were suppliedA related error from the same family.Read it next →Did this answer your question?