2021-08-12 21:07:47 +02:00
|
|
|
CROSS=riscv64-unknown-elf-
|
|
|
|
FLAGS=\
|
|
|
|
-mabi=ilp32 \
|
|
|
|
-march=rv32i \
|
|
|
|
-std=c11 \
|
|
|
|
-Os \
|
|
|
|
-Wall \
|
|
|
|
-Wstrict-prototypes \
|
|
|
|
-fverbose-asm \
|
|
|
|
-ffunction-sections \
|
|
|
|
-fdata-sections \
|
|
|
|
-Wl,--gc-sections \
|
|
|
|
-ffreestanding \
|
|
|
|
-nostartfiles \
|
|
|
|
-nostdlib
|
|
|
|
|
|
|
|
all: cntrllr.bin print_size
|
|
|
|
|
|
|
|
cntrllr.elf: cntrllr.ld main.c rtc.c startup.S
|
2021-08-18 13:54:07 +02:00
|
|
|
@$(CROSS)gcc $(FLAGS) -Tcntrllr.ld main.c rtc.c startup.S -o cntrllr.elf
|
2021-08-12 21:07:47 +02:00
|
|
|
|
|
|
|
cntrllr.bin: cntrllr.elf
|
2021-08-23 21:40:37 +02:00
|
|
|
@$(CROSS)objcopy -O binary cntrllr.elf cntrllr.bin
|
2021-08-12 21:07:47 +02:00
|
|
|
|
|
|
|
print_size:
|
|
|
|
@echo 'Size of target .elf file:'
|
2021-08-18 13:54:07 +02:00
|
|
|
@$(CROSS)size -B cntrllr.elf
|
2021-08-23 21:40:37 +02:00
|
|
|
@echo $(shell $(CROSS)size -B cntrllr.elf | awk 'NR==2 { printf "\nTotal memory used: %.2f%%\n",(100/(16*1024))*($$4) }')
|
2021-08-12 21:07:47 +02:00
|
|
|
|
|
|
|
clean:
|
2021-08-18 13:54:07 +02:00
|
|
|
@rm -f cntrllr.bin cntrllr.elf
|
2021-08-12 21:07:47 +02:00
|
|
|
|
|
|
|
.PHONY: clean
|