NEORV32 - Software Framework Documentation
Functions | Variables
main.c File Reference

CPU/Processor test program. More...

#include <neorv32.h>
#include <string.h>

Macros

User configuration
#define BAUD_RATE   (19200)
 
#define ADDR_UNALIGNED_1   (0x00000001)
 
#define ADDR_UNALIGNED_2   (0x00000002)
 
#define ADDR_UNREACHABLE   (IO_BASE_ADDRESS-4)
 
#define ADDR_READONLY   ((uint32_t)&NEORV32_SYSINFO.CLK)
 
#define EXT_MEM_BASE   (0xF0000000)
 
UART print macros
#define PRINT_STANDARD(...)   neorv32_uart0_printf(__VA_ARGS__)
 
#define PRINT_CRITICAL(...)   neorv32_uart0_printf(__VA_ARGS__)
 

Functions

void sim_irq_trigger (uint32_t sel)
 
void global_trap_handler (void)
 
void xirq_trap_handler0 (void)
 
void xirq_trap_handler1 (void)
 
void test_ok (void)
 
void test_fail (void)
 
int main ()
 
void __neorv32_crt0_after_main (int32_t return_code)
 

Variables

int cnt_fail = 0
 Global counter for failing tests.
 
int cnt_ok = 0
 Global counter for successful tests.
 
int cnt_test = 0
 Global counter for total number of tests.
 
uint32_t num_hpm_cnts_global = 0
 Global number of available HPMs.
 
uint32_t xirq_trap_handler_ack = 0
 XIRQ trap handler acknowledge.
 
volatile uint32_t store_access_addr [2]
 Variable to test store accesses.
 
volatile uint32_t pmp_access_addr
 Variable to test PMP.
 

Detailed Description

CPU/Processor test program.

Author
Stephan Nolting

Macro Definition Documentation

◆ ADDR_READONLY

#define ADDR_READONLY   ((uint32_t)&NEORV32_SYSINFO.CLK)

UART BAUD rate

◆ ADDR_UNALIGNED_1

#define ADDR_UNALIGNED_1   (0x00000001)

UART BAUD rate

◆ ADDR_UNALIGNED_2

#define ADDR_UNALIGNED_2   (0x00000002)

UART BAUD rate

◆ ADDR_UNREACHABLE

#define ADDR_UNREACHABLE   (IO_BASE_ADDRESS-4)

UART BAUD rate

◆ BAUD_RATE

#define BAUD_RATE   (19200)

UART BAUD rate

◆ EXT_MEM_BASE

#define EXT_MEM_BASE   (0xF0000000)

UART BAUD rate

Function Documentation

◆ __neorv32_crt0_after_main()

void __neorv32_crt0_after_main ( int32_t  return_code)

"after-main" handler that is executed after the application's main function returns (called by crt0.S start-up code): Output minimal test report to physical UART

◆ global_trap_handler()

void global_trap_handler ( void  )

Trap handler for ALL exceptions/interrupts.

◆ main()

int main ( void  )

High-level CPU/processor test program.

Note
Applications has to be compiler with <USER_FLAGS+=-DRUN_CPUTEST>
Warning
This test is intended for simulation only.
This test requires all optional extensions/modules to be enabled.
Returns
0 if execution was successful

◆ sim_irq_trigger()

void sim_irq_trigger ( uint32_t  sel)

Simulation-based function to set/clear CPU interrupts (MSI, MEI).

Parameters
[in]selIRQ select mask (bit positions according to NEORV32_CSR_MIE_enum).

◆ test_fail()

void test_fail ( void  )

Test results helper function: Shows "[FAIL]" and increments global cnt_fail

◆ test_ok()

void test_ok ( void  )

Test results helper function: Shows "[ok]" and increments global cnt_ok

◆ xirq_trap_handler0()

void xirq_trap_handler0 ( void  )

XIRQ handler channel 0.

◆ xirq_trap_handler1()

void xirq_trap_handler1 ( void  )

XIRQ handler channel 1.