Common Adjustment
The ultimate goal of this guideline is to help Porting rather than just Migrating software to the RISC-V architecture. Therefore, changes made by developers to the source code of software should be incremental and adaptable.
Ideally, the source code of a software that fully adapted RISC-V architecture should meet the following requirements.
- The source code of the software can be compiled and run properly with the RISC-V architecture as the target platform
- The software remains consistent on features with the original architecture in the RISC-V architecture
- The same source code can be compiled and run without additional modifications when the original supported architecture(s) is set as the target platform.
Tips
Note: When only the first two points are met, we say that the software has been successfully ported to a RISC-V hardware architecture platform.
Project Resturcting
In order to meet the above requirements, the project structure needs to be adapted to support different hardware architectures under the same version of source code before formally starting to modify the source code.
Project restructuring can be divided into the following steps.
- Is Project Ready for Multi Arch: Mainly refers to checking whether the project is ready for multi-arch.
- File Structure Adjustment: It mainly refers to writing the architecture-related parts of the software source code in separate files according to the target architecture.
- Directory Structure Adjustment: Mainly means to store the architecture-related parts of the software source code in different folders according to the target architecture.
- Testcase adjustment: Mainly refers to modifying or masking the architecture-related testcases in the software source code according to the specific situation.