NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_rte.c File Reference

NEORV32 Runtime Environment. More...

#include <neorv32.h>

Functions

static void __neorv32_rte_print_hex (uint32_t num, int digits)
 
void neorv32_rte_setup (void)
 
int neorv32_rte_handler_install (int id, void(*handler)(void))
 
void neorv32_rte_core (void)
 
uint32_t neorv32_rte_context_get (int x)
 
void neorv32_rte_context_put (int x, uint32_t data)
 
void neorv32_rte_debug_handler (void)
 

Variables

static volatile uint32_t __neorv32_rte_vector_lut [NEORV32_RTE_NUM_TRAPS]
 

Detailed Description

NEORV32 Runtime Environment.

Function Documentation

◆ __neorv32_rte_print_hex()

void __neorv32_rte_print_hex ( uint32_t num,
int digits )
static

NEORV32 runtime environment (RTE): Private function to print the lowest 0 to 8 hex characters of a 32-bit number as hexadecimal value (with "0x" suffix).

Parameters
[in]numNumber to print as hexadecimal via UART0.
[in]digitsNumber of hexadecimal digits to print (0..8).

◆ neorv32_rte_context_get()

uint32_t neorv32_rte_context_get ( int x)

NEORV32 runtime environment (RTE): 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 )

NEORV32 runtime environment (RTE): 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_core()

void neorv32_rte_core ( void )

NEORV32 runtime environment (RTE): This is the core of the NEORV32 RTE (first-level trap handler, executed in machine mode).

◆ neorv32_rte_debug_handler()

void neorv32_rte_debug_handler ( void )

NEORV32 runtime environment (RTE): Debug trap handler, printing information via UART0.

Note
This function operates on the RTE instance of the core on which this function is executed.

◆ neorv32_rte_handler_install()

int neorv32_rte_handler_install ( int id,
void(* handler )(void) )

NEORV32 runtime environment (RTE): 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]idIdentifier (type) of the targeted trap See NEORV32_RTE_TRAP_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 ID.

◆ neorv32_rte_setup()

void neorv32_rte_setup ( void )

NEORV32 runtime environment (RTE): Setup RTE.

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 gives detailed information about the trap via UART0 (if available). Actual handlers can be installed afterwards via neorv32_rte_handler_install().