Had some issues due to lack of startup code (stack pointer was unset, leading to underflow in address space), so decided to just get the rust FW started instead of finding some startup code to use.
18 lines
429 B
Makefile
18 lines
429 B
Makefile
PREFIX := riscv64-unknown-elf-
|
|
CC := $(PREFIX)gcc
|
|
OBJCOPY := $(PREFIX)objcopy
|
|
|
|
ARGS := -mabi=ilp32 -march=rv32im -ffreestanding -nostdlib -Wl,-Bstatic,-T,memory.ld -g
|
|
|
|
SOURCES := main.c
|
|
INCLUDES := uart.h
|
|
|
|
hello_world.bin: hello_world.elf
|
|
$(OBJCOPY) -S -O binary hello_world.elf hello_world.bin
|
|
|
|
hello_world.elf: $(SOURCES) $(INCLUDES)
|
|
$(CC) $(ARGS) $(SOURCES) -o hello_world.elf
|
|
|
|
clean:
|
|
rm -f hello_world.elf hello_world.bin
|