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

NEORV32 Runtime Environment. More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define NEORV32_RTE_NUM_TRAPS   29
 

Enumerations

enum  NEORV32_RTE_TRAP_enum {
  RTE_TRAP_I_ACCESS = 0 , RTE_TRAP_I_ILLEGAL = 1 , RTE_TRAP_I_MISALIGNED = 2 , RTE_TRAP_BREAKPOINT = 3 ,
  RTE_TRAP_L_MISALIGNED = 4 , RTE_TRAP_L_ACCESS = 5 , RTE_TRAP_S_MISALIGNED = 6 , RTE_TRAP_S_ACCESS = 7 ,
  RTE_TRAP_UENV_CALL = 8 , RTE_TRAP_MENV_CALL = 9 , RTE_TRAP_MSI = 10 , RTE_TRAP_MTI = 11 ,
  RTE_TRAP_MEI = 12 , RTE_TRAP_FIRQ_0 = 13 , RTE_TRAP_FIRQ_1 = 14 , RTE_TRAP_FIRQ_2 = 15 ,
  RTE_TRAP_FIRQ_3 = 16 , RTE_TRAP_FIRQ_4 = 17 , RTE_TRAP_FIRQ_5 = 18 , RTE_TRAP_FIRQ_6 = 19 ,
  RTE_TRAP_FIRQ_7 = 20 , RTE_TRAP_FIRQ_8 = 21 , RTE_TRAP_FIRQ_9 = 22 , RTE_TRAP_FIRQ_10 = 23 ,
  RTE_TRAP_FIRQ_11 = 24 , RTE_TRAP_FIRQ_12 = 25 , RTE_TRAP_FIRQ_13 = 26 , RTE_TRAP_FIRQ_14 = 27 ,
  RTE_TRAP_FIRQ_15 = 28
}
 

Functions

Prototypes
void neorv32_rte_setup (void)
 
int neorv32_rte_handler_install (int id, void(*handler)(void))
 
int neorv32_rte_handler_uninstall (int id)
 
void neorv32_rte_debug_handler (void)
 
uint32_t neorv32_rte_context_get (int x)
 
void neorv32_rte_context_put (int x, uint32_t data)
 
void neorv32_rte_print_hw_config (void)
 
void neorv32_rte_print_hw_version (void)
 
void neorv32_rte_print_about (void)
 
void neorv32_rte_print_logo (void)
 
void neorv32_rte_print_license (void)
 

Detailed Description

NEORV32 Runtime Environment.

See also
https://stnolting.github.io/neorv32/sw/files.html

Macro Definition Documentation

◆ NEORV32_RTE_NUM_TRAPS

#define NEORV32_RTE_NUM_TRAPS   29

NEORV32 runtime environment: Number of available traps.

Enumeration Type Documentation

◆ NEORV32_RTE_TRAP_enum

NEORV32 runtime environment trap IDs.

Enumerator
RTE_TRAP_I_ACCESS 

Instruction access fault

RTE_TRAP_I_ILLEGAL 

Illegal instruction

RTE_TRAP_I_MISALIGNED 

Instruction address misaligned

RTE_TRAP_BREAKPOINT 

Breakpoint (EBREAK instruction)

RTE_TRAP_L_MISALIGNED 

Load address misaligned

RTE_TRAP_L_ACCESS 

Load access fault

RTE_TRAP_S_MISALIGNED 

Store address misaligned

RTE_TRAP_S_ACCESS 

Store access fault

RTE_TRAP_UENV_CALL 

Environment call from user mode (ECALL instruction)

RTE_TRAP_MENV_CALL 

Environment call from machine mode (ECALL instruction)

RTE_TRAP_MSI 

Machine software interrupt

RTE_TRAP_MTI 

Machine timer interrupt

RTE_TRAP_MEI 

Machine external interrupt

RTE_TRAP_FIRQ_0 

Fast interrupt channel 0

RTE_TRAP_FIRQ_1 

Fast interrupt channel 1

RTE_TRAP_FIRQ_2 

Fast interrupt channel 2

RTE_TRAP_FIRQ_3 

Fast interrupt channel 3

RTE_TRAP_FIRQ_4 

Fast interrupt channel 4

RTE_TRAP_FIRQ_5 

Fast interrupt channel 5

RTE_TRAP_FIRQ_6 

Fast interrupt channel 6

RTE_TRAP_FIRQ_7 

Fast interrupt channel 7

RTE_TRAP_FIRQ_8 

Fast interrupt channel 8

RTE_TRAP_FIRQ_9 

Fast interrupt channel 9

RTE_TRAP_FIRQ_10 

Fast interrupt channel 10

RTE_TRAP_FIRQ_11 

Fast interrupt channel 11

RTE_TRAP_FIRQ_12 

Fast interrupt channel 12

RTE_TRAP_FIRQ_13 

Fast interrupt channel 13

RTE_TRAP_FIRQ_14 

Fast interrupt channel 14

RTE_TRAP_FIRQ_15 

Fast interrupt channel 15

Function Documentation

◆ neorv32_rte_context_get()

uint32_t neorv32_rte_context_get ( int x)

NEORV32 runtime environment (RTE): Read register from application context (on stack).

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).

Parameters
[in]xRegister number (0..31, corresponds to register x0..x31).
[in]dataData to be written to register x.

◆ neorv32_rte_debug_handler()

void neorv32_rte_debug_handler ( void )

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

◆ 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).

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 error (invalid id or targeted trap not supported).

◆ neorv32_rte_handler_uninstall()

int neorv32_rte_handler_uninstall ( int id)

NEORV32 runtime environment (RTE): Uninstall trap handler function from NEORV32 runtime environment, which was previously installed via neorv32_rte_handler_install(uint8_t id, void (*handler)(void)).

Parameters
[in]idIdentifier (type) of the targeted trap. See NEORV32_RTE_TRAP_enum.
Returns
0 if success, -1 if error (invalid id or targeted trap not supported).

◆ neorv32_rte_print_about()

void neorv32_rte_print_about ( void )

NEORV32 runtime environment (RTE): Print project info via UART0.

◆ neorv32_rte_print_hw_config()

void neorv32_rte_print_hw_config ( void )

NEORV32 runtime environment (RTE): Print hardware configuration information via UART0.

Warning
This function overrides several CSR, CNT and HPM CSRs!

◆ neorv32_rte_print_hw_version()

void neorv32_rte_print_hw_version ( void )

NEORV32 runtime environment (RTE): Print the processor version in human-readable format via UART0.

◆ neorv32_rte_print_license()

void neorv32_rte_print_license ( void )

NEORV32 runtime environment (RTE): Print project license via UART0.

◆ neorv32_rte_print_logo()

void neorv32_rte_print_logo ( void )

NEORV32 runtime environment (RTE): Print project logo via UART0.

◆ neorv32_rte_setup()

void neorv32_rte_setup ( void )

NEORV32 runtime environment (RTE): Setup RTE.

Note
This function installs a debug handler for ALL trap sources, which gives detailed information about the trap. Actual handlers can be installed afterwards via neorv32_rte_handler_install(uint8_t id, void (*handler)(void)).