trying to also use .c files. Not yet working but doesn't break .as files

This commit is contained in:
Brendan Haines 2021-07-02 05:16:30 -06:00
parent b79c572a22
commit 2225ccd311
2 changed files with 12 additions and 2 deletions

View File

@ -11,7 +11,13 @@ TESTBENCH_V = hdl/tb/core_tb.v
# ================ # ================
# Software options # Software options
# ================ # ================
CC = riscv64-linux-gnu-gcc # SOURCE_C = $(wildcard test/*.c)
SOURCE_C =
SOURCE_AS = $(wildcard test/*.S)
OBJ = $(addprefix $(BUILD_DIR)/, $(notdir $(SOURCE_AS:.S=.o)))
OBJ += $(addprefix $(BUILD_DIR)/, $(notdir $(SOURCE_C:.c=.o)))
CC = riscv64-linux-gnu-gcc-8
# CFLAGS = -march=rv32i -mabi=ilp32 # CFLAGS = -march=rv32i -mabi=ilp32
CFLAGS = -march=rv64i -mabi=lp64 CFLAGS = -march=rv64i -mabi=lp64
@ -34,7 +40,7 @@ $(BUILD_DIR)/%.o: test/%.S | $(BUILD_DIR)
$(BUILD_DIR)/%.o: test/%.c | $(BUILD_DIR) $(BUILD_DIR)/%.o: test/%.c | $(BUILD_DIR)
$(CC) $(CFLAGS) $^ -o $@ $(CC) $(CFLAGS) $^ -o $@
$(BUILD_DIR)/%.elf: test/%.ld $(BUILD_DIR)/%.o | $(BUILD_DIR) $(BUILD_DIR)/%.elf: test/%.ld $(OBJ) | $(BUILD_DIR)
$(LD) $(LDFLAGS) $^ -o $@ $(LD) $(LDFLAGS) $^ -o $@
%.hex: %.elf %.hex: %.elf

4
test/main.c Normal file
View File

@ -0,0 +1,4 @@
void main()
{
}