This is the ARC C and C++ cross-compiler, based on the RISC-V scripts. It supports two build modes: a generic ELF/Newlib toolchain.
git clone https://github.com/foss-for-synopsys-dwc-arc-processors/arc-gnu-toolchainThis repository checks for the existance of the following directories:
binutils-gdb
gcc
newlib
glibcIf they do not exist, it will clone them.
The arc-gnu-toolchain also provides the capability to build the toolchain using source code located outside of the main repository. There are specific configuration options available to define the source directory for each component or for a parent directory.
As an example, if you have an external GCC source, you can use the --with-gcc-src option to specify it:
./configure --with-gcc-src=/path/to/gccSimilarly, if you have an external parent directory that encompasses all the sources, you can use the --with-src option to inicate its location:
./configure --with-src=/path/to/parentFor a 64-bit linux build, you will need the following branches:
| repo | branch |
|---|---|
| binutils-gdb | arc64 |
| gcc | arc64 |
| newlib | arc64 |
| glibc | arc64 |
For a 64-bit baremetal build, you don't need the glibc.
Last but not least, if you plan to run DejaGnu later, you must use:
| repo | branch |
|---|---|
| toolchain | arc-dev |
Several standard packages are needed to build the toolchain. On Ubuntu, executing the following command should suffice:
sudo apt-get install -y --no-install-recommends \
autoconf \
automake \
autotools-dev \
curl \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
libexpat1-dev \
gawk \
build-essential \
libncurses-dev \
bison \
flex \
texinfo \
gperf \
libtool \
patchutils \
bc \
zlib1g-devOn Fedora/CentOS/RHEL OS, executing the following command should suffice:
sudo yum install autoconf automake libmpc-devel mpfr-devel gmp-devel gawk ncurses-devel bison flex texinfo patchutils gcc gcc-c++ zlib-develOn OS X, you can use Homebrew to install the dependencies:
brew install gawk gnu-sed gmp mpfr libmpc isl zlibOn Void Linux, at least these packages are required:
xbps-install libmpc-devel ncurses-devel texinfo bison flexThis process will start by downloading about 200 MiB of upstream sources, then will patch, build, and install the toolchain. If a local cache of the upstream sources exists in $(DISTDIR), it will be used; the default location is /var/cache/distfiles. Your computer will need about 8 GiB of disk space to complete the process.
You can (re)generate the configure script with:
cd arc-gnu-toolchain
autoconfConfigure and build with:
cd arc-gnu-toolchain
./configure --prefix=/path/to/install/toolchain
make -j $(nproc)
make installSome of parameters you can pass to the configure script:
| parameter | default | values |
|---|---|---|
| --target | arc64, arc32, arc | |
| --prefix | any path string for installation | |
| --enable-linux | no | yes, no (--disable-linux) |
| --enable-multilib | no | yes, no (--disable-multilib) |
| --enable-qemu | no | yes, no (--disable-qemu) |
| --enable-debug-info | no | yes, no (--disable-debug-info) |
| --with-fpu | none | none, fpus, fpud |
| --with-cpu | none | none, hs6x, hs68, hs5x, hs58, archs, (more at binutils/include/elf/arc-cpu.def) |
| --with-sim | qemu | qemu, nsim |
| --with-src | arc-gnu-toolchain | /path/to/parent |
| --with-binutils-src | ./binutils-gdb | /path/to/binutils-gdb |
| --with-newlib-src | ./newlib | /path/to/newlib |
| --with-gcc-src | ./gcc | /path/to/gcc |
| --with-glibc-src | ./glibc | /path/to/glibc |
| --with-linux-src | ./linux | /path/to/linux |
| --with-qemu-src | ./qemu | /path/to/qemu |
There are a number of additional options that may be passed to
configure. See ./configure --help for more details.
$ ./configure --target=arc64 --prefix=/path/to/install$ ./configure --target=arc32 \
--prefix=/path/to/install \
--disable-qemu \
--enable-multilib \
--disable-werror$ ./configure --target=arc64 \
--prefix=/path/to/install \
--enable-linuxAt present, the testing environment comprises four integrated testsuites: gcc/g++, binutils, newlib, and qemu. Testing is possible for both Baremetal Toolchain Distribution and Linux Toolchain Distribution (user-mode), via two simulators, QEMU and nSIM.
During the toolchain compilation process, you can choose the simulator to use for testing. There are two options available: QEMU, an open-source simulator, and nSIM, a proprietary simulator provided by Synopsys. By default, QEMU is the chosen simulator.
- If the selected simulator is QEMU, the testing will clone QEMU’s repository from the official Synopsys QEMU repository and build it by according to the branch specified in the Makefile file. The simulator will be installed based on the prefix path provided during the toolchain distribution’s configuration stage.
$ ./configure --target=... --prefix=/path/to/install --with-sim=qemu- If nSIM is preferred over QEMU, ensure that the simulator is defined in the PATH environment variable before executing the testing.
$ ./configure --target=... --prefix=/path/to/install --with-sim=nsimTo execute toolchain tests, running the command make report will run all the tests in the GCC regression test suite. This command automatically invokes the GCC/G++, Binutils and Newlib testsuites to perform the respective tests. At the end of the execution, a report is generated by a testsuite filter script. This report filters known errors and displays only the unknown ones. Depending on the testsuite tool and CPU used, different filters with JSON format files are utilized. These files can be found in the arc-gnu-toolchain/test/allowlist folder.
To generate the report and perform the testing, use the following command:
$ make report -j$(nproc)Running this command in parallel (e.g., “make report -j32”) will significantly speed up the execution time on multi-processor systems.
By default, DejaGNU runs all tests in its regression test suite. However, executing all these tests can take a significant amount of time, which is impractical for typical development cycles. To address this, DejaGNU provides the option to select specific tests using the environment variable RUNTESTFLAGS.
For instance, if you want to run only the tests related to tls, you can use the following command:
RUNTESTFLAGS="tls.exp" make reportLikewise, if you wish to run a specific test, such as thread_local-order2.C within the tls tests, you can use the following command:
RUNTESTFLAGS="tls.exp=thread_local-order2.C" make reportThese commands allow you to focus on specific test cases and streamline the execution time accordingly.
Alternatevely to the report command, in order to only execute all the associated test suite with the toolchain distribution, execute the following command:
$ make check -j $(nproc)Refer to the table below to determine the suitable command for running an individual testsuite based on the current toolchain distribution.
| Toolchain Distribution | Test Suite | Command |
|---|---|---|
| Baremetal | gcc | $ make check-gcc-baremetal |
| Baremetal | binutils | $ make check-binutils-baremetal |
| Baremetal | newlib | $ make check-newlib-baremetal |
| Baremetal | qemu | $ make check-qemu-baremetal |
| Linux | gcc | $ make check-gcc-linux |
| Linux | binutils | $ make check-binutils-linux |