RISC-V/V203/usb/cdc/ch32v203/clang.mk
2024-10-13 15:29:09 +02:00

25 lines
699 B
Makefile

# Use clang / llvm toolchain
#
CC = clang
CXX = clang++
LD = ld.lld
SIZE = llvm-size
DUMP = riscv64-unknown-elf-objdump
COPY = riscv64-unknown-elf-objcopy
OBJS += startup.o system.o
CCPU = -march=rv32imac -mabi=ilp32
MCPU = $(CCPU)
TRIP = riscv32-unknown-none-elf
CFLAGS+= -Oz
CFLAGS+= -flto
CFLAGS+= -fmessage-length=0 -fsigned-char -I/usr/include/newlib
#CFLAGS+= -fconstexpr-steps=2097152
CFLAGS+= --target=$(TRIP) $(MCPU)
LFLAGS+= --Map=$(@:%.elf=%.map) --gc-sections
# 16-bit instrukce se do toho asi dostanou až na úrovni LLVM linkeru.
# Bohužel to není nikde pořádně popsáno.
LFLAGS+= -mllvm -mattr=+c
LFLAGS+= -lto-O3
LFLAGS+= -nostdlib
LDLIBS+= -L./$(TARGET) -T script.ld