SG2042 GCC toolchain documentation
SG2042 use the T-HEAD GNU compiler toolchain, this document introduces how to build and use this toolchain.
T-HEAD GNU Compiler Toolchain
T-HEAD GNU Compiler Toolchain is a RISC-V vendor toolchain that supports T-head CPUs. It offers vendor extensions series X-Thead, and optimized many special instructions.
You can download the source and build it from Here
A prebuild toolchain can be downloaded from Here
1. How to Build
1.1 Download the source for github
$ git clone https://github.com/T-head-Semi/xuantie-gnu-toolchain
Notes: the source files will take around 6.65 GB of disk and download size.
1.2 Install prerequisites
Several standard packages are needed to build the toolchain, so we need to prepare the build environment before build.
- On Ubuntu
$ apt-get install -y make diffutils autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev
- On On Fedora/CentOS/RHEL OS
$ dnf install -y make diffutils autoconf automake python3 libmpc-devel mpfr-devel gmp-devel gawk bison flex texinfo patchutils gcc gcc-c++ zlib-devel expat-devel