1

I'm using a Cortex-M33 with arm trust-zone. I have a secure api inside my secure firmware that I can call from my non-secure firmware. All works as expected - at least until I upgraded my compiler from gcc-arm-none-eabi-7-2018-q2-update to gcc-arm-none-eabi-10-2020-q4-major.

The function in question looks like this:

bool __attribute__((cmse_nonsecure_call)) (*Callback_Handler)();

__unused __attribute__((cmse_nonsecure_entry))
bool Secure_SetSomeCallbackHandler(bool (*handler)()) {
    // this cmse-check fails with the compiler in `version gcc-arm-none-eabi-10-2020-q4-major`
    // it works with the `gcc-arm-none-eabi-7-2018-q2-update` though
    handler = cmse_check_address_range(handler, 4, CMSE_NONSECURE);
    if (handler == NULL) {
        return false;
    }
    Callback_Handler = handler;
    return true;
}

I make sure the supplied pointer really is in non-secure space by using cmse_check_address_range. That works for the version 7, but if I compile the code with version 10, NULL is returned. I did not change anything in the source or any other part, just the compiler.

I checked for any changes in that function, but even https://github.com/gcc-mirror/gcc/commits/master/libgcc/config/arm/cmse.c does not show any changes whatsoever.

Did anything change? Maybe I'm using the function not as intended (do I need different flags for functions? But then again, it works with version 7.

Update:

4

1 に答える 1