2019-01-29 20:26:14 +08:00
|
|
|
OpenSBI Platform Support Guideline
|
|
|
|
==================================
|
|
|
|
|
2019-05-05 18:33:25 +08:00
|
|
|
The OpenSBI platform support allows an implementation to define a set of
|
|
|
|
platform-specific hooks (hardware manipulation functions) in the form of a
|
2019-02-07 17:18:49 +08:00
|
|
|
*struct sbi_platform* data structure instance. This instance is required by
|
2019-05-05 18:33:25 +08:00
|
|
|
the platform-independent *libsbi.a* to execute platform-specific operations.
|
2019-01-29 20:26:14 +08:00
|
|
|
|
2019-05-05 18:33:25 +08:00
|
|
|
Each of the reference platform supports provided by OpenSBI defines an instance
|
2019-02-07 17:18:49 +08:00
|
|
|
of the *struct sbi_platform* data structure. For each supported platform,
|
2019-05-05 18:33:25 +08:00
|
|
|
*libplatsbi.a* integrates this instance with *libsbi.a* to create a
|
|
|
|
platform-specific OpenSBI static library. This library is installed
|
2019-02-07 17:18:49 +08:00
|
|
|
in *<install_directory>/platform/<platform_subdir>/lib/libplatsbi.a*
|
|
|
|
|
|
|
|
OpenSBI also provides implementation examples of bootable runtime firmwares for
|
|
|
|
the supported platforms. These firmwares are linked against *libplatsbi.a*.
|
|
|
|
Firmware binaries are installed in
|
|
|
|
*<install_directory>/platform/<platform_subdir>/bin*. These firmwares can be
|
|
|
|
used as executable runtime firmwares on the supported platforms as a replacement
|
2021-07-08 19:07:28 +08:00
|
|
|
for the legacy *riscv-pk* boot loader (BBL).
|
2019-01-29 20:26:14 +08:00
|
|
|
|
|
|
|
A complete doxygen-style documentation of *struct sbi_platform* and related
|
2019-02-07 17:18:49 +08:00
|
|
|
APIs is available in the file *include/sbi/sbi_platform.h*.
|
2019-01-29 20:26:14 +08:00
|
|
|
|
2019-05-05 18:33:25 +08:00
|
|
|
Adding support for a new platform
|
|
|
|
---------------------------------
|
2019-01-29 20:26:14 +08:00
|
|
|
|
2021-07-08 19:07:29 +08:00
|
|
|
Support for a new platform named *<xyz>* can be added as follows:
|
2019-01-29 20:26:14 +08:00
|
|
|
|
2021-07-08 19:07:29 +08:00
|
|
|
1. Create a directory named *<xyz>* under the *platform/* directory.
|
2022-08-08 12:04:31 +08:00
|
|
|
2. Create platform configuration files named *Kconfig* and *configs/defconfig*
|
|
|
|
under the *platform/<xyz>/* directory. These configuration files will
|
|
|
|
provide the build time configuration for the sources to be compiled.
|
|
|
|
3. Create a *platform/<xyz>/objects.mk* file for listing the platform
|
|
|
|
object files to be compiled. This file also provides platform-specific
|
2019-06-19 05:54:07 +08:00
|
|
|
compiler flags, and select firmware options.
|
2021-07-08 19:07:29 +08:00
|
|
|
4. Create a *platform/<xyz>/platform.c* file providing a
|
|
|
|
*struct sbi_platform* instance.
|
2019-01-29 20:26:14 +08:00
|
|
|
|
2019-05-05 18:33:25 +08:00
|
|
|
A platform support code template is available under the *platform/template*
|
2019-02-07 17:18:49 +08:00
|
|
|
directory. Copying this directory and its content as a new directory named
|
2021-07-08 19:07:29 +08:00
|
|
|
*<xyz>* under the *platform/* directory will create all the files
|
|
|
|
mentioned above.
|