24 lines
697 B
Makefile
24 lines
697 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 -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 -nostdlib
|
||
|
LDLIBS+= -L./$(TARGET) -T generated_CH32V203F8P6.ld
|