rvc/bare_metal_test/Makefile
pi 134e85e485 add rng, rtc, networking, more CSR paravirt exts and fixes
honestly forgot what I added all over the last year or so, but here you
go, enjoy more cursed code
2022-11-25 23:11:56 +01:00

35 lines
846 B
Makefile

TARGET ?= bare
SRC_DIRS ?= .
PREFIX ?= ../buildroot-2021.05/output/host/bin/riscv32-buildroot-linux-gnu-
CC := $(PREFIX)cc
AS := $(PREFIX)as
LD := $(PREFIX)ld
OBJCOPY := $(PREFIX)objcopy
SRCS := $(wildcard *.S)
SRCS += $(wildcard *.c)
OBJS := $(addsuffix .o,$(basename $(SRCS)))
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CFLAGS += -O2 -march=rv32ima -mabi=ilp32 -fno-stack-protector -fno-pie
ASFLAGS += -march=rv32ima -mabi=ilp32
LDFLAGS += -static -nostdlib -nostartfiles -nodefaultlibs -Triscv32.ld -Wl,--no-as-needed
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -o $@ $(LOADLIBES) $(LDLIBS)
$(TARGET).img: $(TARGET)
$(OBJCOPY) -O binary $< $@
.PHONY: clean
clean:
$(RM) $(TARGET) $(OBJS) $(DEPS)
.PHONY: run
run: $(TARGET).img
../rvc -d ../dts.dtb -b $(TARGET).img