Error code E0798
Functions marked as C-cmse-nonsecure-call
place restrictions on their
inputs and outputs.
- inputs must fit in the 4 available 32-bit argument registers. Alignment is relevant.
- outputs must either fit in 4 bytes, or be a foundational type of
size 8 (
i64
,u64
,f64
). - no generics can be used in the signature
For more information, see arm's aapcs32.
Erroneous code example:
#![feature(abi_c_cmse_nonsecure_call)]
#[no_mangle]
pub fn test(
f: extern "C-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_c_cmse_nonsecure_call)]
#[no_mangle]
pub fn test(
f: extern "C-cmse-nonsecure-call" fn(u32, u64, f32) -> u32,
) -> u32 {
f(1, 2, 3.0)
}