RISC-V/V003/ch32v003/clang.mk
2024-05-07 11:46:49 +02:00

23 lines
702 B
Makefile

# Use clang / llvm toolchain
# Zatím není podporováno - problém :
# E: RV32I subset, only 16 general-purpose registers supported
# v clang není korektně implementováno.
#
CC = clang
CXX = clang++
LD = ld.lld
#LD = riscv64-unknown-elf-gcc
SIZE = llvm-size
DUMP = riscv64-unknown-elf-objdump
COPY = riscv64-unknown-elf-objcopy
OBJS += startup.o system.o
CCPU = -march=rv32ec -mabi=ilp32e
MCPU = $(CCPU)
TRIP = riscv32-unknown-none-elf
CFLAGS+= -Oz -flto
#CFLAGS+= -fconstexpr-steps=2097152
CFLAGS+= --target=$(TRIP) -mllvm -mattr=+c,+e -mno-relax
LFLAGS+= --Map=$(@:%.elf=%.map) --gc-sections -mllvm -mattr=+c
LFLAGS+= -lto-O3 -nostdlib
LDLIBS+= -L./$(TARGET) -T generated_ch32v003.ld