Files
chipyard/tests/Makefile
Abraham Gonzalez 0aae7979a4 Merge pull request #1428 from ucb-bar/mt-hello
Add mt-helloworld example
2023-04-20 14:51:44 -07:00

72 lines
1.3 KiB
Makefile

#################################
# RISCV Toolchain
#################################
PREFIX = riscv64-unknown-elf-
GCC = $(PREFIX)gcc
CXX = $(PREFIX)g++
CP = $(PREFIX)objcopy
OBJDUMP = $(PREFIX)objdump
DG = $(PREFIX)gdb
SIZE = $(PREFIX)size
#################################
# Flags
#################################
# SoC Settings
ARCH = rv64imafdc
ABI = lp64d
ARCHFLAGS = -march=$(ARCH) -mabi=$(ABI)
CFLAGS = -std=gnu99 -O2 -fno-common -fno-builtin-printf -Wall
CFLAGS += $(ARCHFLAGS)
LDFLAGS = -static
include libgloss.mk
PROGRAMS = pwm blkdev accum charcount nic-loopback big-blkdev pingd \
streaming-passthrough streaming-fir nvdla spiflashread spiflashwrite fft gcd \
hello mt-hello
.DEFAULT_GOAL := default
#################################
# Build
#################################
spiflash.img: spiflash.py
python3 $<
%.o: %.S
$(GCC) $(CFLAGS) -D__ASSEMBLY__=1 -c $< -o $@
%.o: %.c mmio.h spiflash.h
$(GCC) $(CFLAGS) -c $< -o $@
%.riscv: %.o $(libgloss)
$(GCC) $(LDFLAGS) $< -o $@
%.dump: %.riscv
$(OBJDUMP) -D $< > $@
#################################
# Recipes
#################################
.PHONY: clean
clean:
rm -f *.riscv *.o *.dump
$(if $(libgloss),rm -rf $(libgloss_builddir)/)
.PHONY: default
default: $(addsuffix .riscv, $(PROGRAMS)) spiflash.img
.PHONY: dumps
dumps: $(addsuffix .dump, $(PROGRAMS))