Last active
October 31, 2018 14:03
-
-
Save BeMg/7d0b6f8a93ae1b525446b9d438f5334b to your computer and use it in GitHub Desktop.
riscv_toolchain in docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int test(int a[], int b[]) { | |
| asm volatile( | |
| "ld a2, 0(a0)\n\t" | |
| "ld a3, 0(a1)\n\t" | |
| "add16 a2, a2, a3 \n\t" | |
| "sd a2, 0(a0)\n\t" | |
| ); | |
| } | |
| int main() { | |
| int a[1] = {0x1234ffff}; | |
| int b[1] = {0x11112222}; | |
| test(a, b); | |
| printf("%x\n", a[0]); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int test(int a[], int b[]) { | |
| asm volatile( | |
| "ld a2, 0(a0)\n\t" | |
| "ld a3, 0(a1)\n\t" | |
| "add8 a2, a2, a3 \n\t" | |
| "sd a2, 0(a0)\n\t" | |
| ); | |
| } | |
| int main() { | |
| int a[1] = {0x11111178}; | |
| int b[1] = {0x111111f2}; | |
| test(a, b); | |
| printf("%x\n", a[0]); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ubuntu:18.04 | |
| MAINTAINER BeMg | |
| RUN apt-get update && apt-get install -y git autoconf automake autotools-dev curl 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 libexpat-dev && mkdir risc-v | |
| ENV RISCV /risc-v | |
| RUN git clone --recursive https://github.com/riscv/riscv-gnu-toolchain && \ | |
| cd riscv-gnu-toolchain && ./configure --prefix=$RISCV && make -j4 && \ | |
| rm -rf riscv-binutils && git clone https://github.com/BeMg/riscv-bintuils.git riscv-binutils && \ | |
| cd riscv-binutils && ./configure --prefix=$RISCV --target=riscv64-unknown-elf && make -j4 && make install -j4 | |
| RUN git clone https://github.com/riscv/riscv-tools.git | |
| RUN cd riscv-tools && git submodule update --init riscv-pk && git submodule update --init riscv-fesvr && rm -rf riscv-isa-sim && git clone https://github.com/BeMg/riscv-isa-sim.git && \ | |
| ./build-spike-pk.sh && cd / && rm -rf riscv-tools && echo "export PATH=$PATH:/risc-v/bin" >> ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment