26 lines
733 B
Makefile
26 lines
733 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
|
||
|
AS = riscv64-unknown-elf-as
|
||
|
|
||
|
#OBJS += startup.o system.o
|
||
|
CCPU = -march=rv32imac -mabi=ilp32
|
||
|
MCPU = $(CCPU)
|
||
|
TRIP = riscv32-unknown-none-elf
|
||
|
CFLAGS+= -Oz
|
||
|
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+= -nostdlib
|
||
|
#LDLIBS+= -L$(SRCDIR)/Ld -T Link.ld
|
||
|
LDLIBS+= -L./ch32v203 -T script.ld
|