NEORV32 API Reference
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_rte.c File Reference

NEORV32 Runtime Environment (RTE). More...

#include <neorv32.h>

Macros

Terminal style modifier
#define RTE_TERM_HL_ON   "\033[1;31m"
 
#define RTE_TERM_HL_OFF   "\033[0m"
 

Functions

static void __neorv32_rte_puts (const char *s)
 
static void __neorv32_rte_puth (uint32_t num)
 
static void __neorv32_rte_panic (void)
 
static void __neorv32_rte_core (void)
 
void neorv32_rte_setup (void)
 
int neorv32_rte_handler_install (uint32_t code, void(*handler)(void))
 
int neorv32_rte_handler_uninstall (uint32_t code)
 
uint32_t neorv32_rte_context_get (int x)
 
void neorv32_rte_context_put (int x, uint32_t data)
 

Variables

static volatile uint32_t __neorv32_rte_vector_lut [2][32]
 

Detailed Description

NEORV32 Runtime Environment (RTE).

Function Documentation

◆ __neorv32_rte_core()

static void __neorv32_rte_core ( void )
static

Core of the NEORV32 RTE (first-level trap handler).

◆ __neorv32_rte_panic()

static void __neorv32_rte_panic ( void )
static

Default trap handler printing debug information.

◆ __neorv32_rte_puth()

static void __neorv32_rte_puth ( uint32_t num)
static

Print 32-bit value as 8-char hexadecimal number (with "0x" suffix) via UART0.

Parameters
[in]numValue to print as hexadecimal.

◆ __neorv32_rte_puts()

static void __neorv32_rte_puts ( const char * s)
static

Print a simple string via UART0.

Parameters
[in]sPointer to string.

◆ neorv32_rte_context_get()

uint32_t neorv32_rte_context_get ( int x)

Read register from application context (on stack).

Note
This function operates on the RTE instance of the core on which this function is executed.
Parameters
[in]xRegister number (0..31, corresponds to register x0..x31).
Returns
Content of register x.

◆ neorv32_rte_context_put()

void neorv32_rte_context_put ( int x,
uint32_t data )

Write register to application context (on stack).

Note
This function operates on the RTE instance of the core on which this function is executed.
Parameters
[in]xRegister number (0..31, corresponds to register x0..x31).
[in]dataData to be written to register x.

◆ neorv32_rte_handler_install()

int neorv32_rte_handler_install ( uint32_t code,
void(* handler )(void) )

Install trap handler function (second-level trap handler).

Note
Trap handler installation applies to both cores. Hence, both cores will execute the same handler for the same trap.
Parameters
[in]codeTrap code (MCAUSE CSR value) of the targeted trap. See NEORV32_EXCEPTION_CODES_enum.
[in]handlerThe actual handler function for the specified trap (function must be of type "void function(void);").
Returns
0 if success, -1 if invalid trap code.

◆ neorv32_rte_handler_uninstall()

int neorv32_rte_handler_uninstall ( uint32_t code)

Uninstall trap handler (second-level trap handler) and restore original debug handler.

Note
Trap handler installation applies to both cores. Hence, both cores will execute the same handler for the same trap.
Parameters
[in]codeTrap code (MCAUSE CSR value) of the targeted trap. See NEORV32_EXCEPTION_CODES_enum.
Returns
0 if success, -1 if invalid trap code.

◆ neorv32_rte_setup()

void neorv32_rte_setup ( void )

Setup NEORV32 runtime environment.

Note
This function must be called on all cores that wish to use the RTE.
This function installs a debug handler for ALL trap sources, which prints detailed information about the trap. Actual handlers can be installed afterwards via neorv32_rte_handler_install().

Variable Documentation

◆ __neorv32_rte_vector_lut

volatile uint32_t __neorv32_rte_vector_lut[2][32]
static

global trap handler table (for all cores!)