SummerCart64/fw/btldr/Makefile

37 lines
685 B
Makefile
Raw Normal View History

2021-08-05 19:50:29 +02:00
CROSS=riscv64-unknown-elf-
2021-08-12 21:07:47 +02:00
FLAGS=\
-mabi=ilp32 \
-march=rv32i \
-std=c11 \
-Os \
-Wall \
-Wstrict-prototypes \
-fverbose-asm \
-ffunction-sections \
-fdata-sections \
-Tbtldr.ld \
-Wl,--gc-sections \
-ffreestanding \
-nostartfiles \
-nostdlib
all: btldr.bin btldr.sv print_size
btldr.elf: btldr.ld btldr.c
2021-08-18 13:54:07 +02:00
@$(CROSS)gcc $(FLAGS) btldr.c -o btldr.elf
2021-08-05 19:50:29 +02:00
btldr.bin: btldr.elf
2021-08-18 13:54:07 +02:00
@$(CROSS)objcopy -O binary btldr.elf btldr.bin
2021-08-05 19:50:29 +02:00
btldr.sv: btldr.bin
2021-08-18 13:54:07 +02:00
@python3 bin2sv.py btldr.bin btldr_template.sv btldr.sv
2021-08-05 19:50:29 +02:00
print_size:
@echo 'Size of target .elf file:'
$(CROSS)size -B btldr.elf
clean:
2021-08-18 13:54:07 +02:00
@rm -f btldr.sv btldr.bin btldr.elf
2021-08-05 19:50:29 +02:00
.PHONY: clean