47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
CC = arm-none-eabi-gcc
 | 
						|
LD = arm-none-eabi-g++
 | 
						|
CXX = arm-none-eabi-g++
 | 
						|
OBJCOPY = arm-none-eabi-objcopy
 | 
						|
 | 
						|
linker_script = bootloader.ld
 | 
						|
includes = 
 | 
						|
sources =
 | 
						|
 | 
						|
CFLAGS = -march=armv6-m -g -ffunction-sections -fdata-sections -Os -Werror -Wall -flto
 | 
						|
CXXFLAGS = $(CFLAGS) -std=c++20 -fno-exceptions -fcoroutines
 | 
						|
CPPFLAGS = -MD -MP
 | 
						|
LDFLAGS = -march=armv6-m \
 | 
						|
		  -g --specs=nano.specs --specs=nosys.specs \
 | 
						|
		  -Wl,--gc-sections -Os \
 | 
						|
		  -Wl,--print-memory-usage -flto
 | 
						|
 | 
						|
sources += hal/lib/common/xil_assert.c
 | 
						|
includes += -Ihal/lib/common
 | 
						|
 | 
						|
sources += hal/uart/xuartlite.c hal/uart/xuartlite_stats.c
 | 
						|
includes += -Ihal/uart
 | 
						|
 | 
						|
bootloader_objects = uart.o bootloader.o vector_table.o $(sources:.c=.o)
 | 
						|
app_objects = app_init.o main.o
 | 
						|
 | 
						|
CPPFLAGS += $(includes)
 | 
						|
 | 
						|
all: bootloader.elf app.bin
 | 
						|
 | 
						|
%.bin: %.elf
 | 
						|
	$(OBJCOPY) -O binary $< $@
 | 
						|
 | 
						|
bootloader.elf: $(bootloader_objects) bootloader.ld
 | 
						|
	$(LD) -Wl,-Tbootloader.ld $(LDFLAGS) -o $@ $(bootloader_objects)
 | 
						|
 | 
						|
app.elf: $(app_objects) app.ld
 | 
						|
	$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $(app_objects)
 | 
						|
 | 
						|
%.elf:
 | 
						|
	$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $^
 | 
						|
 | 
						|
.PHONY: clean
 | 
						|
 | 
						|
clean:
 | 
						|
	rm -rf *.elf *.bin $(app_objects) $(bootloader_objects)
 |