NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Functions | Variables
neorv32_rte.c File Reference

NEORV32 Runtime Environment. More...

#include "neorv32.h"
#include "neorv32_rte.h"

Functions

static void __neorv32_rte_core (void)
 
static void __neorv32_rte_debug_exc_handler (void)
 
static void __neorv32_rte_print_true_false (int state)
 
static void __neorv32_rte_print_checkbox (int state)
 
static void __neorv32_rte_print_hex_word (uint32_t num)
 
static void __neorv32_rte_print_hex_half (uint16_t num)
 
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)
 

Variables

static uint32_t __neorv32_rte_vector_lut [NEORV32_RTE_NUM_TRAPS]
 

Detailed Description

NEORV32 Runtime Environment.

Function Documentation

◆ __neorv32_rte_core()

static void __neorv32_rte_core ( void  )
static

This is the core of the NEORV32 RTE.

Note
This function must no be explicitly used by the user.
Warning
When using the the RTE, this function is the ONLY function that can use the 'interrupt' attribute!

◆ __neorv32_rte_debug_exc_handler()

static void __neorv32_rte_debug_exc_handler ( void  )
static

NEORV32 runtime environment: Debug exception handler, printing various exception/interrupt information via UART.

Note
This function is used by neorv32_rte_exception_uninstall(void) only.

◆ __neorv32_rte_print_checkbox()

static void __neorv32_rte_print_checkbox ( int  state)
static

NEORV32 runtime environment: Private function to print [x] or [ ].

Note
This function is used by neorv32_rte_print_hw_config(void) only.
Parameters
[in]statePrint '[x]' when !=0, print '[ ]' when 0

◆ __neorv32_rte_print_hex_half()

void __neorv32_rte_print_hex_half ( uint16_t  num)
static

NEORV32 runtime environment: Private function to print 16-bit number as 4-digit hexadecimal value (with "0x" suffix).

Parameters
[in]numNumber to print as hexadecimal.

◆ __neorv32_rte_print_hex_word()

void __neorv32_rte_print_hex_word ( uint32_t  num)
static

NEORV32 runtime environment: Private function to print 32-bit number as 8-digit hexadecimal value (with "0x" suffix).

Parameters
[in]numNumber to print as hexadecimal.

◆ __neorv32_rte_print_true_false()

static void __neorv32_rte_print_true_false ( int  state)
static

NEORV32 runtime environment: Private function to print yes or no.

Note
This function is used by neorv32_rte_print_hw_config(void) only.
Parameters
[in]statePrint 'yes' when !=0, print 'no' when 0

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

Variable Documentation

◆ __neorv32_rte_vector_lut

uint32_t __neorv32_rte_vector_lut[NEORV32_RTE_NUM_TRAPS]
static

The >private< trap vector look-up table of the NEORV32 RTE.