4 OBJCOPY = arm-elf-objcopy
10 INCLUDES = ../include/proxmark3.h ../include/at91sam7s128.h ../include/config_gpio.h ../include/usb_cmd.h
12 CFLAGS = -g -c $(INCLUDE) -Wall
14 OBJJTAG = $(OBJDIR)/bootrom.o $(OBJDIR)/ram-reset.o $(OBJDIR)/usb.o
16 OBJFLASH = $(OBJDIR)/flash-reset.o $(OBJDIR)/fromflash.o
18 all: bootrom.s19 bootrom-forjtag-swapped.s19
20 bootrom-merged.s19: bootrom.s19 bootrom-forjtag.s19
21 perl ../tools/merge-srec.pl bootrom.s19 bootrom-forjtag.s19 > bootrom-merged.s19
23 bootrom-forjtag-swapped.s19: bootrom-merged.s19
24 perl ../tools/srecswap.pl bootrom-forjtag.s19 > bootrom-forjtag-swapped.s19
26 bootrom.s19: $(OBJFLASH)
28 $(LD) -g -Tldscript-flash --oformat elf32-littlearm -o $(OBJDIR)/bootrom.elf $(OBJFLASH)
29 $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/bootrom.elf bootrom.s19
31 bootrom-forjtag.s19: $(OBJJTAG)
32 @echo bootrom-forjtag.s19
33 $(LD) -g -Tldscript-ram-jtag --oformat elf32-littlearm -o $(OBJDIR)/bootrom-forjtag.elf $(OBJJTAG)
34 $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/bootrom-forjtag.elf bootrom-forjtag.s19
36 $(OBJDIR)/bootrom.o: bootrom.c $(INCLUDES)
38 $(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@
40 $(OBJDIR)/fromflash.o: fromflash.c $(INCLUDES)
42 $(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@
44 $(OBJDIR)/usb.o: ../common/usb.c $(INCLUDES)
46 $(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@
48 $(OBJDIR)/ram-reset.o: ram-reset.s
50 $(CC) $(CFLAGS) -mthumb-interwork -o $@ $<
52 $(OBJDIR)/flash-reset.o: flash-reset.s
54 $(CC) $(CFLAGS) -mthumb-interwork -o $@ $<
56 # Those do not work in this Firmware distribution!
57 flash: bootrom-merged.s19
58 ../linux/flasher bootrom bootrom-merged.s19
60 jtag-flash: bootrom-merged.s19
61 ../../OpenOCD/openocd -c "halt; flash write_image bootrom-merged.s19 0x00100000; halt; reset; resume; poll; exit"
64 rm -f $(OBJDIR)/*.o $(OBJDIR)/*.elf *.s19