Aries Embedded RISC-V on MAX10 Benutzerhandbuch - Seite 18
Blättern Sie online oder laden Sie pdf Benutzerhandbuch für Computer Hardware Aries Embedded RISC-V on MAX10 herunter. Aries Embedded RISC-V on MAX10 20 Seiten.
RISC-V on MAX10 User Guide
5.2.2 FreeRTOS
For FreeRTOS the RISC-V specific files have been moved to the subdirectory FreeRTOS/portable. Timer
and software interrupts are dedicated to FreeRTOS to provide context switching. To modify the reference
to the current task, two additional functions (void StoreStackPointerInCurrentTCB(uintptr_t stack)
and uintptr_t LoadStackPointerFromCurrentTCB()) were added in task.h and tasks.c.
5.3 Modifying the Examples
The reference designs provide an ideal starting point for the development of a RISC-V enabled FPGA project.
The following sections show how to modify the FPGA design and the C firmware.
5.3.1 Adding a lightweight printf-library
An open source implementation of a printf library is available at https://github.com/eyalroz/printf. Copy
the files printf.c and printf.h from the src subdirectory to the RISC-V firmware directory. Then create a
new file called printf_impl.c with the following code inside:
# include
"printf.h"
# include
"FpgaConfig.h"
void _putchar(char
character) {
(character
if
UartPut(g_Uart,
}
UartPut(g_Uart, character);
}
The library can now be used in any file by including the header:
# include
"printf.h"
Replace the beginning of the main-function with the following code snippet for demonstrative purpose:
main() {
int
// Greetings
printf_("\n\n* * * Printf Demo - %s * *
// Set GPIO to output.
g_Pio->direction
=
0xffffffff;
Chapter 5. Reference Design
==
\n
){
\r
);
*\n", DBUILD_DATE);
Page 18 of 20