LM32_CC=lm32-elf-gcc LM32_LD=lm32-elf-ld LM32_OBJCOPY=lm32-elf-objcopy LM32_OBJDUMP=lm32-elf-objdump SREC2VRAM ?= ../../tools/srec2vram/srec2vram VRAMFILE=image.ram CFLAGS=-MMD -O2 -Wall -g -s -fomit-frame-pointer -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled LDFLAGS=-nostdlib -nodefaultlibs -Tlinker.ld SEGMENTS = -j .boot -j .text -j .rodata -j .data all: image.srec $(VRAMFILE) %.o: %.S $(LM32_CC) $(CFLAGS) -c $< %.o: %.c $(LM32_CC) $(CFLAGS) -c $< image: crt0gdb.o main.o soc-hw.o gdb.o gdb_uart.o $(LM32_LD) $(LDFLAGS) -Map image.map -N -o image $^ image.lst: image $(LM32_OBJDUMP) -h -S $< > $@ image.bin: image $(LM32_OBJCOPY) $(SEGMENTS) -O binary image image.bin image.srec: image image.lst $(LM32_OBJCOPY) $(SEGMENTS) -O srec image image.srec $(VRAMFILE): image.srec $(SREC2VRAM) image.srec 0x40000000 0x100000 > $(VRAMFILE) clean: rm -f image image.lst image.bin image.srec image.map *.o *.d DEPS := $(wildcard *.d) ifneq ($(DEPS),) include $(DEPS) endif