2022-05-08 06:00:22 +00:00
|
|
|
CC = arm-none-eabi-gcc
|
2022-05-17 03:26:37 +00:00
|
|
|
LD = arm-none-eabi-g++
|
2022-05-08 06:00:22 +00:00
|
|
|
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-17 03:28:24 +00:00
|
|
|
CFLAGS = -march=armv6-m -g -ffunction-sections -fdata-sections -Os -Werror -Wall -flto
|
|
|
|
CXXFLAGS = $(CFLAGS) -std=c++20 -fno-exceptions -fcoroutines
|
|
|
|
CPPFLAGS = -MD -MP
|
2022-05-09 03:55:58 +00:00
|
|
|
LDFLAGS = -march=armv6-m \
|
|
|
|
-g --specs=nano.specs --specs=nosys.specs \
|
2022-05-17 03:28:24 +00:00
|
|
|
-Wl,--gc-sections -Os \
|
|
|
|
-Wl,--print-memory-usage -flto
|
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
|
|
|
|
|
2022-05-10 18:20:02 +00:00
|
|
|
bootloader_objects = uart.o bootloader.o vector_table.o $(sources:.c=.o)
|
|
|
|
app_objects = app_init.o main.o
|
2022-05-09 03:55:58 +00:00
|
|
|
|
2022-05-17 03:28:24 +00:00
|
|
|
CPPFLAGS += $(includes)
|
2022-05-09 03:55:58 +00:00
|
|
|
|
2022-05-10 18:20:02 +00:00
|
|
|
all: bootloader.elf app.bin
|
2022-05-08 06:00:22 +00:00
|
|
|
|
|
|
|
%.bin: %.elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
2022-05-17 03:28:24 +00:00
|
|
|
bootloader.elf: $(bootloader_objects) bootloader.ld
|
|
|
|
$(LD) -Wl,-Tbootloader.ld $(LDFLAGS) -o $@ $(bootloader_objects)
|
2022-05-10 18:20:02 +00:00
|
|
|
|
2022-05-17 03:28:24 +00:00
|
|
|
app.elf: $(app_objects) app.ld
|
|
|
|
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $(app_objects)
|
2022-05-08 06:00:22 +00:00
|
|
|
|
|
|
|
%.elf:
|
2022-05-10 18:20:02 +00:00
|
|
|
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $^
|
2022-05-08 06:00:22 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2022-05-10 18:20:02 +00:00
|
|
|
rm -rf *.elf *.bin $(app_objects) $(bootloader_objects)
|