mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-23 13:47:33 -04:00
[sw] rename library functions (#467)
* [sw/lib] rename library functions (UART + RTE) * [sw/example] change library function calls * [sw/lib] change library function calls * [sw/lib] add backwards compatibility layer * [docs] minor edits/fixes * [sw/lib] comment edits * update bootloader
This commit is contained in:
parent
5a0d9dc889
commit
74c0817a1e
24 changed files with 340 additions and 240 deletions
|
@ -103,6 +103,7 @@ footnote:[This driver file only represents a stub, since the real CFS drivers ar
|
|||
| `neorv32_xip.c` | `neorv32_xip.h` | HW driver functions for the **XIP**
|
||||
| `neorv32_xirq.c` | `neorv32_xirq.h` | HW driver functions for the **XIRQ**
|
||||
| `syscalls.c` | - | newlib "system calls"
|
||||
| - | `legacy.h` | backwards compatibility wrappers and functions (do not use for new designs)
|
||||
|=======================
|
||||
|
||||
.Core Library Documentation
|
||||
|
|
|
@ -7,7 +7,7 @@ by wrapping the CPU's _privileged architecture_ (i.e. trap-related CSRs) into a
|
|||
The NEORV32 RTE is a software library (`sw/lib/source/neorv32_rte.c`) that is part of the default processor library set.
|
||||
It provides public functions via `sw/lib/include/neorv32_rte.h` for application interaction.
|
||||
|
||||
Once initialized, the RTE provides <<_default_rte_trap_handlers>> that catch all possible exceptions. These
|
||||
Once initialized, the RTE provides <<_default_rte_trap_handlers>> that catch all possible traps. These
|
||||
default handlers just output a message via UART to inform the user when a certain trap has been triggered. The
|
||||
default handlers can be overridden by the application code to install application-specific handler functions for each trap.
|
||||
|
||||
|
@ -25,15 +25,15 @@ For the **C standard runtime library** see section <<c_standard_library>>.
|
|||
|
||||
The RTE handles the trap-related CSRs of the CPU's privileged architecture (<<_machine_trap_handling_csrs>>).
|
||||
It initializes the <<_mtvec>> CSR, which provides the base entry point for all trap
|
||||
handlers. The address stored to this register reflects the **first-level exception handler**, which is provided by the
|
||||
handlers. The address stored to this register reflects the **first-level trap handler**, which is provided by the
|
||||
NEORV32 RTE. Whenever an exception or interrupt is triggered this first-level handler is executed.
|
||||
|
||||
The first-level handler performs a complete context save, analyzes the source of the exception/interrupt and
|
||||
calls the according **second-level exception handler**, which takes care of the actual exception/interrupt
|
||||
The first-level handler performs a complete context save, analyzes the source of the trap and
|
||||
calls the according **second-level trap handler**, which takes care of the actual exception/interrupt
|
||||
handling. For this, the RTE manages a private look-up table to store the addresses of the according trap
|
||||
handlers.
|
||||
|
||||
After the initial RTE setup, each entry in the RTE's trap handler's look-up table is initialized with a
|
||||
After the initial RTE setup, each entry in the RTE's trap handler look-up table is initialized with a
|
||||
<<_default_rte_trap_handlers>>. These default handler do not execute any trap-related operations - they
|
||||
just output a message via the *primary UART (UART0)* to inform the user that a trap has occurred, that is not
|
||||
handled by the actual application. After sending this message, the RTE tries to continue executing the user program.
|
||||
|
@ -59,7 +59,7 @@ by installing user-defined ones:
|
|||
.Function Prototype: Installing an Application-Specific Trap Handler
|
||||
[source,c]
|
||||
----
|
||||
int neorv32_rte_exception_install(uint8_t id, void (*handler)(void));
|
||||
int neorv32_rte_handler_install(uint8_t id, void (*handler)(void));
|
||||
----
|
||||
|
||||
The first argument `id` defines the "trap ID" (for example a certain interrupt request) that shall be handled
|
||||
|
@ -74,15 +74,15 @@ The custom handler functions need to have a specific format without any argument
|
|||
----
|
||||
void custom_trap_handler_xyz(void) {
|
||||
|
||||
// handle exception/interrupt...
|
||||
// handle trap...
|
||||
}
|
||||
----
|
||||
|
||||
.Custom Trap Handler Attributes
|
||||
[WARNING]
|
||||
Do NOT use the `((interrupt))` attribute for the application exception handler functions! This
|
||||
Do NOT use the `((interrupt))` attribute for the application trap handler functions! This
|
||||
will place a `mret` instruction to the end of it making it impossible to return to the first-level
|
||||
exception handler of the RTE core, which will cause stack corruption.
|
||||
trap handler of the RTE core, which will cause stack corruption.
|
||||
|
||||
The trap identifier `id` specifies the according trap cause. These can be an _asynchronous trap_ like
|
||||
an interrupt from one of the processor modules or a _synchronous trap_ triggered by software-caused events
|
||||
|
@ -132,7 +132,7 @@ the RISC-V machine timer (MTIME) interrupt:
|
|||
.Example: Installing the MTIME IRQ Handler
|
||||
[source,c]
|
||||
----
|
||||
neorv32_rte_exception_install(RTE_TRAP_MTI, custom_mtime_irq_handler);
|
||||
neorv32_rte_handler_install(RTE_TRAP_MTI, custom_mtime_irq_handler);
|
||||
----
|
||||
|
||||
User-defined trap handlers can also be un-installed. This will remove the users trap handler from the RTE core
|
||||
|
@ -141,7 +141,7 @@ and will re-install the <<_default_rte_trap_handlers>> for the specific trap.
|
|||
.Function Prototype: Installing an Application-Specific Trap Handler
|
||||
[source,c]
|
||||
----
|
||||
int neorv32_rte_exception_uninstall(uint8_t id);
|
||||
int neorv32_rte_handler_uninstall(uint8_t id);
|
||||
----
|
||||
|
||||
The argument `id` defines the identifier of the according trap that shall be un-installed. The function return zero
|
||||
|
@ -154,7 +154,7 @@ RISC-V machine timer (MTIME) interrupt:
|
|||
.Example: Removing the Custom MTIME IRQ Handler
|
||||
[source,c]
|
||||
----
|
||||
neorv32_rte_exception_uninstall(RTE_TRAP_MTI);
|
||||
neorv32_rte_handler_uninstall(RTE_TRAP_MTI);
|
||||
----
|
||||
|
||||
|
||||
|
@ -167,7 +167,7 @@ via UART0 to inform the user and will try to resume normal program execution.
|
|||
.Continuing Execution
|
||||
[WARNING]
|
||||
In most cases the RTE can successfully continue operation - for example if it catches an **interrupt** request that is not handled
|
||||
by the actual application program. However, if the RTE catches an un-handled **exception** like a bus access fault
|
||||
by the actual application program. However, if the RTE catches an un-handled **trap** like a bus access fault
|
||||
continuing execution will most likely fail making the CPU crash.
|
||||
|
||||
.RTE Default Trap Handler Output Examples
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
-- The NEORV32 RISC-V Processor: https://github.com/stnolting/neorv32
|
||||
-- Auto-generated memory initialization file (for BOOTLOADER) from source file <bootloader/main.bin>
|
||||
-- Size: 3980 bytes
|
||||
-- Size: 3984 bytes
|
||||
-- MARCH: default
|
||||
-- Built: 05.11.2022 09:30:37
|
||||
-- Built: 28.12.2022 12:35:04
|
||||
|
||||
-- prototype defined in 'neorv32_package.vhd'
|
||||
package body neorv32_bootloader_image is
|
||||
|
@ -43,7 +43,7 @@ x"00000e93",
|
|||
x"00000f13",
|
||||
x"00000f93",
|
||||
x"00001597",
|
||||
x"f0458593",
|
||||
x"f0858593",
|
||||
x"80010617",
|
||||
x"f7060613",
|
||||
x"80010697",
|
||||
|
@ -184,51 +184,51 @@ x"08000793",
|
|||
x"30479073",
|
||||
x"30046073",
|
||||
x"ffff1537",
|
||||
x"d8850513",
|
||||
x"d8c50513",
|
||||
x"424000ef",
|
||||
x"f1302573",
|
||||
x"3a8000ef",
|
||||
x"ffff1537",
|
||||
x"dc050513",
|
||||
x"dc450513",
|
||||
x"410000ef",
|
||||
x"fe402503",
|
||||
x"394000ef",
|
||||
x"ffff1537",
|
||||
x"dc850513",
|
||||
x"dcc50513",
|
||||
x"3fc000ef",
|
||||
x"fe002503",
|
||||
x"380000ef",
|
||||
x"ffff1537",
|
||||
x"dd050513",
|
||||
x"dd450513",
|
||||
x"3e8000ef",
|
||||
x"30102573",
|
||||
x"36c000ef",
|
||||
x"ffff1537",
|
||||
x"dd850513",
|
||||
x"ddc50513",
|
||||
x"3d4000ef",
|
||||
x"fc002573",
|
||||
x"358000ef",
|
||||
x"ffff1537",
|
||||
x"ddc50513",
|
||||
x"de050513",
|
||||
x"3c0000ef",
|
||||
x"fe802503",
|
||||
x"ffff1437",
|
||||
x"340000ef",
|
||||
x"ffff1537",
|
||||
x"de450513",
|
||||
x"de850513",
|
||||
x"3a8000ef",
|
||||
x"ff802503",
|
||||
x"32c000ef",
|
||||
x"dec40513",
|
||||
x"df040513",
|
||||
x"398000ef",
|
||||
x"ff002503",
|
||||
x"31c000ef",
|
||||
x"ffff1537",
|
||||
x"df850513",
|
||||
x"dfc50513",
|
||||
x"384000ef",
|
||||
x"ffc02503",
|
||||
x"308000ef",
|
||||
x"dec40513",
|
||||
x"df040513",
|
||||
x"374000ef",
|
||||
x"ff402503",
|
||||
x"2f8000ef",
|
||||
|
@ -237,7 +237,7 @@ x"00020737",
|
|||
x"00e7f7b3",
|
||||
x"04078c63",
|
||||
x"ffff1537",
|
||||
x"e0050513",
|
||||
x"e0450513",
|
||||
x"350000ef",
|
||||
x"2ac000ef",
|
||||
x"fe002403",
|
||||
|
@ -255,17 +255,17 @@ x"0147f7b3",
|
|||
x"0a079263",
|
||||
x"ffff1537",
|
||||
x"fa402783",
|
||||
x"e2c50513",
|
||||
x"e3050513",
|
||||
x"308000ef",
|
||||
x"ffff19b7",
|
||||
x"e3898513",
|
||||
x"e3c98513",
|
||||
x"2fc000ef",
|
||||
x"06c00a13",
|
||||
x"07800b93",
|
||||
x"07300c13",
|
||||
x"06500c93",
|
||||
x"ffff17b7",
|
||||
x"eb878513",
|
||||
x"ebc78513",
|
||||
x"2e0000ef",
|
||||
x"fa402403",
|
||||
x"fe045ee3",
|
||||
|
@ -273,7 +273,7 @@ x"0ff47413",
|
|||
x"00040513",
|
||||
x"240000ef",
|
||||
x"ffff17b7",
|
||||
x"d8478513",
|
||||
x"d8878513",
|
||||
x"2c0000ef",
|
||||
x"07200793",
|
||||
x"06f41863",
|
||||
|
@ -298,22 +298,22 @@ x"f485e2e3",
|
|||
x"00b41463",
|
||||
x"f3256ee3",
|
||||
x"00100513",
|
||||
x"654000ef",
|
||||
x"658000ef",
|
||||
x"ffff1537",
|
||||
x"d8450513",
|
||||
x"d8850513",
|
||||
x"254000ef",
|
||||
x"00000513",
|
||||
x"035000ef",
|
||||
x"039000ef",
|
||||
x"17440c63",
|
||||
x"028a6463",
|
||||
x"17940c63",
|
||||
x"06800793",
|
||||
x"e3898513",
|
||||
x"e3c98513",
|
||||
x"02f40c63",
|
||||
x"03f00793",
|
||||
x"18f40063",
|
||||
x"ffff1537",
|
||||
x"f5c50513",
|
||||
x"f6050513",
|
||||
x"0240006f",
|
||||
x"07500793",
|
||||
x"02f40263",
|
||||
|
@ -322,24 +322,24 @@ x"ff8414e3",
|
|||
x"0044a403",
|
||||
x"02041063",
|
||||
x"ffff1537",
|
||||
x"ec050513",
|
||||
x"ec450513",
|
||||
x"1fc000ef",
|
||||
x"f11ff06f",
|
||||
x"00000513",
|
||||
x"5e4000ef",
|
||||
x"5e8000ef",
|
||||
x"f05ff06f",
|
||||
x"ffff1537",
|
||||
x"edc50513",
|
||||
x"ee050513",
|
||||
x"1e0000ef",
|
||||
x"00040513",
|
||||
x"164000ef",
|
||||
x"ffff1537",
|
||||
x"ee450513",
|
||||
x"ee850513",
|
||||
x"1cc000ef",
|
||||
x"00400537",
|
||||
x"150000ef",
|
||||
x"ffff1537",
|
||||
x"efc50513",
|
||||
x"f0050513",
|
||||
x"1b8000ef",
|
||||
x"fa402903",
|
||||
x"fe095ee3",
|
||||
|
@ -348,25 +348,25 @@ x"00090513",
|
|||
x"118000ef",
|
||||
x"07900793",
|
||||
x"eaf91ae3",
|
||||
x"548000ef",
|
||||
x"54c000ef",
|
||||
x"00050663",
|
||||
x"00300513",
|
||||
x"1e4000ef",
|
||||
x"ffff1537",
|
||||
x"f0850513",
|
||||
x"f0c50513",
|
||||
x"180000ef",
|
||||
x"01045b13",
|
||||
x"00400937",
|
||||
x"00010db7",
|
||||
x"fff00d13",
|
||||
x"4c8000ef",
|
||||
x"3f8000ef",
|
||||
x"0d800513",
|
||||
x"3a0000ef",
|
||||
x"00090513",
|
||||
x"3ac000ef",
|
||||
x"380000ef",
|
||||
x"4cc000ef",
|
||||
x"3fc000ef",
|
||||
x"0d800513",
|
||||
x"3a4000ef",
|
||||
x"00090513",
|
||||
x"3b0000ef",
|
||||
x"384000ef",
|
||||
x"4d0000ef",
|
||||
x"00157a93",
|
||||
x"fe0a9ce3",
|
||||
x"fffb0b13",
|
||||
|
@ -382,33 +382,33 @@ x"01bd0533",
|
|||
x"00d12623",
|
||||
x"00ba8ab3",
|
||||
x"004d0d13",
|
||||
x"664000ef",
|
||||
x"668000ef",
|
||||
x"00c12683",
|
||||
x"fe8d60e3",
|
||||
x"4788d5b7",
|
||||
x"afe58593",
|
||||
x"00400537",
|
||||
x"64c000ef",
|
||||
x"650000ef",
|
||||
x"00040593",
|
||||
x"00490513",
|
||||
x"640000ef",
|
||||
x"644000ef",
|
||||
x"00890513",
|
||||
x"415005b3",
|
||||
x"634000ef",
|
||||
x"638000ef",
|
||||
x"ffff1537",
|
||||
x"d6c50513",
|
||||
x"d7050513",
|
||||
x"ed9ff06f",
|
||||
x"00100513",
|
||||
x"eddff06f",
|
||||
x"0044a783",
|
||||
x"e6079ae3",
|
||||
x"ffff1537",
|
||||
x"f1850513",
|
||||
x"f1c50513",
|
||||
x"ebdff06f",
|
||||
x"00100513",
|
||||
x"e65ff06f",
|
||||
x"ffff1537",
|
||||
x"f2850513",
|
||||
x"f2c50513",
|
||||
x"ea9ff06f",
|
||||
x"f9402583",
|
||||
x"f9002503",
|
||||
|
@ -434,7 +434,7 @@ x"07800513",
|
|||
x"ffff14b7",
|
||||
x"fbdff0ef",
|
||||
x"01c00413",
|
||||
x"f6848493",
|
||||
x"f6c48493",
|
||||
x"ffc00993",
|
||||
x"008957b3",
|
||||
x"00f7f793",
|
||||
|
@ -476,13 +476,13 @@ x"ff010113",
|
|||
x"00812423",
|
||||
x"00050413",
|
||||
x"ffff1537",
|
||||
x"d2450513",
|
||||
x"d2850513",
|
||||
x"00112623",
|
||||
x"f91ff0ef",
|
||||
x"00241793",
|
||||
x"ffff1537",
|
||||
x"008787b3",
|
||||
x"f7850513",
|
||||
x"f7c50513",
|
||||
x"00f50533",
|
||||
x"f79ff0ef",
|
||||
x"30047073",
|
||||
|
@ -516,7 +516,7 @@ x"01f12423",
|
|||
x"342024f3",
|
||||
x"800007b7",
|
||||
x"00778793",
|
||||
x"0af49463",
|
||||
x"0af49663",
|
||||
x"fe802783",
|
||||
x"00010737",
|
||||
x"00e7f7b3",
|
||||
|
@ -527,7 +527,7 @@ x"fcf02423",
|
|||
x"fe802783",
|
||||
x"00020737",
|
||||
x"00e7f7b3",
|
||||
x"02078663",
|
||||
x"02078863",
|
||||
x"e29ff0ef",
|
||||
x"fe002783",
|
||||
x"fff00713",
|
||||
|
@ -538,6 +538,7 @@ x"00f537b3",
|
|||
x"00b787b3",
|
||||
x"f8f02e23",
|
||||
x"f8a02c23",
|
||||
x"00000013",
|
||||
x"03c12403",
|
||||
x"04c12083",
|
||||
x"04812283",
|
||||
|
@ -564,28 +565,28 @@ x"800007b7",
|
|||
x"0007a783",
|
||||
x"00078663",
|
||||
x"00100513",
|
||||
x"e91ff0ef",
|
||||
x"e8dff0ef",
|
||||
x"34102473",
|
||||
x"fe802783",
|
||||
x"00040737",
|
||||
x"00e7f7b3",
|
||||
x"04078263",
|
||||
x"ffff1537",
|
||||
x"d2c50513",
|
||||
x"e19ff0ef",
|
||||
x"d3050513",
|
||||
x"e15ff0ef",
|
||||
x"00048513",
|
||||
x"d9dff0ef",
|
||||
x"d99ff0ef",
|
||||
x"02000513",
|
||||
x"d7dff0ef",
|
||||
x"d79ff0ef",
|
||||
x"00040513",
|
||||
x"d8dff0ef",
|
||||
x"d89ff0ef",
|
||||
x"02000513",
|
||||
x"d6dff0ef",
|
||||
x"d69ff0ef",
|
||||
x"34302573",
|
||||
x"d7dff0ef",
|
||||
x"d79ff0ef",
|
||||
x"ffff1537",
|
||||
x"d8450513",
|
||||
x"de5ff0ef",
|
||||
x"d8850513",
|
||||
x"de1ff0ef",
|
||||
x"00440413",
|
||||
x"34141073",
|
||||
x"f39ff06f",
|
||||
|
@ -720,8 +721,8 @@ x"00fb2023",
|
|||
x"00050413",
|
||||
x"02051863",
|
||||
x"ffff1537",
|
||||
x"d3850513",
|
||||
x"bc5ff0ef",
|
||||
x"d3c50513",
|
||||
x"bc1ff0ef",
|
||||
x"004005b7",
|
||||
x"00040513",
|
||||
x"e61ff0ef",
|
||||
|
@ -731,19 +732,19 @@ x"04f50863",
|
|||
x"00000513",
|
||||
x"0380006f",
|
||||
x"ffff1537",
|
||||
x"d5850513",
|
||||
x"b99ff0ef",
|
||||
x"d5c50513",
|
||||
x"b95ff0ef",
|
||||
x"00400537",
|
||||
x"b1dff0ef",
|
||||
x"b19ff0ef",
|
||||
x"ffff1537",
|
||||
x"d6450513",
|
||||
x"b85ff0ef",
|
||||
x"d6850513",
|
||||
x"b81ff0ef",
|
||||
x"fe802783",
|
||||
x"00080737",
|
||||
x"00e7f7b3",
|
||||
x"00079663",
|
||||
x"00300513",
|
||||
x"bc5ff0ef",
|
||||
x"bc1ff0ef",
|
||||
x"f19ff0ef",
|
||||
x"fa0502e3",
|
||||
x"ff1ff06f",
|
||||
|
@ -767,8 +768,8 @@ x"015484b3",
|
|||
x"00200513",
|
||||
x"fa0494e3",
|
||||
x"ffff1537",
|
||||
x"d6c50513",
|
||||
x"b09ff0ef",
|
||||
x"d7050513",
|
||||
x"b05ff0ef",
|
||||
x"02c12083",
|
||||
x"02812403",
|
||||
x"800007b7",
|
||||
|
@ -836,13 +837,13 @@ x"ff002403",
|
|||
x"00050463",
|
||||
x"40400437",
|
||||
x"ffff1537",
|
||||
x"d7050513",
|
||||
x"9f5ff0ef",
|
||||
x"d7450513",
|
||||
x"9f1ff0ef",
|
||||
x"00040513",
|
||||
x"979ff0ef",
|
||||
x"975ff0ef",
|
||||
x"ffff1537",
|
||||
x"d8050513",
|
||||
x"9e1ff0ef",
|
||||
x"d8450513",
|
||||
x"9ddff0ef",
|
||||
x"00010737",
|
||||
x"fa002783",
|
||||
x"fe07cee3",
|
||||
|
@ -882,9 +883,9 @@ x"6f6c746f",
|
|||
x"72656461",
|
||||
x"0a3e3e20",
|
||||
x"444c420a",
|
||||
x"4e203a56",
|
||||
x"2020766f",
|
||||
x"30322035",
|
||||
x"44203a56",
|
||||
x"32206365",
|
||||
x"30322038",
|
||||
x"480a3232",
|
||||
x"203a5657",
|
||||
x"00000020",
|
||||
|
|
|
@ -206,7 +206,7 @@ enum NEORV32_EXECUTABLE_enum {
|
|||
#define str(a) #a
|
||||
/** Print to UART 0 */
|
||||
#if (UART_EN != 0)
|
||||
#define PRINT_TEXT(...) neorv32_uart0_print(__VA_ARGS__)
|
||||
#define PRINT_TEXT(...) neorv32_uart0_puts(__VA_ARGS__)
|
||||
#define PRINT_XNUM(a) print_hex_word(a)
|
||||
#define PRINT_GETC(a) neorv32_uart0_getc()
|
||||
#define PRINT_PUTC(a) neorv32_uart0_putc(a)
|
||||
|
|
|
@ -178,7 +178,7 @@ void vToggleLED( void )
|
|||
|
||||
void vSendString( const char * pcString )
|
||||
{
|
||||
neorv32_uart0_print( ( const char * ) pcString );
|
||||
neorv32_uart0_puts( ( const char * ) pcString );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -196,7 +196,7 @@ void vApplicationMallocFailedHook( void )
|
|||
to query the size of free heap space that remains (although it does not
|
||||
provide information on how the remaining heap might be fragmented). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
neorv32_uart0_print("FreeRTOS_FAULT: vApplicationMallocFailedHook (solution: increase 'configTOTAL_HEAP_SIZE' in FreeRTOSConfig.h)\n");
|
||||
neorv32_uart0_puts("FreeRTOS_FAULT: vApplicationMallocFailedHook (solution: increase 'configTOTAL_HEAP_SIZE' in FreeRTOSConfig.h)\n");
|
||||
__asm volatile( "ebreak" );
|
||||
for( ;; );
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
|||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
function is called if a stack overflow is detected. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
neorv32_uart0_print("FreeRTOS_FAULT: vApplicationStackOverflowHook\n");
|
||||
neorv32_uart0_puts("FreeRTOS_FAULT: vApplicationStackOverflowHook\n");
|
||||
__asm volatile( "ebreak" );
|
||||
for( ;; );
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ int main() {
|
|||
|
||||
// init UART at default baud rate, no parity bits, ho hw flow control
|
||||
neorv32_uart0_setup(BAUD_RATE, PARITY_NONE, FLOW_CONTROL_NONE);
|
||||
neorv32_uart0_print("ERROR! FreeRTOS has not been compiled. Use >>make USER_FLAGS+=-DRUN_FREERTOS_DEMO clean_all exe<< to compile it.\n");
|
||||
neorv32_uart0_puts("ERROR! FreeRTOS has not been compiled. Use >>make USER_FLAGS+=-DRUN_FREERTOS_DEMO clean_all exe<< to compile it.\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -73,13 +73,13 @@ int main() {
|
|||
|
||||
// check if GPTMR unit is implemented at all
|
||||
if (neorv32_gptmr_available() == 0) {
|
||||
neorv32_uart0_print("ERROR! General purpose timer not implemented!\n");
|
||||
neorv32_uart0_puts("ERROR! General purpose timer not implemented!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Intro
|
||||
neorv32_uart0_print("General purpose timer (GPTMR) demo Program.\n"
|
||||
"Toggles GPIO.output(0) at 1Hz using the GPTMR interrupt.\n\n");
|
||||
neorv32_uart0_puts("General purpose timer (GPTMR) demo Program.\n"
|
||||
"Toggles GPIO.output(0) at 1Hz using the GPTMR interrupt.\n\n");
|
||||
|
||||
|
||||
// clear GPIO output port
|
||||
|
@ -87,7 +87,7 @@ int main() {
|
|||
|
||||
|
||||
// install GPTMR interrupt handler
|
||||
neorv32_rte_exception_install(GPTMR_RTE_ID, gptmr_firq_handler);
|
||||
neorv32_rte_handler_install(GPTMR_RTE_ID, gptmr_firq_handler);
|
||||
|
||||
// configure timer for 1Hz ticks in continuous mode (with clock divisor = 8)
|
||||
neorv32_gptmr_setup(CLK_PRSC_8, 1, NEORV32_SYSINFO.CLK / (8 * 2));
|
||||
|
|
|
@ -73,13 +73,13 @@ int main() {
|
|||
|
||||
// check if MTIME unit is implemented at all
|
||||
if (neorv32_mtime_available() == 0) {
|
||||
neorv32_uart0_print("ERROR! MTIME timer not implemented!\n");
|
||||
neorv32_uart0_puts("ERROR! MTIME timer not implemented!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Intro
|
||||
neorv32_uart0_print("RISC-V Machine System Timer (MTIME) demo Program.\n"
|
||||
"Toggles GPIO.output(0) at 1Hz using the RISC-V 'MTI' interrupt.\n\n");
|
||||
neorv32_uart0_puts("RISC-V Machine System Timer (MTIME) demo Program.\n"
|
||||
"Toggles GPIO.output(0) at 1Hz using the RISC-V 'MTI' interrupt.\n\n");
|
||||
|
||||
|
||||
// clear GPIO output port
|
||||
|
@ -87,7 +87,7 @@ int main() {
|
|||
|
||||
|
||||
// install MTIME interrupt handler to RTE
|
||||
neorv32_rte_exception_install(RTE_TRAP_MTI, mtime_irq_handler);
|
||||
neorv32_rte_handler_install(RTE_TRAP_MTI, mtime_irq_handler);
|
||||
|
||||
// configure MTIME timer's first interrupt to appear after SYSTEM_CLOCK / 2 cycles (toggle at 2Hz)
|
||||
// starting from _now_
|
||||
|
|
|
@ -111,7 +111,7 @@ int main() {
|
|||
/*
|
||||
// install "ONEWIRE operation done interrupt" - this is optional
|
||||
neorv32_uart0_printf("Installing ONEWIRE 'operation done' interrupt handler...\n");
|
||||
neorv32_rte_exception_install(ONEWIRE_RTE_ID, onewire_firq_handler);
|
||||
neorv32_rte_handler_install(ONEWIRE_RTE_ID, onewire_firq_handler);
|
||||
neorv32_cpu_irq_enable(ONEWIRE_FIRQ_ENABLE); // enable ONEWIRE FIRQ
|
||||
neorv32_cpu_eint(); // enable global interrupt flag
|
||||
*/
|
||||
|
|
|
@ -108,8 +108,8 @@ int main() {
|
|||
|
||||
|
||||
// NEORV32 runtime environment: install SLINK FIRQ handlers
|
||||
neorv32_rte_exception_install(SLINK_RX_RTE_ID, slink_rx_firq_handler);
|
||||
neorv32_rte_exception_install(SLINK_TX_RTE_ID, slink_tx_firq_handler);
|
||||
neorv32_rte_handler_install(SLINK_RX_RTE_ID, slink_rx_firq_handler);
|
||||
neorv32_rte_handler_install(SLINK_TX_RTE_ID, slink_tx_firq_handler);
|
||||
neorv32_cpu_irq_enable(SLINK_RX_FIRQ_ENABLE); // enable SLINK RX FIRQ
|
||||
neorv32_cpu_irq_enable(SLINK_TX_FIRQ_ENABLE); // enable SLINK RX FIRQ
|
||||
neorv32_cpu_eint(); // enable global interrupt flag
|
||||
|
|
|
@ -104,7 +104,7 @@ int main()
|
|||
}
|
||||
|
||||
// enable IRQ system
|
||||
neorv32_rte_exception_install(SPI_RTE_ID, spi_irq_handler); // SPI to RTE
|
||||
neorv32_rte_handler_install(SPI_RTE_ID, spi_irq_handler); // SPI to RTE
|
||||
neorv32_cpu_irq_enable(SPI_FIRQ_ENABLE); // FIRQ6: SPI Interrupt
|
||||
neorv32_cpu_eint(); // enable global interrupts
|
||||
|
||||
|
|
|
@ -82,25 +82,25 @@ int main() {
|
|||
neorv32_rte_check_isa(0); // silent = 0 -> show message if isa mismatch
|
||||
|
||||
// simple text output via UART (strings only)
|
||||
neorv32_uart0_print("\nWatchdog system reset demo program\n\n");
|
||||
neorv32_uart0_puts("\nWatchdog system reset demo program\n\n");
|
||||
|
||||
|
||||
// show the cause of the last processor reset
|
||||
neorv32_uart0_print("Cause of last processor reset: ");
|
||||
neorv32_uart0_puts("Cause of last processor reset: ");
|
||||
uint8_t wdt_cause = neorv32_wdt_get_cause();
|
||||
|
||||
if (wdt_cause == 0) {
|
||||
neorv32_uart0_print("External reset\n");
|
||||
neorv32_uart0_puts("External reset\n");
|
||||
}
|
||||
else if (wdt_cause == 1) {
|
||||
neorv32_uart0_print("Watchdog\n");
|
||||
neorv32_uart0_puts("Watchdog\n");
|
||||
}
|
||||
else {
|
||||
neorv32_uart0_print("Undefined\n");
|
||||
neorv32_uart0_puts("Undefined\n");
|
||||
}
|
||||
|
||||
|
||||
// the watchod has a 20-bit counter, which triggers either an interrupt or a system reset
|
||||
// the watchdog has a 20-bit counter, which triggers either an interrupt or a system reset
|
||||
// when overflowing
|
||||
|
||||
// init watchdog (watchdog timer increment = cpu_clock/64, trigger reset on overflow, lock
|
||||
|
@ -109,11 +109,11 @@ int main() {
|
|||
|
||||
|
||||
|
||||
neorv32_uart0_print("\n\nWill reset WDT 64 times.\n"
|
||||
"A system reset will be executed in the following time out.\n"
|
||||
"Press any key to trigger manual WDT hardware reset by WDT access with wrong password.\n"
|
||||
"Restart this program after reset to check for the reset cause.\n\n"
|
||||
"WDT resets: ");
|
||||
neorv32_uart0_puts("\n\nWill reset WDT 64 times.\n"
|
||||
"A system reset will be executed in the following time out.\n"
|
||||
"Press any key to trigger manual WDT hardware reset by WDT access with wrong password.\n"
|
||||
"Restart this program after reset to check for the reset cause.\n\n"
|
||||
"WDT resets: ");
|
||||
|
||||
uint8_t i;
|
||||
for (i=0; i<64; i++) {
|
||||
|
|
|
@ -124,7 +124,7 @@ int main() {
|
|||
|
||||
// check if Zfinx extension is implemented at all
|
||||
if ((neorv32_cpu_csr_read(CSR_MXISA) & (1<<CSR_MXISA_ZFINX)) == 0) {
|
||||
neorv32_uart0_print("Error! <Zfinx> extension not synthesized!\n");
|
||||
neorv32_uart0_puts("Error! <Zfinx> extension not synthesized!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ int main() {
|
|||
neorv32_rte_print_logo();
|
||||
|
||||
// say hello
|
||||
neorv32_uart0_print("Hello world! :)\n");
|
||||
neorv32_uart0_puts("Hello world! :)\n");
|
||||
|
||||
// print the IDs of the two statically declared instances of DemoClass
|
||||
demo1.print_id();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # Copyright (c) 2022, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
|
@ -65,7 +65,7 @@ int main() {
|
|||
// this is not required, but keeps us safe
|
||||
neorv32_rte_setup();
|
||||
|
||||
// init UART at default baud rate, no parity bits, ho hw flow control
|
||||
// init UART at default baud rate, no parity bits, no HW flow control
|
||||
neorv32_uart0_setup(BAUD_RATE, PARITY_NONE, FLOW_CONTROL_NONE);
|
||||
|
||||
// check available hardware extensions and compare with compiler flags
|
||||
|
@ -75,7 +75,7 @@ int main() {
|
|||
neorv32_rte_print_logo();
|
||||
|
||||
// say hello
|
||||
neorv32_uart0_print("Hello world! :)\n");
|
||||
neorv32_uart0_puts("Hello world! :)\n");
|
||||
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -156,7 +156,7 @@ int main() {
|
|||
int install_err = 0;
|
||||
// initialize ALL provided trap handler (overriding the default debug handlers)
|
||||
for (id=0; id<NEORV32_RTE_NUM_TRAPS; id++) {
|
||||
install_err += neorv32_rte_exception_install(id, global_trap_handler);
|
||||
install_err += neorv32_rte_handler_install(id, global_trap_handler);
|
||||
}
|
||||
if (install_err) {
|
||||
PRINT_CRITICAL("RTE fail!\n");
|
||||
|
@ -1622,7 +1622,7 @@ int main() {
|
|||
cnt_test++;
|
||||
|
||||
// uninstall custom handler and use default RTE debug handler
|
||||
neorv32_rte_exception_uninstall(RTE_TRAP_I_ILLEGAL);
|
||||
neorv32_rte_handler_uninstall(RTE_TRAP_I_ILLEGAL);
|
||||
|
||||
// trigger illegal instruction exception
|
||||
neorv32_cpu_csr_read(0xfff); // CSR not available
|
||||
|
@ -1636,7 +1636,7 @@ int main() {
|
|||
}
|
||||
|
||||
// restore original handler
|
||||
neorv32_rte_exception_install(RTE_TRAP_I_ILLEGAL, global_trap_handler);
|
||||
neorv32_rte_handler_install(RTE_TRAP_I_ILLEGAL, global_trap_handler);
|
||||
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
|
127
sw/lib/include/legacy.h
Normal file
127
sw/lib/include/legacy.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
// #################################################################################################
|
||||
// # << NEORV32: legacy.h - Backwards compatibility wrappers and functions >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2022, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file legacy.h
|
||||
* @brief Wrappers and functions for backwards compatibility.
|
||||
* @warning Do not use these functions for new designs as they are not supported and might get removed in the future.
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_legacy_h
|
||||
#define neorv32_legacy_h
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
// UART0 & UART1
|
||||
// ================================================================================================
|
||||
|
||||
/**********************************************************************//**
|
||||
* Print string (zero-terminated) via UART0. Print full line break "\r\n" for every '\n'.
|
||||
* @note This function is blocking.
|
||||
* @warning This function is deprecated!
|
||||
* @param[in] s Pointer to string.
|
||||
**************************************************************************/
|
||||
inline void __attribute__((deprecated("Use 'neorv32_uart0_puts()' instead."))) neorv32_uart0_print(const char *s) {
|
||||
neorv32_uart0_puts(s);
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
* Print string (zero-terminated) via UART1. Print full line break "\r\n" for every '\n'.
|
||||
* @note This function is blocking.
|
||||
* @warning This function is deprecated!
|
||||
* @param[in] s Pointer to string.
|
||||
**************************************************************************/
|
||||
inline void __attribute__((deprecated("Use 'neorv32_uart0_puts()' instead."))) neorv32_uart1_print(const char *s) {
|
||||
neorv32_uart1_puts(s);
|
||||
}
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
// NEORV32 Runtime Environment (RTE)
|
||||
// ================================================================================================
|
||||
|
||||
/**********************************************************************//**
|
||||
* Install trap handler function to NEORV32 runtime environment.
|
||||
* @warning This function is deprecated!
|
||||
* @param[in] id Identifier (type) of the targeted trap. See #NEORV32_RTE_TRAP_enum.
|
||||
* @param[in] handler The actual handler function for the specified trap (function MUST be of type "void function(void);").
|
||||
* @return 0 if success, 1 if error (invalid id or targeted trap not supported).
|
||||
**************************************************************************/
|
||||
inline int __attribute__((deprecated("Use 'neorv32_rte_handler_install()' instead."))) neorv32_rte_exception_install(uint8_t id, void (*handler)(void)) {
|
||||
return neorv32_rte_handler_install(id, handler);
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
* Uninstall trap handler function from NEORV32 runtime environment, which was
|
||||
* previously installed via neorv32_rte_exception_install(uint8_t id, void (*handler)(void)).
|
||||
* @warning This function is deprecated!
|
||||
* @param[in] id Identifier (type) of the targeted trap. See #NEORV32_RTE_TRAP_enum.
|
||||
* @return 0 if success, 1 if error (invalid id or targeted trap not supported).
|
||||
**************************************************************************/
|
||||
inline int __attribute__((deprecated("Use 'neorv32_rte_handler_uninstall()' instead."))) neorv32_rte_exception_uninstall(uint8_t id) {
|
||||
return neorv32_rte_handler_uninstall(id);
|
||||
}
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
// Custom Functions Unit (CFU)
|
||||
// ================================================================================================
|
||||
|
||||
/**********************************************************************//**
|
||||
* @name Backward-compatibility layer (before version v1.7.8.2)
|
||||
* @warning This function is deprecated!
|
||||
**************************************************************************/
|
||||
/**@{*/
|
||||
/** R3-type CFU custom instruction 0 (funct3 = 000) */
|
||||
#define neorv32_cfu_cmd0(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 0, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 1 (funct3 = 001) */
|
||||
#define neorv32_cfu_cmd1(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 1, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 2 (funct3 = 010) */
|
||||
#define neorv32_cfu_cmd2(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 2, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 3 (funct3 = 011) */
|
||||
#define neorv32_cfu_cmd3(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 3, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 4 (funct3 = 100) */
|
||||
#define neorv32_cfu_cmd4(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 4, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 5 (funct3 = 101) */
|
||||
#define neorv32_cfu_cmd5(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 5, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 6 (funct3 = 110) */
|
||||
#define neorv32_cfu_cmd6(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 6, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 7 (funct3 = 111) */
|
||||
#define neorv32_cfu_cmd7(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 7, rs1, rs2)
|
||||
/**@}*/
|
||||
|
||||
|
||||
|
||||
#endif // neorv32_legacy_h
|
|
@ -1471,6 +1471,9 @@ enum NEORV32_SYSINFO_SOC_enum {
|
|||
#include "neorv32_xip.h"
|
||||
#include "neorv32_xirq.h"
|
||||
|
||||
// backwards compatibility layer
|
||||
#include "legacy.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@ int neorv32_cpu_cfu_available(void);
|
|||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @name Low-level CFU custom instruction wrappers ("intrinsics")
|
||||
* @name Low-level CFU custom instructions ("intrinsics")
|
||||
**************************************************************************/
|
||||
/**@{*/
|
||||
/** R3-type CFU custom instruction prototype */
|
||||
|
@ -59,29 +59,4 @@ int neorv32_cpu_cfu_available(void);
|
|||
#define neorv32_cfu_r5_instr_b(rs1, rs2, rs3, rs4) CUSTOM_INSTR_R5_TYPE(rs4, rs3, rs2, rs1, RISCV_OPCODE_CUSTOM3)
|
||||
/**@}*/
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @name Backward-compatibility layer (before version v1.7.8.2)
|
||||
* @note DO NOT USE FOR NEW DESIGNS!
|
||||
* @warning THESE WRAPPERS WILL BE REMOVED SOON!
|
||||
**************************************************************************/
|
||||
/**@{*/
|
||||
/** R3-type CFU custom instruction 0 (funct3 = 000) */
|
||||
#define neorv32_cfu_cmd0(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 0, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 1 (funct3 = 001) */
|
||||
#define neorv32_cfu_cmd1(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 1, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 2 (funct3 = 010) */
|
||||
#define neorv32_cfu_cmd2(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 2, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 3 (funct3 = 011) */
|
||||
#define neorv32_cfu_cmd3(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 3, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 4 (funct3 = 100) */
|
||||
#define neorv32_cfu_cmd4(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 4, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 5 (funct3 = 101) */
|
||||
#define neorv32_cfu_cmd5(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 5, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 6 (funct3 = 110) */
|
||||
#define neorv32_cfu_cmd6(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 6, rs1, rs2)
|
||||
/** R3-type CFU custom instruction 7 (funct3 = 111) */
|
||||
#define neorv32_cfu_cmd7(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 7, rs1, rs2)
|
||||
/**@}*/
|
||||
|
||||
#endif // neorv32_cpu_cfu_h
|
||||
|
|
|
@ -41,6 +41,13 @@
|
|||
#ifndef neorv32_rte_h
|
||||
#define neorv32_rte_h
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* NEORV32 runtime environment: Number of available traps.
|
||||
**************************************************************************/
|
||||
#define NEORV32_RTE_NUM_TRAPS 29
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* NEORV32 runtime environment trap IDs.
|
||||
**************************************************************************/
|
||||
|
@ -77,16 +84,10 @@ enum NEORV32_RTE_TRAP_enum {
|
|||
};
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* NEORV32 runtime environment: Number of available traps.
|
||||
**************************************************************************/
|
||||
#define NEORV32_RTE_NUM_TRAPS 29
|
||||
|
||||
|
||||
// prototypes
|
||||
void neorv32_rte_setup(void);
|
||||
int neorv32_rte_exception_install(uint8_t id, void (*handler)(void));
|
||||
int neorv32_rte_exception_uninstall(uint8_t id);
|
||||
int neorv32_rte_handler_install(uint8_t id, void (*handler)(void));
|
||||
int neorv32_rte_handler_uninstall(uint8_t id);
|
||||
|
||||
void neorv32_rte_print_hw_config(void);
|
||||
void neorv32_rte_print_hw_version(void);
|
||||
|
|
|
@ -59,7 +59,7 @@ char neorv32_uart0_getc(void);
|
|||
int neorv32_uart0_char_received(void);
|
||||
int neorv32_uart0_getc_safe(char *data);
|
||||
char neorv32_uart0_char_received_get(void);
|
||||
void neorv32_uart0_print(const char *s);
|
||||
void neorv32_uart0_puts(const char *s);
|
||||
void neorv32_uart0_printf(const char *format, ...);
|
||||
int neorv32_uart0_scan(char *buffer, int max_size, int echo);
|
||||
|
||||
|
@ -74,7 +74,7 @@ char neorv32_uart1_getc(void);
|
|||
int neorv32_uart1_char_received(void);
|
||||
int neorv32_uart1_getc_safe(char *data);
|
||||
char neorv32_uart1_char_received_get(void);
|
||||
void neorv32_uart1_print(const char *s);
|
||||
void neorv32_uart1_puts(const char *s);
|
||||
void neorv32_uart1_printf(const char *format, ...);
|
||||
int neorv32_uart1_scan(char *buffer, int max_size, int echo);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static uint32_t __neorv32_rte_vector_lut[NEORV32_RTE_NUM_TRAPS] __attribute__((u
|
|||
|
||||
// private functions
|
||||
static void __attribute__((__interrupt__)) __neorv32_rte_core(void) __attribute__((aligned(4)));
|
||||
static void __neorv32_rte_debug_exc_handler(void);
|
||||
static void __neorv32_rte_debug_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);
|
||||
|
@ -58,9 +58,9 @@ static void __neorv32_rte_print_hex_half(uint16_t num);
|
|||
/**********************************************************************//**
|
||||
* 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)).
|
||||
* @note This function installs a debug handler for ALL trap sources, which
|
||||
* gives detailed information about the trap. Actual handler can be installed afterwards
|
||||
* via neorv32_rte_handler_install(uint8_t id, void (*handler)(void)).
|
||||
**************************************************************************/
|
||||
void neorv32_rte_setup(void) {
|
||||
|
||||
|
@ -76,25 +76,22 @@ void neorv32_rte_setup(void) {
|
|||
// clear BUSKEEPER error flags
|
||||
NEORV32_BUSKEEPER.CTRL = 0;
|
||||
|
||||
// install debug handler for all sources
|
||||
// install debug handler for all trap sources
|
||||
uint8_t id;
|
||||
for (id = 0; id < (sizeof(__neorv32_rte_vector_lut)/sizeof(__neorv32_rte_vector_lut[0])); id++) {
|
||||
neorv32_rte_exception_uninstall(id); // this will configure the debug handler
|
||||
neorv32_rte_handler_uninstall(id); // this will configure the debug handler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Install exception handler function to NEORV32 runtime environment.
|
||||
* Install trap 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).
|
||||
*
|
||||
* @param[in] id Identifier (type) of the targeted exception. See #NEORV32_RTE_TRAP_enum.
|
||||
* @param[in] handler The actual handler function for the specified exception (function MUST be of type "void function(void);").
|
||||
* @return 0 if success, 1 if error (invalid id or targeted exception not supported).
|
||||
* @param[in] id Identifier (type) of the targeted trap. See #NEORV32_RTE_TRAP_enum.
|
||||
* @param[in] handler The actual handler function for the specified trap (function MUST be of type "void function(void);").
|
||||
* @return 0 if success, 1 if error (invalid id or targeted trap not supported).
|
||||
**************************************************************************/
|
||||
int neorv32_rte_exception_install(uint8_t id, void (*handler)(void)) {
|
||||
int neorv32_rte_handler_install(uint8_t id, void (*handler)(void)) {
|
||||
|
||||
// id valid?
|
||||
if ((id >= RTE_TRAP_I_MISALIGNED) && (id <= CSR_MIE_FIRQ15E)) {
|
||||
|
@ -106,20 +103,17 @@ int neorv32_rte_exception_install(uint8_t id, void (*handler)(void)) {
|
|||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Uninstall exception handler function from NEORV32 runtime environment, which was
|
||||
* previously installed via neorv32_rte_exception_install(uint8_t id, void (*handler)(void)).
|
||||
* Uninstall trap handler function from NEORV32 runtime environment, which was
|
||||
* previously installed via neorv32_rte_handler_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).
|
||||
*
|
||||
* @param[in] id Identifier (type) of the targeted exception. See #NEORV32_RTE_TRAP_enum.
|
||||
* @return 0 if success, 1 if error (invalid id or targeted exception not supported).
|
||||
* @param[in] id Identifier (type) of the targeted trap. See #NEORV32_RTE_TRAP_enum.
|
||||
* @return 0 if success, 1 if error (invalid id or targeted trap not supported).
|
||||
**************************************************************************/
|
||||
int neorv32_rte_exception_uninstall(uint8_t id) {
|
||||
int neorv32_rte_handler_uninstall(uint8_t id) {
|
||||
|
||||
// id valid?
|
||||
if ((id >= RTE_TRAP_I_MISALIGNED) && (id <= CSR_MIE_FIRQ15E)) {
|
||||
__neorv32_rte_vector_lut[id] = (uint32_t)(&__neorv32_rte_debug_exc_handler); // use dummy handler in case the exception is accidentally triggered
|
||||
__neorv32_rte_vector_lut[id] = (uint32_t)(&__neorv32_rte_debug_handler); // use dummy handler in case the trap is accidentally triggered
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -127,11 +121,9 @@ int neorv32_rte_exception_uninstall(uint8_t id) {
|
|||
|
||||
|
||||
/**********************************************************************//**
|
||||
* This is the core of the NEORV32 RTE.
|
||||
* This is the [private!] 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!
|
||||
* @warning When using the the RTE, this function is the ONLY function that uses the 'interrupt' attribute!
|
||||
**************************************************************************/
|
||||
static void __attribute__((__interrupt__)) __attribute__((aligned(4))) __neorv32_rte_core(void) {
|
||||
|
||||
|
@ -169,7 +161,7 @@ static void __attribute__((__interrupt__)) __attribute__((aligned(4))) __neorv32
|
|||
case TRAP_CODE_FIRQ_13: rte_handler = __neorv32_rte_vector_lut[RTE_TRAP_FIRQ_13]; break;
|
||||
case TRAP_CODE_FIRQ_14: rte_handler = __neorv32_rte_vector_lut[RTE_TRAP_FIRQ_14]; break;
|
||||
case TRAP_CODE_FIRQ_15: rte_handler = __neorv32_rte_vector_lut[RTE_TRAP_FIRQ_15]; break;
|
||||
default: rte_handler = (uint32_t)(&__neorv32_rte_debug_exc_handler); break;
|
||||
default: rte_handler = (uint32_t)(&__neorv32_rte_debug_handler); break;
|
||||
}
|
||||
|
||||
// execute handler
|
||||
|
@ -178,7 +170,7 @@ static void __attribute__((__interrupt__)) __attribute__((aligned(4))) __neorv32
|
|||
(*handler_pnt)();
|
||||
|
||||
// compute return address
|
||||
// WARNING: some exceptions are absolutely NOT resumable! (e.g. instruction access fault)
|
||||
// WARNING: some traps might NOT be resumable! (e.g. instruction access fault)
|
||||
if (((int32_t)rte_mcause) >= 0) { // modify pc only if not interrupt (MSB cleared)
|
||||
|
||||
uint32_t rte_mepc = neorv32_cpu_csr_read(CSR_MEPC);
|
||||
|
@ -200,34 +192,34 @@ static void __attribute__((__interrupt__)) __attribute__((aligned(4))) __neorv32
|
|||
|
||||
|
||||
/**********************************************************************//**
|
||||
* 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 runtime environment: Debug trap handler, printing various information via UART.
|
||||
* @note This function is used by neorv32_rte_handler_uninstall(void) only.
|
||||
**************************************************************************/
|
||||
static void __neorv32_rte_debug_exc_handler(void) {
|
||||
static void __neorv32_rte_debug_handler(void) {
|
||||
|
||||
if (neorv32_uart0_available() == 0) {
|
||||
return; // handler cannot output anything if UART0 is not implemented
|
||||
}
|
||||
|
||||
// intro
|
||||
neorv32_uart0_print("<RTE> ");
|
||||
neorv32_uart0_puts("<RTE> ");
|
||||
|
||||
// cause
|
||||
uint32_t trap_cause = neorv32_cpu_csr_read(CSR_MCAUSE);
|
||||
switch (trap_cause) {
|
||||
case TRAP_CODE_I_MISALIGNED: neorv32_uart0_print("Instruction address misaligned"); break;
|
||||
case TRAP_CODE_I_ACCESS: neorv32_uart0_print("Instruction access fault"); break;
|
||||
case TRAP_CODE_I_ILLEGAL: neorv32_uart0_print("Illegal instruction"); break;
|
||||
case TRAP_CODE_BREAKPOINT: neorv32_uart0_print("Breakpoint"); break;
|
||||
case TRAP_CODE_L_MISALIGNED: neorv32_uart0_print("Load address misaligned"); break;
|
||||
case TRAP_CODE_L_ACCESS: neorv32_uart0_print("Load access fault"); break;
|
||||
case TRAP_CODE_S_MISALIGNED: neorv32_uart0_print("Store address misaligned"); break;
|
||||
case TRAP_CODE_S_ACCESS: neorv32_uart0_print("Store access fault"); break;
|
||||
case TRAP_CODE_UENV_CALL: neorv32_uart0_print("Environment call from U-mode"); break;
|
||||
case TRAP_CODE_MENV_CALL: neorv32_uart0_print("Environment call from M-mode"); break;
|
||||
case TRAP_CODE_MSI: neorv32_uart0_print("Machine software IRQ"); break;
|
||||
case TRAP_CODE_MTI: neorv32_uart0_print("Machine timer IRQ"); break;
|
||||
case TRAP_CODE_MEI: neorv32_uart0_print("Machine external IRQ"); break;
|
||||
case TRAP_CODE_I_MISALIGNED: neorv32_uart0_puts("Instruction address misaligned"); break;
|
||||
case TRAP_CODE_I_ACCESS: neorv32_uart0_puts("Instruction access fault"); break;
|
||||
case TRAP_CODE_I_ILLEGAL: neorv32_uart0_puts("Illegal instruction"); break;
|
||||
case TRAP_CODE_BREAKPOINT: neorv32_uart0_puts("Breakpoint"); break;
|
||||
case TRAP_CODE_L_MISALIGNED: neorv32_uart0_puts("Load address misaligned"); break;
|
||||
case TRAP_CODE_L_ACCESS: neorv32_uart0_puts("Load access fault"); break;
|
||||
case TRAP_CODE_S_MISALIGNED: neorv32_uart0_puts("Store address misaligned"); break;
|
||||
case TRAP_CODE_S_ACCESS: neorv32_uart0_puts("Store access fault"); break;
|
||||
case TRAP_CODE_UENV_CALL: neorv32_uart0_puts("Environment call from U-mode"); break;
|
||||
case TRAP_CODE_MENV_CALL: neorv32_uart0_puts("Environment call from M-mode"); break;
|
||||
case TRAP_CODE_MSI: neorv32_uart0_puts("Machine software IRQ"); break;
|
||||
case TRAP_CODE_MTI: neorv32_uart0_puts("Machine timer IRQ"); break;
|
||||
case TRAP_CODE_MEI: neorv32_uart0_puts("Machine external IRQ"); break;
|
||||
case TRAP_CODE_FIRQ_0:
|
||||
case TRAP_CODE_FIRQ_1:
|
||||
case TRAP_CODE_FIRQ_2:
|
||||
|
@ -243,8 +235,8 @@ static void __neorv32_rte_debug_exc_handler(void) {
|
|||
case TRAP_CODE_FIRQ_12:
|
||||
case TRAP_CODE_FIRQ_13:
|
||||
case TRAP_CODE_FIRQ_14:
|
||||
case TRAP_CODE_FIRQ_15: neorv32_uart0_print("Fast IRQ "); __neorv32_rte_print_hex_word(trap_cause & 0xf); break;
|
||||
default: neorv32_uart0_print("Unknown trap cause: "); __neorv32_rte_print_hex_word(trap_cause); break;
|
||||
case TRAP_CODE_FIRQ_15: neorv32_uart0_puts("Fast IRQ "); __neorv32_rte_print_hex_word(trap_cause & 0xf); break;
|
||||
default: neorv32_uart0_puts("Unknown trap cause: "); __neorv32_rte_print_hex_word(trap_cause); break;
|
||||
}
|
||||
|
||||
// check cause if bus access fault exception
|
||||
|
@ -252,25 +244,25 @@ static void __neorv32_rte_debug_exc_handler(void) {
|
|||
uint32_t bus_err = NEORV32_BUSKEEPER.CTRL;
|
||||
if (bus_err & (1<<BUSKEEPER_ERR_FLAG)) { // exception caused by bus system?
|
||||
if (bus_err & (1<<BUSKEEPER_ERR_TYPE)) {
|
||||
neorv32_uart0_print(" [TIMEOUT_ERR]");
|
||||
neorv32_uart0_puts(" [TIMEOUT_ERR]");
|
||||
}
|
||||
else {
|
||||
neorv32_uart0_print(" [DEVICE_ERR]");
|
||||
neorv32_uart0_puts(" [DEVICE_ERR]");
|
||||
}
|
||||
}
|
||||
else { // exception was not caused by bus system -> has to be caused by PMP rule violation
|
||||
neorv32_uart0_print(" [PMP_ERR]");
|
||||
neorv32_uart0_puts(" [PMP_ERR]");
|
||||
}
|
||||
}
|
||||
|
||||
// instruction address
|
||||
neorv32_uart0_print(" @ PC=");
|
||||
neorv32_uart0_puts(" @ PC=");
|
||||
uint32_t mepc = neorv32_cpu_csr_read(CSR_MEPC);
|
||||
__neorv32_rte_print_hex_word(mepc);
|
||||
|
||||
// additional info
|
||||
if (trap_cause == TRAP_CODE_I_ILLEGAL) { // illegal instruction
|
||||
neorv32_uart0_print(", INST=");
|
||||
neorv32_uart0_puts(", INST=");
|
||||
uint32_t instr_lo = (uint32_t)neorv32_cpu_load_unsigned_half(mepc);
|
||||
uint32_t instr_hi = (uint32_t)neorv32_cpu_load_unsigned_half(mepc + 2);
|
||||
if ((instr_lo & 3) != 3) { // is compressed instruction
|
||||
|
@ -281,12 +273,12 @@ static void __neorv32_rte_debug_exc_handler(void) {
|
|||
}
|
||||
}
|
||||
else if ((trap_cause & 0x80000000U) == 0) { // not an interrupt
|
||||
neorv32_uart0_print(", ADDR=");
|
||||
neorv32_uart0_puts(", ADDR=");
|
||||
__neorv32_rte_print_hex_word(neorv32_cpu_csr_read(CSR_MTVAL));
|
||||
}
|
||||
|
||||
// outro
|
||||
neorv32_uart0_print(" </RTE>\n");
|
||||
neorv32_uart0_puts(" </RTE>\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -524,10 +516,10 @@ void neorv32_rte_print_hw_config(void) {
|
|||
static void __neorv32_rte_print_true_false(int state) {
|
||||
|
||||
if (state) {
|
||||
neorv32_uart0_print("yes\n");
|
||||
neorv32_uart0_puts("yes\n");
|
||||
}
|
||||
else {
|
||||
neorv32_uart0_print("no\n");
|
||||
neorv32_uart0_puts("no\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,7 +553,7 @@ void __neorv32_rte_print_hex_word(uint32_t num) {
|
|||
|
||||
static const char hex_symbols[16] = "0123456789ABCDEF";
|
||||
|
||||
neorv32_uart0_print("0x");
|
||||
neorv32_uart0_puts("0x");
|
||||
|
||||
int i;
|
||||
for (i=0; i<8; i++) {
|
||||
|
@ -581,7 +573,7 @@ void __neorv32_rte_print_hex_half(uint16_t num) {
|
|||
|
||||
static const char hex_symbols[16] = "0123456789ABCDEF";
|
||||
|
||||
neorv32_uart0_print("0x");
|
||||
neorv32_uart0_puts("0x");
|
||||
|
||||
int i;
|
||||
for (i=0; i<4; i++) {
|
||||
|
@ -634,8 +626,8 @@ void neorv32_rte_print_credits(void) {
|
|||
return; // cannot output anything if UART0 is not implemented
|
||||
}
|
||||
|
||||
neorv32_uart0_print("The NEORV32 RISC-V Processor, github.com/stnolting/neorv32\n"
|
||||
"(c) 2022 by Dipl.-Ing. Stephan Nolting, BSD 3-Clause License\n\n");
|
||||
neorv32_uart0_puts("The NEORV32 RISC-V Processor, github.com/stnolting/neorv32\n"
|
||||
"(c) 2022 by Dipl.-Ing. Stephan Nolting, BSD 3-Clause License\n\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -665,7 +657,7 @@ void neorv32_rte_print_logo(void) {
|
|||
}
|
||||
|
||||
for (u=0; u<9; u++) {
|
||||
neorv32_uart0_print("\n");
|
||||
neorv32_uart0_puts("\n");
|
||||
for (v=0; v<7; v++) {
|
||||
tmp = logo_data_c[u][v];
|
||||
for (w=0; w<16; w++){
|
||||
|
@ -678,7 +670,7 @@ void neorv32_rte_print_logo(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
neorv32_uart0_print("\n");
|
||||
neorv32_uart0_puts("\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -691,7 +683,7 @@ void neorv32_rte_print_license(void) {
|
|||
return; // cannot output anything if UART0 is not implemented
|
||||
}
|
||||
|
||||
neorv32_uart0_print(
|
||||
neorv32_uart0_puts(
|
||||
"\n"
|
||||
"BSD 3-Clause License\n"
|
||||
"\n"
|
||||
|
|
|
@ -331,7 +331,7 @@ char neorv32_uart0_char_received_get(void) {
|
|||
*
|
||||
* @param[in] s Pointer to string.
|
||||
**************************************************************************/
|
||||
void neorv32_uart0_print(const char *s) {
|
||||
void neorv32_uart0_puts(const char *s) {
|
||||
|
||||
char c = 0;
|
||||
while ((c = *s++)) {
|
||||
|
@ -373,7 +373,7 @@ void neorv32_uart0_printf(const char *format, ...) {
|
|||
c = *format++;
|
||||
switch (c) {
|
||||
case 's': // string
|
||||
neorv32_uart0_print(va_arg(a, char*));
|
||||
neorv32_uart0_puts(va_arg(a, char*));
|
||||
break;
|
||||
case 'c': // char
|
||||
neorv32_uart0_putc((char)va_arg(a, int));
|
||||
|
@ -386,11 +386,11 @@ void neorv32_uart0_printf(const char *format, ...) {
|
|||
neorv32_uart0_putc('-');
|
||||
}
|
||||
__neorv32_uart_itoa((uint32_t)n, string_buf);
|
||||
neorv32_uart0_print(string_buf);
|
||||
neorv32_uart0_puts(string_buf);
|
||||
break;
|
||||
case 'u': // 32-bit unsigned
|
||||
__neorv32_uart_itoa(va_arg(a, uint32_t), string_buf);
|
||||
neorv32_uart0_print(string_buf);
|
||||
neorv32_uart0_puts(string_buf);
|
||||
break;
|
||||
case 'x': // 32-bit hexadecimal
|
||||
case 'p':
|
||||
|
@ -399,7 +399,7 @@ void neorv32_uart0_printf(const char *format, ...) {
|
|||
if (c == 'X') {
|
||||
__neorv32_uart_touppercase(11, string_buf);
|
||||
}
|
||||
neorv32_uart0_print(string_buf);
|
||||
neorv32_uart0_puts(string_buf);
|
||||
break;
|
||||
default: // unsupported format
|
||||
neorv32_uart0_putc('%');
|
||||
|
@ -438,7 +438,7 @@ int neorv32_uart0_scan(char *buffer, int max_size, int echo) {
|
|||
if (c == '\b') { // BACKSPACE
|
||||
if (length != 0) {
|
||||
if (echo) {
|
||||
neorv32_uart0_print("\b \b"); // delete last char in console
|
||||
neorv32_uart0_puts("\b \b"); // delete last char in console
|
||||
}
|
||||
buffer--;
|
||||
length--;
|
||||
|
@ -706,7 +706,7 @@ char neorv32_uart1_char_received_get(void) {
|
|||
*
|
||||
* @param[in] s Pointer to string.
|
||||
**************************************************************************/
|
||||
void neorv32_uart1_print(const char *s) {
|
||||
void neorv32_uart1_puts(const char *s) {
|
||||
|
||||
char c = 0;
|
||||
while ((c = *s++)) {
|
||||
|
@ -748,7 +748,7 @@ void neorv32_uart1_printf(const char *format, ...) {
|
|||
c = *format++;
|
||||
switch (c) {
|
||||
case 's': // string
|
||||
neorv32_uart1_print(va_arg(a, char*));
|
||||
neorv32_uart1_puts(va_arg(a, char*));
|
||||
break;
|
||||
case 'c': // char
|
||||
neorv32_uart1_putc((char)va_arg(a, int));
|
||||
|
@ -761,11 +761,11 @@ void neorv32_uart1_printf(const char *format, ...) {
|
|||
neorv32_uart1_putc('-');
|
||||
}
|
||||
__neorv32_uart_itoa((uint32_t)n, string_buf);
|
||||
neorv32_uart1_print(string_buf);
|
||||
neorv32_uart1_puts(string_buf);
|
||||
break;
|
||||
case 'u': // 32-bit unsigned
|
||||
__neorv32_uart_itoa(va_arg(a, uint32_t), string_buf);
|
||||
neorv32_uart1_print(string_buf);
|
||||
neorv32_uart1_puts(string_buf);
|
||||
break;
|
||||
case 'x': // 32-bit hexadecimal
|
||||
case 'p':
|
||||
|
@ -774,7 +774,7 @@ void neorv32_uart1_printf(const char *format, ...) {
|
|||
if (c == 'X') {
|
||||
__neorv32_uart_touppercase(11, string_buf);
|
||||
}
|
||||
neorv32_uart1_print(string_buf);
|
||||
neorv32_uart1_puts(string_buf);
|
||||
break;
|
||||
default: // unsupported format
|
||||
neorv32_uart1_putc('%');
|
||||
|
@ -813,7 +813,7 @@ int neorv32_uart1_scan(char *buffer, int max_size, int echo) {
|
|||
if (c == '\b') { // BACKSPACE
|
||||
if (length != 0) {
|
||||
if (echo) {
|
||||
neorv32_uart1_print("\b \b"); // delete last char in console
|
||||
neorv32_uart1_puts("\b \b"); // delete last char in console
|
||||
}
|
||||
buffer--;
|
||||
length--;
|
||||
|
|
|
@ -87,7 +87,7 @@ int neorv32_xirq_setup(void) {
|
|||
}
|
||||
|
||||
// register XIRQ handler in NEORV32 RTE
|
||||
return neorv32_rte_exception_install(XIRQ_RTE_ID, __neorv32_xirq_core);
|
||||
return neorv32_rte_handler_install(XIRQ_RTE_ID, __neorv32_xirq_core);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ extern const volatile unsigned int __crt0_main_exit;
|
|||
void unimplemented_syscall()
|
||||
{
|
||||
if (neorv32_uart0_available()) {
|
||||
neorv32_uart0_print("<syscalls.c> Unimplemented system call called!\n");
|
||||
neorv32_uart0_puts("<syscalls.c> Unimplemented system call called!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue