26 lines
758 B
Makefile
26 lines
758 B
Makefile
# Use clang / llvm toolchain
|
|
#
|
|
CC = clang
|
|
CXX = clang++
|
|
LD = ld.lld
|
|
SIZE = llvm-size
|
|
AS = riscv64-unknown-elf-as -mno-relax
|
|
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 generated_CH32V203F6P6.ld
|