Score
0
1 Unstar Star 1 Fork 1

Gitee 极速下载 / OpenSBIC

Clone or download
library_usage.md
Copy Edit Web IDE Raw Normal History
Damien Le Moal   docs: improve library usage document 2019-02-07
OpenSBI Library Usage=====================
Anup Patel   docs: Add library usage guide 2019-01-29
OpenSBI provides two types of static libraries:
Karsten Merker   docs: miscellaneous documentation fixes and updates 2019-05-05
1. *libsbi.a* - A platform-independent generic static library implementing the   interface defined by the SBI specifications. Platform-specific processing
Damien Le Moal   docs: improve library usage document 2019-02-07
   hooks for the execution of this interface must be provided by the firmware or   bootloader linking with this library. This library is installed as
Anup Patel   docs: Add library usage guide 2019-01-29
   *<install_directory>/lib/libsbi.a*
Atish Patra   docs: Update docs as per new static library. 2019-06-18
2. *libsbiutils.a* - A static library that will contain all common code required   by any platform supported in OpenSBI. It will be built by default and included   in libplatsbi.a. This library is installed as   *<install_directory>/lib/libsbiutils.a*.3. *libplatsbi.a* - An example platform-specific static library integrating
Karsten Merker   docs: miscellaneous documentation fixes and updates 2019-05-05
   *libsbi.a* with platform-specific hooks. This library is available only for
Damien Le Moal   docs: improve library usage document 2019-02-07
   the platforms supported by OpenSBI. This library is installed as
Anup Patel   docs: Add library usage guide 2019-01-29
   *<install_directory>/platform/<platform_subdir>/lib/libplatsbi.a*
Damien Le Moal   docs: improve library usage document 2019-02-07
Implementations may choose either *libsbi.a* or *libplatsbi.a* to link with
Karsten Merker   docs: miscellaneous documentation fixes and updates 2019-05-05
their firmware or bootloader. In the case of *libsbi.a*, platform-specifichooks in the form of a *struct sbi_platform* instance need to be provided.
Anup Patel   docs: Add library usage guide 2019-01-29
Karsten Merker   docs: miscellaneous documentation fixes and updates 2019-05-05
The platform-specific example firmwares provided by OpenSBI are not mandatory.An implementation may choose to link the OpenSBI generic static library togetherwith an M-mode firmware or bootloader providing the hardware-specific hooks.Since OpenSBI is a statically linked library, users must ensure that thelicense of these external components is compatible with the OpenSBI license.
Anup Patel   docs: Add library usage guide 2019-01-29
Constraints on OpenSBI usage from external firmware---------------------------------------------------
Damien Le Moal   docs: improve library usage document 2019-02-07
Users have to ensure that an external firmware or bootloader linking against
Karsten Merker   docs: miscellaneous documentation fixes and updates 2019-05-05
OpenSBI static libraries (*libsbi.a* or *libplatsbi.a*) is compiled with the
Damien Le Moal   docs: improve library usage document 2019-02-07
same GCC target options *-mabi*, *-march*, and *-mcmodel*.
Anup Patel   docs: Add library usage guide 2019-01-29
Damien Le Moal   docs: improve library usage document 2019-02-07
There are only two constraints on calling any OpenSBI library function from an
Anup Patel   docs: Add library usage guide 2019-01-29
external M-mode firmware or bootloader:1. The RISC-V *MSCRATCH* CSR must point to a valid OpenSBI scratch space
Karsten Merker   docs: miscellaneous documentation fixes and updates 2019-05-05
   (i.e. a *struct sbi_scratch* instance).2. The RISC-V *SP* register (i.e. the stack pointer) must be set per-HART   pointing to distinct non-overlapping stacks.
Anup Patel   docs: Add library usage guide 2019-01-29
The most important functions from an external firmware or bootloaderperspective are *sbi_init()* and *sbi_trap_handler()*.
Damien Le Moal   docs: improve library usage document 2019-02-07
In addition to the above constraints, the external firmware or bootloader must
Karsten Merker   docs: miscellaneous documentation fixes and updates 2019-05-05
ensure that interrupts are disabled in the *MSTATUS* and *MIE* CSRs when calling
Damien Le Moal   docs: improve library usage document 2019-02-07
the functions *sbi_init()* and *sbi_trap_handler()*.
Anup Patel   docs: Add library usage guide 2019-01-29
Damien Le Moal   docs: improve library usage document 2019-02-07
The *sbi_init()* function should be called by the external firmware orbootloader for each HART that is powered-up at boot-time or in response to aCPU hotplug event.
Anup Patel   docs: Add library usage guide 2019-01-29
Damien Le Moal   docs: improve library usage document 2019-02-07
The *sbi_trap_handler()* function should be called by the external firmware orbootloader to service the following interrupts and traps:
Anup Patel   docs: Add library usage guide 2019-01-29
1. M-mode timer interrupt2. M-mode software interrupt3. Illegal instruction trap4. Misaligned load trap5. Misaligned store trap6. Supervisor ecall trap7. Hypervisor ecall trap**Note:** external firmwares or bootloaders can be more conservative by
Damien Le Moal   docs: improve library usage document 2019-02-07
forwarding all traps and interrupts to *sbi_trap_handler()*.
Abner Chang   docs: Add description of using OPENSBI_EXTERNAL_SBI_TYPES 2020-01-08
Definitions of OpenSBI Data Types for the External Firmware-----------------------------------------------------------OpenSBI can be built as library using external firmware build system such as EDK2code base (The open source of UEFI firmware implementation) and linked with externalfirmware drivers based on the external firmware architecture.**OPENSBI_EXTERNAL_SBI_TYPES** identifier is introduced to *sbi_types.h* for selectingexternal header file during the build preprocess in order to define OpensSBI data typesbased on external firmware data type binding.For example, *bool* is declared as *int* in sbi_types.h. However in EDK2 build system,*bool* is declared as *BOOLEAN* which is defined as *unsigned char* data type.External firmware can define **OPENSBI_EXTERNAL_SBI_TYPES** in CFLAGS and specify it to theheader file maintained in its code tree. However, the external build system has to addressthe additional include directory for the external header file based on its own build system.For example,*-D***OPENSBI_EXTERNAL_SBI_TYPES***=OpensbiTypes.h*Above tells *sbi_types.h* to refer to *OpensbiTypes.h* instead of using original definitions ofdata types.
C
1
https://gitee.com/mirrors/OpenSBI.git
git@gitee.com:mirrors/OpenSBI.git
mirrors
OpenSBI
OpenSBI
master

Search

132457 8cb2edc1 1899542 131848 70c8d3a4 1899542