CC = /usr/local/arm-tools/bin/arm-elf-gcc
AS = /usr/local/arm-tools/bin/arm-elf-as
LD = /usr/local/arm-tools/bin/arm-elf-ld
OBJCPY = /usr/local/arm-tools/bin/arm-elf-objcopy

all: memory_thumb.def gcc_sample_thumb.o startup_thumb.o TFT018_thumb.o
	$(LD) startup_thumb.o gcc_sample_thumb.o TFT018_thumb.o -T memory_thumb.def -o gcc_sample_thumb -Map gcc_sample_thumb.map
	$(OBJCPY) -O ihex gcc_sample_thumb gcc_sample_thumb.hex
	$(OBJCPY) -O srec gcc_sample_thumb gcc_sample_thumb.s19
	$(OBJCPY) -O binary gcc_sample_thumb gcc_sample_thumb.bin

startup_thumb.o : startup.s
	$(AS) -mcpu=cortex-m3 -mthumb --defsym THUMB=1 startup.s -o startup_thumb.o
gcc_sample_thumb.o: gcc_sample.c
	$(CC) -mcpu=cortex-m3 -mthumb -c $< -o gcc_sample_thumb.o
TFT018_thumb.o: TFT018.c
	$(CC) -mcpu=cortex-m3 -mthumb -c $< -o TFT018_thumb.o
clean:
	rm -f *.o gcc_sample_thumb *.map *.hex *.s19
