![Page 1: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/1.jpg)
Open Source Compiler Tool Chains and Operating Systems for RISC-V
Jeremy BennettMark Corbin
Copyright © 2019 Embecosm.Freely available under a Creative Commons license.
![Page 2: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/2.jpg)
Agenda● Open source compilers: Jeremy Bennett
– what is available?– how good are they?
![Page 3: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/3.jpg)
Agenda● Open source compilers: Jeremy Bennett
– what is available?– how good are they?
● Open source operating systems: Mark Corbin– what is available?– how good are they?
![Page 4: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/4.jpg)
Agenda● Open source compilers: Jeremy Bennett
– what is available?– how good are they?
● Open source operating systems: Mark Corbin– what is available?– how good are they?
● Questions: Everyone
![Page 5: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/5.jpg)
Compilers Jeremy Bennett
Copyright © 2019 Embecosm.Freely available under a Creative Commons license.
![Page 6: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/6.jpg)
GCC
Tool Chain Components (GNU)
CGEN
Sourcecode
GAS
binutils
Objectcode
GDB
objdump
disassemble
target sim
AdaC/C++
FortranOpenMP
GDB
libc/libmcompilerlibraries
NewlibGlibcMusl
libgcclibstdc++v3
RV32GCRV64GC
![Page 7: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/7.jpg)
GCC
Tool Chain Components (GNU)
CGEN
Sourcecode
GAS
binutils
Objectcode
GDB
objdump
disassemble
target sim
AdaC/C++
FortranOpenMP
GDB
libc/libmcompilerlibraries
NewlibGlibcMusl
libgcclibstdc++v3
CompleteIn progressNot available
RV32GCRV64GC
![Page 8: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/8.jpg)
Clang/LLVM
Tool Chain Components (Clang/LLVM)
TableGen
Sourcecode
LLVMint. asm
binutils
Objectcode
GDB
llvm-objdump
disassemble
AdaC/C++
FortranOpenMP
LLDB
libc/libmcompilerlibraries
NewlibBSD libc
Musl
CompilerRTlibc++
RV32GCRV64GC
![Page 9: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/9.jpg)
Clang/LLVM
Tool Chain Components (Clang/LLVM)
TableGen
Sourcecode
LLVMint. asm
binutils
Objectcode
GDB
llvm-objdump
disassemble
AdaC/C++
FortranOpenMP
LLDB
libc/libmcompilerlibraries
NewlibBSD libc
Musl
CompilerRTlibc++
CompleteIn progressNot available
RV32GCRV64GC
![Page 10: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/10.jpg)
Compiler
Tool Chain Components (Plan 9)
Sourcecode
Assembler linkerObjectcode
GDB
C99
disasm
libc/libmcompilerlibraries
libc
emulation
RV32IMA
![Page 11: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/11.jpg)
Compiler
Tool Chain Components (Plan 9)
Sourcecode
Assembler linkerObjectcode
GDB
C99
disasm
libc/libmcompilerlibraries
libc
emulation
CompleteIn progressNot available
RV32IMA
https://www.geeklan.co.uk/files/oshug69-Miller-criscv.pdf
![Page 12: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/12.jpg)
Compiler
Tool Chain Components (Plan 9)
Sourcecode
Assembler linkerObjectcode
GDB
C99
disasm
libc/libmcompilerlibraries
libc
emulation
CompleteIn progressNot available
RV32IMA
https://www.geeklan.co.uk/files/oshug69-Miller-criscv.pdf
Glenda
![Page 13: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/13.jpg)
GCC Quality (C/C++)32-bit RISC-V 64-bit RISC-V
LIT Expected passes - -
Expected failures - -
Unsupported tests - -
Unexpected failures - -
GNU Expected passes 92,378 93,458
Unexpected failures 32 33
Unexpected successes 2 3
Expected failures 209 210
Unresolved tests - -
Unsupported tests 2,468 2,222
![Page 14: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/14.jpg)
Clang/LLVM Quality (C/C++)32-bit RISC-V 64-bit RISC-V
LIT Expected passes 46,135 46,136
Expected failures 171 171
Unsupported tests 427 427
Unexpected failures 8 8
GNU Expected passes
Unexpected failures
Unexpected successes
Expected failures
Unresolved tests
Unsupported tests
![Page 15: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/15.jpg)
Clang/LLVM Quality (C/C++)32-bit RISC-V 64-bit RISC-V
LIT Expected passes 46,135 46,136
Expected failures 171 171
Unsupported tests 427 427
Unexpected failures 8 8
GNU Expected passes 28,579 28,568
Unexpected failures 4,863 4,949
Unexpected successes 4 4
Expected failures 51 57
Unresolved tests 1,851 1,861
Unsupported tests 3,737 3,700
![Page 16: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/16.jpg)
Compiled Code Speed (RV32)
GCC BaselineLLVM
GCC EABI (old)GCC LTO
GCC new size opts
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Embench Score
Large is goodLarge is good
![Page 17: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/17.jpg)
Compiled Code Size (RV32)
GCC Baseline
LLVM
GCC EABI (old)
LLVM EABI (new)
GCC LTO
LLVM save-restore
GCC new size opts
GCC comb. elim.
ARM GCC
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Embench Score
Small is goodSmall is good
![Page 18: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/18.jpg)
Operating Systems Mark Corbin
Copyright © 2019 Embecosm.Freely available under a Creative Commons license.
![Page 19: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/19.jpg)
Debian● Upstream 64-bit support as a ‘ports architecture’● Platforms - QEMU. HiFive Unleashed and LowRISC (with custom kernels).● 88% of the Debian package archive builds for RISC-V
– https://buildd.debian.org/stats/● On-going work – change boot flow from BBL U-Boot/OpenSBI→
● Future plans – proper Debian Installer support, work towards 100% archive coverage (requires LLVM and Rust support), look at RV32 support
● Further details - https://wiki.debian.org/RISC-V
Information kindly provided by Karsten Merker and Manuel A. Fernandez Montecelo
![Page 20: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/20.jpg)
Fedora● Upstream 64-bit support as a ‘alternative architecture’ (no 32-bit
support planned)● Platforms - QEMU and HiFive Unleashed● Bootloader flow still in development – BBL U-Boot/OpenSBI→
● Boots to graphical desktop - https://abopen.com/news/building-a-risc-v-pc/
● Further details - https://fedoraproject.org/wiki/Architectures/RISC-V
Information kindly provided by Richard W.M. Jones
![Page 21: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/21.jpg)
Gentoo● Upstream experimental 64-bit support● Platforms - QEMU userspace only – no bootable systems yet● Default ‘system set’ is complete● Outstanding tasks – test more packages, automate build
and update of installation stages/media● Further details - https://wiki.gentoo.org/wiki/Project:RISC-V
Information kindly provided byAndreas K. Huettel
![Page 22: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/22.jpg)
openSUSE● Upstream experimental 64-bit support● Platforms - QEMU userspace only● Build of openSUSE Factory, but missing some packages including
LLVM and Rust.● Outstanding tasks – add grub support to standardise the
installation and boot process● Further details - https://en.opensuse.org/openSUSE:RISC-V
Information kindly provided byAndreas Schwab
![Page 23: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/23.jpg)
FreeBSD● Upstream 64-bit support● Platforms - QEMU and HiFive Unleashed● HiFive Unleashed
– Ethernet and SMP– No SD card support yet (ramdisk or NFS root)– See https://www.youtube.com/watch?v=nZsBp0Gbg_8
● Future plans - TODO list on Wiki page?● Further details - https://wiki.freebsd.org/riscv
HiFive Unleashed details from mailing list post byRuslan Bukin
![Page 24: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/24.jpg)
NetBSD● 64-bit support (not upstream)● Platforms – Spike (not fully booting)● Future plans – bootable system, userland, QEMU and
HiFive Unleashed support● Further details - http://wiki.netbsd.org/ports/riscv/
Information kindly provided byZachary McGrew and Maxime Villard
![Page 25: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/25.jpg)
Buildroot● Upstream 32-bit and 64-bit support● Platforms
– QEMU– Coming soon … HiFive Unleashed (patches submitted)
● Most packages build - http://autobuild.buildroot.net/● On-going work – maintain and remove forks● Future plans – musl/uclibc support, additional board support, migrate to U-
Boot/OpenSBI● Further details - https://buildroot.org/
![Page 26: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/26.jpg)
OpenEmbedded/Yocto● Upstream 32-bit and 64-bit support in OE-Core layer● RISC-V Meta Layer - https://github.com/riscv/meta-riscv/● Platforms - QEMU and HiFive Unleashed● All standard packages work for 64-bit (and most work on 32-bit)● Future plans – maintain and remove forks, add qemuriscv32/64 machines
to OE-Core● Further details -
https://layers.openembedded.org/layerindex/branch/master/layer/meta-riscv/
Information kindly provided byAlistair Francis
![Page 27: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/27.jpg)
OpenWrt● Upstream 64-bit support (in staging tree)● Platforms - QEMU and HiFive Unleashed● Supports musl (default C library for OpenWrt)● Builds 99% of the OpenWrt package repo● Further details -
https://openwrt.org/docs/techref/hardware/soc/soc.sifive
Information kindly provided byAlex Guo and Zoltan Herpai
![Page 28: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/28.jpg)
Apache MyNewt● Platforms - HiFive1● Further details - https://mynewt.apache.org/
![Page 29: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/29.jpg)
FreeRTOS● Upstream 32-bit and 64-bit support● Platforms – QEMU (sifive_e), Microsemi M2GL025 Mi-V and OpenISA Vega
Board● Future plans
– will be adding support for IAR compilers– new features driven by user requests
● Maybe …floating point? ...memory protection? …?
● Further details - https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html
Information kindly provided byRichard Barry
![Page 30: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/30.jpg)
Zephyr● Upstream 32-bit support● Platforms
– QEMU (sifive_e), HiFive1, Microsemi M2GL025 Mi-V and OpenISA Vega Board
– Coming soon...HiFive1 Rev B and LiteX VexRiscv● Future plans – SMP support, RV64 support, memory protection.● Further details - https://www.zephyrproject.org/
Information kindly provided byNathaniel Graff
![Page 31: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/31.jpg)
Plan 9● Plan 9 C compiler has been re-targeted for RV32 (see
https://www.geeklan.co.uk/files/oshug69-Miller-criscv.pdf)● Compiler has been tested with a small subset of libc on a
bare metal picoRV32 core● Work not started on kernel
Information kindly provided byRichard Miller
![Page 32: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/32.jpg)
Summary● Common Issues
– Waiting for mainline kernel to catch-up for HiFive Unleashed support– Need upstream 32-bit glibc for 32-bit Linux support– LLVM/Rust support needed for a number of package builds– Bootloader flow changing from BBL U-Boot/OpenSBI→
– Broader range of (low cost) development platforms needed (especially Linux-capable 32-bit platform).
● Please let me have any changes or comments for updating:– https://github.com/riscv/riscv-wiki/wiki/RISC-V-Software-Status
![Page 33: Open Source Compiler Tool Chains Jeremy Bennett and ......Jun 09, 2019 · Open source compilers: Jeremy Bennett ... libraries Newlib Glibc Musl libgcc libstdc++v3 RV32GC RV64GC](https://reader033.vdocuments.site/reader033/viewer/2022051906/5ff971dcdd6d1e58a7262260/html5/thumbnails/33.jpg)
Thank You
Copyright © 2019 Embecosm.Freely available under a Creative Commons license.