Anup Patel 8af20068d1 docs: Add library usage guide | 5 years ago | |
---|---|---|
docs | 5 years ago | |
firmware | 5 years ago | |
include | 5 years ago | |
lib | 5 years ago | |
platform | 5 years ago | |
.gitignore | 5 years ago | |
COPYING.BSD | 5 years ago | |
Makefile | 5 years ago | |
README.md | 5 years ago |
The RISC-V Supervisor Binary Interface (SBI) is a recommended interface between:
The RISC-V SBI specification is maintained as an independent project by the RISC-V Foundation in Github.
OpenSBI aims to provides an open-source and extensible implementation of the RISC-V SBI specification for case 1 mentioned above. OpenSBI implementation can be easily extended by RISC-V platform or System-on-Chip vendors to fit a particular hardware configuration.
OpenSBI provides three different components:
libsbi.a can be natively compiled or cross-compiled on a host with a different base architecture than RISC-V.
For cross-compiling, the environment variable CROSS_COMPILE must be defined to specify the name prefix of the RISC-V compiler toolchain executables, e.g. riscv64-unknown-elf- if the gcc executable used is riscv64-unknown-elf-gcc.
To build the generic OpenSBI library libsbi.a, simply execute:
make
All compiled binaries as well as the result libsbi.a static library file will be placed in the build/lib directory. To specify an alternate build root directory path, run:
make O=<build_directory>
To generate files to be installed for using libsbi.a in other projects, run:
make install
This will create the install directory with all necessary include files copied under the install/include directory and library file copied in the install/lib directory. To specify an alternate installation root directory path, run:
make I=<install_directory> install
The platform specific libplatsbi.a static library and the platform firmwares
are only built if the PLATFORM= argument is specified on
the make command line. must specify the relative path from
OpenSBI code directory to one of the leaf directories under the platform
directory. For example, to compile the platform library and firmwares for QEMU
RISC-V virt machine, should be qemu/virt.
To build libsbi.a, libplatsbi.a and the firmwares for a specific platform,
run: An alternate build directory path can also be specified. The platform specific library libplatsbi.a will be generated in the
build/platform//lib directory. The platform firmware files
will be under the build/platform//firmware directory.
The compiled firmwares will be available in two different format: an ELF file
and an expanded image file.
To install libsbi.a, libplatsbi.a, and the compiled firmwares, run: This will copy the compiled platform specific libraries and firmware files
under the install/platform// directory. An alternate
install root directory path can be specified as follows.
In addition, platform specific configuration options can be specified with the
top-level make command line. These options, such as PLATFORM_ or
FW_, are platform specific and described in more details in the
docs/platform/.md files and
docs/firmware/.md files.
OpenSBI is distributed under the terms of the BSD 2-clause license
(«Simplified BSD License» or «FreeBSD License», SPDX: BSD-2-Clause).
A copy of this license with OpenSBI copyright can be found in the file
COPYING.BSD. All source files in OpenSBI contain the 2-Clause BSD license SPDX short
indentifier in place of the full license text. This enables machine processing of license information based on the SPDX
License Identifiers that are available on the SPDX web site. OpenSBI source code also contains code reused from other projects as listed
below. The original license text of these projects is included in the source
files where the reused code is present. The OpenSBI project encourages and welcomes contributions. Contributions should
follow the rules described in OpenSBI Contribution Guideline document.
In particular, all patches sent should contain a Signed-off-by tag. Detailed documentation of various aspects of OpenSBI can be found under the
docs directory. The documentation covers the following topics. OpenSBI source code is also well documented. For source level documentation,
doxygen style is used. Please refer to Doxygen manual for details on this
format. Doxygen can be installed on Linux distributions using .deb packages using
the following command. For .rpm based Linux distributions, the following commands can be used. or To build a consolidated refman.pdf of all documentation, run: or the resulting refman.pdf will be available under the directory
/docs/latex. To install this file, run:
or refman.pdf will be installed under /docs.
make PLATFORM=<platform_subdir>
make PLATFORM=<platform_subdir> O=<build_directory>
make PLATFORM=<platform_subdir> install
make PLATFORM=<platform_subdir> I=<install_directory> install
License
SPDX-License-Identifier: BSD-2-Clause
Contributing to OpenSBI
Documentation
sudo apt-get install doxygen doxygen-latex doxygen-doc doxygen-gui graphviz
sudo yum install doxygen doxygen-latex doxywizard graphviz
sudo yum install doxygen doxygen-latex doxywizard graphviz
make docs
make O=<build_directory> docs
make install_docs
make I=<install_directory> install_docs