This is a port of compiler-rt to embedded devices. The objective of this repository is using compiler-rt as the built-in function implementation for embedded devices. Compared with other implementations, compiler-rt is more portable across architectures because it is written in pure C.
LLVM’s official build system assumes the target supports integer multiplication and atomic operations. Without these, building compiler-rt will fail. This project is a port of compiler-rt designed for targets that lack support for integer multiplication and atomic operations. When using this port, note that compiler-rt’s atomic intrinsics have been removed. Whether atomic operations function correctly will therefore depend on your C library and your application.
See compiler-rt source repo for the original source code. All source files are copied from this repository, except for src/mulsi3.c.
Building
Simply build this project with make. It is strongly recommended to build this project with clang, i.e. CC=clang make.
You can optionally provide a toolchain file to specify build target and options, with make TOOLCHAIN_FILE=/path/to/toochain/file. Toolchain files in Sonnet SKD are also applicable here. If you build without a toolchain file or setting CC, CFLAGS or AR, it will build for RV32I by default. This is an example toolchain file:
CC := clang
AR := llvm-ar
CFLAGS += --target=riscv32-unknown-elf -mabi=ilp32 -march=rv32im -ffreestanding -nostdlib -O3 -g
compiler-rtPort for Embedded DevicesThis is a port of
compiler-rtto embedded devices. The objective of this repository is usingcompiler-rtas the built-in function implementation for embedded devices. Compared with other implementations,compiler-rtis more portable across architectures because it is written in pure C.LLVM’s official build system assumes the target supports integer multiplication and atomic operations. Without these, building compiler-rt will fail. This project is a port of compiler-rt designed for targets that lack support for integer multiplication and atomic operations. When using this port, note that compiler-rt’s atomic intrinsics have been removed. Whether atomic operations function correctly will therefore depend on your C library and your application.
See compiler-rt source repo for the original source code. All source files are copied from this repository, except for
src/mulsi3.c.Building
Simply build this project with
make. It is strongly recommended to build this project with clang, i.e.CC=clang make.You can optionally provide a toolchain file to specify build target and options, with
make TOOLCHAIN_FILE=/path/to/toochain/file. Toolchain files in Sonnet SKD are also applicable here. If you build without a toolchain file or settingCC,CFLAGSorAR, it will build for RV32I by default. This is an example toolchain file: