riscv-tools [![Build Status](https://travis-ci.org/riscv/riscv-tools.svg?branch=master)](https://travis-ci.org/riscv/riscv-tools)
===========================================================================
This repo provides guides and references:
1. [Quickstart](#quickstart)
2. [The RISC-V GCC/Newlib Toolchain Installation Manual](#newlibman)
3. [The Linux/RISC-V Installation Manual](#linuxman)
4. [References](#references)
# <a name="quickstart"></a>Quickstart
$ git submodule update --init --recursive
$ export RISCV=/path/to/install/riscv/toolchain
$ ./build.sh
Ubuntu packages needed:
$ sudo apt-get install autoconf automake autotools-dev curl device-tree-compiler libmpc-dev libmpfr-dev libgmp-dev libusb-1.0-0-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev device-tree-compiler pkg-config
Fedora packages needed:
$ sudo dnf install autoconf automake @development-tools curl dtc libmpc-devel mpfr-devel gmp-devel gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib-devel
_Note:_ This requires a compiler with C++11 support (e.g. GCC >= 4.8).
To use a compiler different than the default, use:
$ CC=gcc-5 CXX=g++-5 ./build.sh
_Note for OS X:_ We recommend using [Homebrew](https://brew.sh) to install the dependencies (`dtc gawk gnu-sed gmp mpfr libmpc isl wget automake md5sha1sum`) or even to install the tools [directly](https://github.com/riscv/homebrew-riscv). This repo will build with Apple's command-line developer tools (clang) in addition to gcc.
# <a name="newlibman"></a>The RISC-V GCC/Newlib Toolchain Installation Manual
This document was authored by [Quan Nguyen](https://ocf.berkeley.edu/~qmn) and is a mirrored version (with slight modifications) of the one found at [Quan's OCF
website](https://ocf.berkeley.edu/~qmn/linux/install-newlib.html). Recent updates were made by Sagar Karandikar.
Last updated August 6, 2014
## Introduction
The purpose of this page is to document a procedure through
which an interested user can build the RISC-V GCC/Newlib toolchain.
A project with a duration such as this requires adequate
documentation to support future development and maintenance. This document is
created with the hope of being useful; however, its accuracy is not
guaranteed.
This work was completed at Andrew and Yunsup's request.
## Table of Contents
1. Introduction
2. Table of Contents
3. [Meta-installation Notes](#meta-installation-notes)
4. [Installing the Toolchain](#installing-toolchain)
5. [Testing Your Toolchain](#testing-toolchain)
6. ["Help! It doesn't work!"](#help-it-doesnt-work)
## <a name="meta-installation-notes"></a>Meta-installation Notes
You may notice this document strikes you as similar to its
bigger sibling, the <a href="#linuxman">
Linux/RISC-V Installation Manual</a>. That's because the instructions are rather
similar. That said...
### Running Shell Commands
Instructive text will appear as this paragraph does. Any
instruction to execute in your terminal will look like this:
$ echo "execute this"
_Optional_ shell commands that may be required for
your particular system will have their prompt preceeded with an O:
O$ echo "call this, maybe"
If you will need to replace a bit of code that applies
specifically to your situation, it will be surrounded by [square brackets].
### The Standard Build Unit
To instruct how long it will take someone to build the
various components of the packages on this page, I have provided build times in
terms of the Standard Build Unit (SBU), as coined by Gerard Beekmans in his
immensely useful [Linux From Scratch](http://www.linuxfromscratch.org)
website.
On an Intel Xeon Dual Quad-core server with 48 GiB RAM, I
achieved the following build time for `binutils`: 38.64 seconds.
Thus, **38.64 seconds = 1 SBU**. (EECS members at the University
of California, Berkeley: I used the `s141.millennium` server.)
As a point of reference, my 2007 MacBook with an Intel Core 2
Duo and 1 GiB RAM has 100.1 seconds to each SBU. Building
`riscv64-unknown-linux-gnu-gcc`, unsurprisingly, took about an hour.
Items marked as "optional" are not measured.
### Having Superuser Permissions
You will need root privileges to install
the tools to directories like `/usr/bin`, but you may optionally
specify a different installation directory. Otherwise, superuser privileges are
not necessary.
### GCC Version
Note: Building `riscv-tools` requires GCC >= 4.8 for C++11 support (including thread_local). To use a compiler different than the default (for example on OS X), you'll need to do the following when the guide requires you to run `build.sh`:
$ CC=gcc-4.8 CXX=g++-4.8 ./build.sh
## <a name="installing-toolchain"></a>Installing the Toolchain
Let's start with the directory in which we will install our
tools. Find a nice, big expanse of hard drive space, and let's call that
`$TOP`. Change to the directory you want to install in, and then set
the `$TOP` environment variable accordingly:
$ export TOP=$(pwd)
For the sake of example, my `$TOP` directory is on
`s141.millennium`, at `/scratch/quannguyen/noob`, named so
because I believe even a newbie at the command prompt should be able to complete
this tutorial. Here's to you, n00bs!
### Tour of the Sources
If we are starting from a relatively fresh install of
GNU/Linux, it will be necessary to install the RISC-V toolchain. The toolchain
consists of the following components:
* `riscv-gnu-toolchain`, a RISC-V cross-compiler
* `riscv-fesvr`, a "front-end" server that
services calls between the host and target processors on the Host-Target
InterFace (HTIF) (it also provides a virtualized console and disk device)
* `riscv-isa-sim`, the ISA simulator and
"golden standard" of execution
* `riscv-opcodes`, the enumeration of all
RISC-V opcodes executable by the simulator
* `riscv-pk`, a proxy kernel that services
system calls generated by code built and linked with the RISC-V Newlib port
(this does not apply to Linux, as _it_ handles the system calls)
* `riscv-tests`, a set of assembly tests
and benchmarks
In the installation guide for Linux builds, we built only the
simulator and the front-end server. Binaries built against Newlib with
`riscv-gnu-toolchain` will not have the luxury of being run on a full-blown
operating system, but they will still demand to have access to some crucial
system calls.
### What's Newlib?
[Newlib](https://www.sourceware.org/newlib/) is a
"C library intended for use on embedded systems." It has the advantage of not
having so much cruft as Glibc at the obvious cost of incomplete support (and
idiosyncratic behavior) in the fringes. The porting process is much less complex
than that of Glibc because you only have to fill in a few stubs of glue
code.
These stubs of code include the system calls that are
supposed to call into the operating system you're running on. Because there's no
operating system proper, the simulator runs, on top of it, a proxy kernel
(`riscv-pk`) to handle many system calls, like `open`,
`close`, and `printf`.
### Obtaining and Compiling the Sources (7.87 SBU)
First, clone the tools from the `riscv-tools` GitHub
repository:
$ git clone https://github.com/riscv/riscv-tools.git
This command will bring in only references to the
repositories that we will need. We rely on Git's submodule system to take care
of resolving the references. Enter the newly-created riscv-tools directory and
instruct Git to update its submodules.
$ cd $TOP/riscv-tools
$ git submodule update --init --recursive
To build GCC, we will need several other packages, including
flex, bison, autotools, libmpc, libmpfr, and libgmp. Ubuntu distribution
installations will require this command to be run. If you have not installed
these things yet, then run this:
O$ sudo apt-get install autoconf automake autotools-dev curl device-tree-compiler libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev
没有合适的资源?快使用搜索试试~ 我知道了~
基于RISC-V架构的FPGA系统设计.zip
共1497个文件
scala:551个
c:294个
h:227个
需积分: 1 0 下载量 80 浏览量
2024-10-07
23:18:40
上传
评论
收藏 8.89MB ZIP 举报
温馨提示
项目学习分享。【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。 【技术】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes
资源推荐
资源详情
资源评论
收起资源包目录
基于RISC-V架构的FPGA系统设计.zip (1497个子文件)
configure.ac 4KB
machine.ac 426B
bbl.ac 426B
pk.ac 195B
softfloat.ac 0B
dummy_payload.ac 0B
driver.ac 0B
util.ac 0B
SampleAnnotations.anno 995B
authors 2KB
authors 2KB
LICENSE.Berkeley 1KB
LICENSE.Berkeley 1KB
LICENSE.Berkeley 1KB
ff.c 166KB
tester.c 49KB
minion_helper.c 37KB
strxfrm_l.c 18KB
selftest.c 16KB
stratcliff.c 14KB
string-inlines.c 12KB
fp_emulation.c 11KB
test-strncmp.c 11KB
test-memcmp.c 11KB
jtag_vpi.c 11KB
jtag_vpi.c 11KB
strcoll_l.c 10KB
diskio.c 10KB
test-strcmp.c 10KB
wordcopy.c 10KB
syscalls.c 10KB
mmap.c 10KB
syscall.c 10KB
memcmp.c 9KB
test-strncasecmp.c 9KB
test-strncpy.c 8KB
test-strncat.c 8KB
test-strchr.c 7KB
test-strcat.c 7KB
test-strcasecmp.c 6KB
mtrap.c 6KB
test-memmove.c 6KB
test-memccpy.c 6KB
tst-cmp.c 6KB
test-strpbrk.c 6KB
test-strcpy.c 6KB
test-strrchr.c 6KB
memrchr.c 6KB
strchr.c 6KB
strchrnul.c 6KB
test-memcpy.c 6KB
s_mulAddF64.c 6KB
rawmemchr.c 6KB
test-memset.c 6KB
memchr.c 5KB
emulation.c 5KB
test-strspn.c 5KB
sdhci-minion-hash-md5.c 5KB
strnlen.c 5KB
mini-printf.c 5KB
elf.c 5KB
test-strstr.c 5KB
test-memmem.c 5KB
envz.c 5KB
s_mulAddF32.c 5KB
pk.c 5KB
test-strnlen.c 5KB
test-strcasestr.c 5KB
test-memchr.c 4KB
test-memrchr.c 4KB
test-rawmemchr.c 4KB
tst-endian.c 4KB
test-strlen.c 4KB
argz-replace.c 4KB
memmove.c 3KB
strcasestr.c 3KB
strlen.c 3KB
file.c 3KB
f32_rem.c 3KB
strstr.c 3KB
strsignal.c 3KB
strverscmp.c 3KB
minit.c 3KB
memmem.c 3KB
f64_rem.c 3KB
testcopy.c 3KB
f64_div.c 3KB
handlers.c 3KB
bbl.c 3KB
uart.c 2KB
_strerror.c 2KB
bug-strcoll2.c 2KB
softfloat_raiseFlags.c 2KB
softfloat_raiseFlags.c 2KB
f64_roundToInt.c 2KB
f32_div.c 2KB
elf.c 2KB
f64_mul.c 2KB
memset.c 2KB
f32_roundToInt.c 2KB
共 1497 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
资源评论
嵌入式大圣
- 粉丝: 2855
- 资源: 728
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 学之思开源考试系统是一款java+vue的前后端分离的考试系统 主要优点是开发、部署简单快捷、界面设计友好、代码结构清晰 支持web端和微信小程序,能覆盖到pc机和手机等设备 支持多种部署方式
- PHP旅游智能CRM系统源码数据库 MySQL源码类型 WebForm
- 大数据1+x(蓝桥课堂实操231216)解析
- 基于STM32F103C8T6的双轮平衡小车项目源码(代码注释全面适合小白)
- 金杰.m4a..mp3
- PHP出租屋租赁系统源码带小程序数据库 MySQL源码类型 WebForm
- Matlab实例:频谱、功率谱和功率谱密度计算作业
- 企业级免费开源商城系统,可视化DIY拖拽装修、包含PC、H5、多端小程序(微信+支付宝+百度+头条&抖音+QQ+快手)、APP、多仓库、多商户、多门店、IM客服、进销存,遵循MIT开源协议发布
- 毕业设计基于STM32F103C8T6的智能宠物屋系统源码+文档说明+原理图
- windows上OpenSSH服务安装及启动
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功