synth/arm/makefile

40 lines
844 B
Makefile
Raw Normal View History

2022-05-08 06:00:22 +00:00
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
CXX = arm-none-eabi-g++
OBJCOPY = arm-none-eabi-objcopy
linker_script = bootloader.ld
2022-05-09 03:55:58 +00:00
includes =
sources =
2022-05-08 06:00:22 +00:00
2022-05-09 03:55:58 +00:00
CFLAGS = -march=armv6-m -g -ffunction-sections -fdata-sections -O2 -Werror -Wall
2022-05-08 06:00:22 +00:00
CXXFLAGS = $(CFLAGS) -std=c++20 -fno-exceptions
2022-05-09 03:55:58 +00:00
LDFLAGS = -march=armv6-m \
-g --specs=nano.specs --specs=nosys.specs \
-Wl,--gc-sections -Wl,-T$(linker_script) -O2 \
-Wl,--print-memory-usage
2022-05-08 06:00:22 +00:00
2022-05-09 03:55:58 +00:00
sources += hal/lib/common/xil_assert.c
includes += -Ihal/lib/common
sources += hal/uart/xuartlite.c hal/uart/xuartlite_stats.c
includes += -Ihal/uart
objects = main.o vector_table.o $(sources:.c=.o)
CFLAGS += $(includes)
all: bootloader.elf
2022-05-08 06:00:22 +00:00
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
2022-05-09 03:55:58 +00:00
bootloader.elf: $(objects)
2022-05-08 06:00:22 +00:00
%.elf:
$(LD) $(LDFLAGS) -o $@ $^
.PHONY: clean
clean:
2022-05-09 03:55:58 +00:00
rm -rf *.elf *.bin $(objects)