RISC-V/V203/usb/ch32v203/clang.mk

26 lines
699 B
Makefile
Raw Normal View History

2024-10-11 10:39:42 +02:00
# Use clang / llvm toolchain
#
CC = clang
CXX = clang++
LD = ld.lld
SIZE = llvm-size
DUMP = riscv64-unknown-elf-objdump
COPY = riscv64-unknown-elf-objcopy
2024-10-13 15:29:09 +02:00
OBJS += startup.o system.o
2024-10-11 10:39:42 +02:00
CCPU = -march=rv32imac -mabi=ilp32
MCPU = $(CCPU)
TRIP = riscv32-unknown-none-elf
CFLAGS+= -Oz
2024-10-13 15:29:09 +02:00
CFLAGS+= -flto
2024-10-11 10:39:42 +02:00
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
2024-10-13 15:29:09 +02:00
LFLAGS+= -lto-O3
2024-10-11 10:39:42 +02:00
LFLAGS+= -nostdlib
2024-10-13 15:29:09 +02:00
LDLIBS+= -L./$(TARGET) -T script.ld