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

Secure-side fault handler for NS -> S violations. More...

#include <stdint.h>
#include "ra8_log.h"
Include dependency graph for secure_exception.c:

Go to the source code of this file.

Enumerations

enum  ra8_secure_excep_addr_t : uintptr_t { k_ra8_sfsr_addr = 0xE000EDE4UL }

Functions

void SecureFault_Handler (void)
 Cortex-M85 SecureFault handler (NVIC vector 7).

Variables

static const char * s_tag = "SECEXC"

Detailed Description

Secure-side fault handler for NS -> S violations.

Tag
[Ring 1 / Boot] {World: S}

deliverable. When a Non-Secure caller tries to read a Secure address (or call a Secure function that has not been exposed via a NSC veneer), the Cortex-M85 raises a SecureFault. The handler in this file:

  1. Snapshots SFSR (Secure Fault Status Register) so the operator can see why the fault fired.
  2. Logs the violation through the ITM.
  3. Spins forever with IRQs masked. Real production firmware would jump to a controlled reset path, but for the demo a halt is more diagnostic.

The handler runs in the secure world. NS code cannot reach it directly because the SFSR register at 0xE000EDE4 is in the secure-only system control region.

Definition in file secure_exception.c.

Enumeration Type Documentation

◆ ra8_secure_excep_addr_t

enum ra8_secure_excep_addr_t : uintptr_t
Enumerator
k_ra8_sfsr_addr 

SecureFault Status Register.

Definition at line 35 of file secure_exception.c.

Function Documentation

◆ SecureFault_Handler()

void SecureFault_Handler ( void )

Cortex-M85 SecureFault handler (NVIC vector 7).

Cortex-M85 SecureFault handler (vector table slot 7).

Vector_table.c installs this in the SecureFault slot when the firmware is built with RA8_TRUSTZONE_ENABLE. With TZ off the function is dead-stripped because nothing references it.

Precondition
Cortex-M85 has raised a SecureFault.
The Secure exception stack contains the interrupted context.
Postcondition
Logs the SFSR snapshot and spins.
Interrupts remain masked until an external reset.
Note
Runs only in Secure exception context and never returns.
Since
0.1.0
TrustZone Safety:
  • Validates: nothing – this is an exception entry point.
  • Trusts: the SFSR snapshot belongs to the failing access.
  • Denies: any return path. The handler does not RET.

Definition at line 62 of file secure_exception.c.

References k_ra8_sfsr_addr, ra8_log_error_val, and s_tag.

Variable Documentation

◆ s_tag

const char* s_tag = "SECEXC"
static

Definition at line 33 of file secure_exception.c.