ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_nsc_veneer.h File Reference

Macros for declaring Non-Secure Callable veneer functions. More...

#include <stdint.h>
#include "ra8_attributes.h"
Include dependency graph for ra8_nsc_veneer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RA8_NSC_VENEER   RA8_INTERNAL_ANNOTATE("ra8_nsc_veneer")
 RA8 NSC VENEER – annotation only: no -mcmse, so no SG veneer.
#define RA8_NSC_CHECK_NS_RANGE_R(ptr, len)
 RA8 NSC CHECK NS RANGE r.
#define RA8_NSC_CHECK_NS_RANGE_RW(ptr, len)
 RA8 NSC CHECK NS RANGE RW.

Detailed Description

Macros for declaring Non-Secure Callable veneer functions.

Tag
[Ring 4 / NSC] {World: NSC}

enables __attribute__((cmse_nonsecure_entry)) on the NSC veneer functions when the firmware is built with -DRA8_TRUSTZONE_ENABLE=ON and the translation unit is compiled for the Secure world (-mcmse, i.e. __ARM_FEATURE_CMSE bit 1 set). Non-Secure images define RA8_TRUSTZONE_ENABLE too but compile without -mcmse; they must see the veneers as plain function declarations, because gcc ignores cmse_nonsecure_entry without -mcmse and the -Wattributes diagnostic is fatal under the project -Werror profile. In single-world and host builds the macros likewise compile to nothing, so the same veneer source compiles cleanly against every build configuration.

Use RA8_NSC_VENEER on the function declarations in ra8_nsc.h and on the matching definitions in libs/ra8_nsc/src. Use RA8_NSC_CHECK_NS_RANGE_R / _RW to validate that pointer arguments lie inside the Non-Secure region; the macros expand to cmse_check_address_range calls under TrustZone and to no-ops otherwise.

Argument constraints

cmse_nonsecure_entry imposes restrictions: parameters must be in registers (no struct-by-value bigger than a register), and the return value must fit in registers as well. The existing veneer signatures already comply – everything is uint*_t / pointer / enum.

Definition in file ra8_nsc_veneer.h.

Macro Definition Documentation

◆ RA8_NSC_CHECK_NS_RANGE_R

#define RA8_NSC_CHECK_NS_RANGE_R ( ptr,
len )

◆ RA8_NSC_CHECK_NS_RANGE_RW

◆ RA8_NSC_VENEER

#define RA8_NSC_VENEER   RA8_INTERNAL_ANNOTATE("ra8_nsc_veneer")

RA8 NSC VENEER – annotation only: no -mcmse, so no SG veneer.

Definition at line 121 of file ra8_nsc_veneer.h.