All Projects → kendryte → kendryte-gnu-toolchain

kendryte / kendryte-gnu-toolchain

Licence: other
Kendryte GNU Toolchain

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects
Batchfile
5799 projects
objective c
16641 projects - #2 most used programming language
C++
36643 projects - #6 most used programming language
M4
1887 projects
shell
77523 projects

Projects that are alternatives of or similar to kendryte-gnu-toolchain

M5StickVComputer
A pure python operating system on M5StickV
Stars: ✭ 31 (-41.51%)
Mutual labels:  kendryte, k210
kendryte-flash-windows
Kendryte flash utility for Windows
Stars: ✭ 28 (-47.17%)
Mutual labels:  kendryte, k210
kendryte-doc-standalone-programming-guide
Kendryte k210 standalone programming guide
Stars: ✭ 30 (-43.4%)
Mutual labels:  kendryte, k210
rCore-Tutorial-v3
Let's write an OS which can run on RISC-V in Rust from scratch!
Stars: ✭ 470 (+786.79%)
Mutual labels:  k210
Kboot
K210 bootloader
Stars: ✭ 29 (-45.28%)
Mutual labels:  k210
MicroPython Examples
MicroPython Examples For 01Studio Development Board
Stars: ✭ 86 (+62.26%)
Mutual labels:  k210
face-mask-detection-tf2
A face mask detection using ssd with simplified Mobilenet and RFB or Pelee in Tensorflow 2.1. Training on your own dataset. Can be converted to kmodel and run on the edge device of k210
Stars: ✭ 72 (+35.85%)
Mutual labels:  k210
Maix-LogoClassifier
A simple logo classifier developed using Maixduino framework and PlatfomIO, to run on K210 MCU on Sipeed's Maix dev board.
Stars: ✭ 25 (-52.83%)
Mutual labels:  k210
kendryte-freertos-demo
Demo of kendryte k210 FreeRTOS SDK
Stars: ✭ 60 (+13.21%)
Mutual labels:  k210
xv6-k210
Porting xv6-riscv on k210
Stars: ✭ 18 (-66.04%)
Mutual labels:  k210

Kendryte RISC-V GNU Compiler Toolchain

This is the Kendryte RISC-V C and C++ cross-compiler. It supports two build modes: a generic ELF/Newlib toolchain and a more sophisticated Linux-ELF/glibc toolchain.

Getting the sources

This repository uses submodules. You need the --recursive option to fetch the submodules automatically

$ git clone --recursive https://github.com/kendryte/kendryte-gnu-toolchain

Alternatively :

$ git clone https://github.com/kendryte/kendryte-gnu-toolchain
$ cd kendryte-gnu-toolchain
$ git submodule update --init --recursive

Prerequisites

Several standard packages are needed to build the toolchain. On Ubuntu, executing the following command should suffice:

$ sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev

On Fedora/CentOS/RHEL OS, executing the following command should suffice:

$ sudo yum install autoconf automake libmpc-devel mpfr-devel gmp-devel gawk  bison flex texinfo patchutils gcc gcc-c++ zlib-devel expat-devel

On OS X, you can use Homebrew to install the dependencies:

$ brew install gawk gnu-sed gmp mpfr libmpc isl zlib expat

To build the glibc (Linux) on OS X, you will need to build within a case-sensitive file system. The simplest approach is to create and mount a new disk image with a case sensitive format. Make sure that the mount point does not contain spaces. This is not necessary to build newlib or gcc itself on OS X.

This 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.

Installation (Newlib)

To build the Newlib cross-compiler, pick an install path. If you choose, say, /opt/kendryte-toolchain, then add /opt/kendryte-toolchain/bin to your PATH now. Then, simply run the following command:

./configure --prefix=/opt/kendryte-toolchain --with-cmodel=medany --with-arch=rv64imafc --with-abi=lp64f
make -j8

You should now be able to use riscv64-unknown-elf-gcc and its cousins.

  • Linux

Ensure you have write access to /opt/kendryte-toolchain

./configure --prefix=/opt/kendryte-toolchain --with-cmodel=medany --with-arch=rv64imafc --with-abi=lp64f

make -j8

Static link some libraries:

git clone --recursive https://github.com/kendryte/kendryte-gnu-toolchain
cd kendryte-gnu-toolchain
cd riscv-gcc
./contrib/download_prerequisites
cd ..
./configure --prefix=/opt/kendryte-toolchain --with-cmodel=medany --with-arch=rv64imafc --with-abi=lp64f
make -j8
  • OSX
./configure --prefix=/usr/local/opt/kendryte-toolchain --with-cmodel=medany --with-arch=rv64imafc --with-abi=lp64f
make -j8
  • Windows

Must cross-compile under linux using mingw.

Install mingw.

sudo apt install binutils-mingw-w64 binutils-mingw-w64-i686 binutils-mingw-w64-x86-64 g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 gcc-mingw-w64 gcc-mingw-w64-base gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 libz-mingw-w64-dev mingw-w64-common mingw-w64-i686-dev mingw-w64-x86-64-dev

Hack the zlib.

xz -9 /usr/i686-w64-mingw32/lib/libz.dll.a
xz -9 /usr/i686-w64-mingw32/lib/zlib1.dll

Compile expat-2.2.6

apt install docbook2x

export CC=i686-w64-mingw32-gcc
export CXX=i686-w64-mingw32-g++

./configure --prefix=/usr/i686-w64-mingw32 --host=i686-w64-mingw32 --disable-shared --enable-static LDFLAGS="-static"
make -j16
make install

Compile make-4.2

export CHOST=i686-w64-mingw32
export CC=i686-w64-mingw32-gcc
export CXX=i686-w64-mingw32-g++

./configure --host=i686-w64-mingw32 --prefix=/opt/kendryte-toolchain LDFLAGS="-static"
ln -s glob/glob.h .
make -j16
make install

Compile toolchain

export CHOST=i686-w64-mingw32

git clone --recursive https://github.com/kendryte/kendryte-gnu-toolchain
cd kendryte-gnu-toolchain
cd riscv-gcc
./contrib/download_prerequisites
cd ..
./configure --prefix=/opt/kendryte-toolchain --host=i686-w64-mingw32 --with-host=i686-w64-mingw32 --with-cmodel=medany --with-arch=rv64imafc --with-abi=lp64f LDFLAGS="-static" --without-system-zlib
make -j16

Advanced Options

There are a number of additional options that may be passed to configure. See './configure --help' for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].