## Foreword
RISC-V is relatively popular recently. Its openness and scalability have opened up people's imagination of customizable processors. Therefore, many semiconductor companies have joined in to test the water, and it has also attracted a large influx of developers. RISC-V related articles have become the new "net red" in the technology world and become the focus of developers. In these articles, the term "toolchain" is often mentioned, but it is rarely introduced. Today we will demystify it.
## I.What is a toolchain **
"Toolchain" is the translation of the English "toolchain", which refers to a series of tools that assist developers in completing program development, debugging, performance analysis and tuning and other development and optimization behaviors.
**
It generally includes basic tools such as compiler, assembler, linker, debugger, simulator, etc. The integrated development environment can also be included as a graphical comprehensive development tool. Because of the different instruction sets and user programming models, each architecture requires a complete and unique tool chain.
## II.Importance of toolchains
Some people may ask, since it is an auxiliary tool, it is not so important to be a non-essential item. This sentence is half right and half wrong. In the early days of computer development, there was almost no tool chain. Scientists expressed the encoding of different instructions by punching holes in the program card, and the computer read the punch information of the program card to execute the instruction stream. With the development of manufacturing technology and computers, the instruction codes of modern computers are stored in ROM, RAM, Flash and other media. Downloading the instruction codes to the specified storage space requires complicated control procedures, so it is necessary to use a program downloader. to complete the download. In order to improve the efficiency of program development, many high-level development languages have emerged. At present, more than 99% of developers use high-level languages to complete business development, and then use compilers to translate high-level languages into target machine instructions and download them to the machine for execution. Therefore the compiler becomes an essential component in the tool chain. Also, what if the program has bugs? A debugging system is needed to assist developers to find the cause of the program running error; what should I do if the program performance is not enough? A performance analyzer is required to assist developers in performance tuning. Therefore,**For modern computer systems, a stable and complete development tool chain is the foundation of an architectural foundation, and all software operations depend on the tool chain; without the tool chain, the CPU and hardware cannot be used, and developers cannot do anything.**

The above is to explain the importance of the tool chain from the perspective of functional completeness. Later, through the introduction of the key indicators of the tool chain, it is explained in principle that the tool chain is no longer a simple auxiliary tool, it is a key path that affects all aspects of the target architecture.**The key indicators of the tool chain can be divided into two aspects: efficiency and ease of use. Efficiency also includes compilation efficiency, debugging efficiency, performance analysis efficiency, etc. Among them, the efficiency of compilation is particularly important.**As described above, a compiler is a software used to translate a high-level language into target machine instructions; a high-level language will be translated into several machine instructions. Under the premise of ensuring correct functions, the number of machine instructions translated by the compiler and Quality is also very critical, directly affecting the time it takes for the program to run and the program footprint, that is, the performance and code density of the processor. Therefore, the processor performance is the comprehensive ability of the hardware + tool chain, and it is meaningless to compare the hardware frequency indicators alone. In addition, the efficiency of debugging directly affects the efficiency of developers in analyzing and solving problems, and also determines whether the processor can be accepted by developers and whether it can be widely used.
## III.The State of the RISC-V Toolchain
Since the tool chain is so important, what is the current status of the RISC-V tool chain and can it meet the current application needs? Due to the open nature of RISC-V and the continuous operation of the software ecosystem by the Foundation, a large number of developers have been attracted to supplement and improve the tool chain.**At present, from the compilation tools (GCC+LLVM), debugging tools to the integrated development environment, the basic functions have been supported, but the efficiency and ease of use still need to be strengthened and improved.**For example, there are still many gaps in the size of the compiled program code compared to ARM; lack of performance tuning tools; lack of graphical real-time operating system debugging tools; open source integrated development environments only support simple debugging plug-ins, etc. All these aspects require tool chain development The developers are constantly improving, and are verified and polished through application scenarios.
## IV.Jianchi series tool chain
**Based on the open source tool chain, the Jianchi series tool chain is a collection of development tools that are highly optimized according to the application scenario and the micro-architecture of the Xuantie processor (see figure).**With the Xuantie Turbo instruction set, the performance of the XT906 is improved by an average of 13% compared to the open source version, and the performance of the XT910 is improved by an average of 20%. Developed a performance analysis tool based on instruction Trace, with the graphical interface of the integrated development environment, to provide developers with the ability to quickly performance profiling and optimization. In addition, two sets of integrated development environments have been developed, respectively for MCU application development and general application development, to reduce the difficulty of migrating existing projects to RISC-V architecture chips. Each tool of the Jianchi series toolchain will be introduced in detail in subsequent articles.

## V.Summary
The toolchain is an important and integral part of an architecture, and it is the foundation of the underlying software. After several years of development, the RISC-V tool chain has been gradually improved in function; I believe that in the next few years, with the joint efforts of developers in the open source community and commercial companies, there will be more efficiency and ease of use in compilation and debugging. Significant improvement, RISC-V chips will also be accepted by more developers and applied to various scenarios.
--- 