NEORV32 - Software Framework Documentation
Macros | Enumerations | Functions
neorv32_rte.h File Reference

NEORV32 Runtime Environment. More...

Go to the source code of this file.

Macros

#define NEORV32_RTE_NUM_TRAPS   29
 

Enumerations

enum  NEORV32_RTE_TRAP_enum {
  RTE_TRAP_I_MISALIGNED = 0 , RTE_TRAP_I_ACCESS = 1 , RTE_TRAP_I_ILLEGAL = 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

void neorv32_rte_setup (void)
 
int neorv32_rte_exception_install (uint8_t id, void(*handler)(void))
 
int neorv32_rte_exception_uninstall (uint8_t id)
 
void neorv32_rte_print_hw_config (void)
 
void neorv32_rte_print_hw_version (void)
 
void neorv32_rte_print_credits (void)
 
void neorv32_rte_print_logo (void)
 
void neorv32_rte_print_license (void)
 
uint32_t neorv32_rte_get_compiler_isa (void)
 
int neorv32_rte_check_isa (int silent)
 

Detailed Description

NEORV32 Runtime Environment.

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_MISALIGNED 

Instruction address misaligned

RTE_TRAP_I_ACCESS 

Instruction (bus) access fault

RTE_TRAP_I_ILLEGAL 

Illegal instruction

RTE_TRAP_BREAKPOINT 

Breakpoint (EBREAK instruction)

RTE_TRAP_L_MISALIGNED 

Load address misaligned

RTE_TRAP_L_ACCESS 

Load (bus) access fault

RTE_TRAP_S_MISALIGNED 

Store address misaligned

RTE_TRAP_S_ACCESS 

Store (bus) 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_check_isa()

int neorv32_rte_check_isa ( int  silent)

NEORV32 runtime environment: Check required ISA extensions (via compiler flags) against available ISA extensions (via MISA csr).

Parameters
[in]silentShow error message (via neorv32.uart) if isa_sw > isa_hw when = 0.
Returns
MISA content according to compiler configuration.

◆ neorv32_rte_exception_install()

int neorv32_rte_exception_install ( uint8_t  id,
void(*)(void)  handler 
)

Install exception handler function to NEORV32 runtime environment.

Note
Interrupt sources have to be explicitly enabled by the user via the CSR.mie bits via neorv32_cpu_irq_enable(uint8_t irq_sel) and the global interrupt enable bit mstatus.mie via neorv32_cpu_eint(void).
Parameters
[in]idIdentifier (type) of the targeted exception. See NEORV32_RTE_TRAP_enum.
[in]handlerThe actual handler function for the specified exception (function MUST be of type "void function(void);").
Returns
0 if success, 1 if error (invalid id or targeted exception not supported).

◆ neorv32_rte_exception_uninstall()

int neorv32_rte_exception_uninstall ( uint8_t  id)

Uninstall exception handler function from NEORV32 runtime environment, which was previously installed via neorv32_rte_exception_install(uint8_t id, void (*handler)(void)).

Note
Interrupt sources have to be explicitly disabled by the user via the CSR.mie bits via neorv32_cpu_irq_disable(uint8_t irq_sel) and/or the global interrupt enable bit mstatus.mie via neorv32_cpu_dint(void).
Parameters
[in]idIdentifier (type) of the targeted exception. See NEORV32_RTE_TRAP_enum.
Returns
0 if success, 1 if error (invalid id or targeted exception not supported).

◆ neorv32_rte_get_compiler_isa()

uint32_t neorv32_rte_get_compiler_isa ( void  )

NEORV32 runtime environment: Get MISA CSR value according to compiler/toolchain configuration.

Returns
MISA content according to compiler configuration.

◆ neorv32_rte_print_credits()

void neorv32_rte_print_credits ( void  )

NEORV32 runtime environment: Print project credits

◆ neorv32_rte_print_hw_config()

void neorv32_rte_print_hw_config ( void  )

NEORV32 runtime environment: Print hardware configuration information via UART

◆ neorv32_rte_print_hw_version()

void neorv32_rte_print_hw_version ( void  )

NEORV32 runtime environment: Print the processor version in human-readable format.

◆ neorv32_rte_print_license()

void neorv32_rte_print_license ( void  )

NEORV32 runtime environment: Print project license

◆ neorv32_rte_print_logo()

void neorv32_rte_print_logo ( void  )

NEORV32 runtime environment: Print project logo

◆ neorv32_rte_setup()

void neorv32_rte_setup ( void  )

Setup NEORV32 runtime environment.

Note
This function installs a debug handler for ALL exception and interrupt sources, which gives detailed information about the exception/interrupt. Actual handler can be installed afterwards via neorv32_rte_exception_install(uint8_t id, void (*handler)(void)).