3.4 __attribute__((cmse_nonsecure_entry)) function attribute

Declares an entry function that can be called from Non-secure state or Secure state.

Syntax

C linkage:
void __attribute__((cmse_nonsecure_entry)) entry_func(int val)
C++ linkage:
extern "C" void __attribute__((cmse_nonsecure_entry)) entry_func(int val)

Note:

Compile Secure code with the maximum capabilities for the target. For example, if you compile with no FPU then the Secure functions do not clear floating-point registers when returning from functions declared as __attribute__((cmse_nonsecure_entry)). Therefore, the functions could potentially leak sensitive data.

Example

#include <arm_cmse.h>
void __attribute__((cmse_nonsecure_entry)) entry_func(int val) {
  int state = cmse_nonsecure_caller();

  if (state)
  { // called from non-secure
    // do non-secure work
    ...
  } else
  { // called from within secure
    // do secure work
    ...
  }
}
Non-ConfidentialPDF file icon PDF version100067_0609_00_en
Copyright © 2014–2017 Arm Limited (or its affiliates). All rights reserved.