RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
Board Support Package

Overview

Board Support Package provide default hardware mappings and initialization for RV64.

Topics

 API Functions
 Board Support Package API functions.
 Bsp_printf Config (Legacy)
 Only applicable when using setting (NEWLIB=NOSTD) in makefile. Toggle between the Lite and Full printf implementations and enable specific format specifiers.
 Default SoC Peripherals
 Default Hardware mappings for the primary Interrupt Controller and Timer.

Usage & Initialization

This module provides configurations and initialization for the primary UART, CLINT timer, and PLIC interrupt controller on the EfxSapphireSoC platform.

Usage 1 — Basic Initialization

Always call bsp_init() at the start of main function to initialize UART module.

User could use bsp_putChar and bsp_getChar for character I/O which are mapped to the physical UART if it exists in hardware, otherwise they will be safe dummy macros that do nothing.

It is recommended to use newlib-nano for the optimized printf and scanf which are also mapped to the physical UART for better functionality and compatibility with the C library.

#include "bsp.h"
void main() {
bsp_init(); // Initialize UART and other peripherals
}
Board Support Package API definitions.
void bsp_init()
Initialize Board Support Package Peripherals.
Definition bsp.c:6

Usage 2 — Semihosting Print

To enable semihosting print functionality, define ENABLE_SEMIHOSTING_PRINT as 1.

#define ENABLE_SEMIHOSTING_PRINT 1 // Enable printing with semihosting.

Usage 3 — Legacy bsp_printf (NOSTD)

To use the legacy bsp_printf (same as RV32), change NEWLIB to NOSTD in the makefile which overrides the standard printf.

User may configure the behavior of this custom printf via BSP_SETTING:

#define ENABLE_BSP_PRINTF 1 // Lite: char, string, decimal, hex, floats.
#define ENABLE_BSP_PRINTF_FULL 1 // Full: flags and precisions.
#define ENABLE_BRIDGE_FULL_TO_LITE 1 // Share functions between full and lite.
#define ENABLE_PRINTF_WARNING 1 // Warn on unsupported format specifier.
#define ENABLE_FLOATING_POINT_SUPPORT 0 // Support for %f (Printing only)
#define ENABLE_FP_EXPONENTIAL_SUPPORT 0 // Support for %e / %E
#define ENABLE_PTRDIFF_SUPPORT 0 // Support for %t (Pointer differences)
#define ENABLE_LONG_LONG_SUPPORT 1 // Support for %lld / %llu
See also
Bsp_printf Config (Legacy) for more detail about Bsp_printf Configuration

Usage 4 — UART Configuration

To configure the physical UART parameters, modify the following macros. See Default SoC Peripherals for the full list of hardware mappings.

By default, it is configured to use the physical UART if it exists in hardware, otherwise it will provide dummy macros that do nothing.

#define BSP_UART_BAUDRATE 115200
#define BSP_UART_DATA_LEN 8
#define BSP_UART_TERMINAL SYSTEM_UART_0_IO_CTRL