]>
Commit | Line | Data |
---|---|---|
1 | CC = arm-elf-gcc | |
2 | AS = arm-elf-as | |
3 | LD = arm-elf-ld | |
4 | OBJCOPY = arm-elf-objcopy | |
5 | ||
6 | OBJDIR = obj | |
7 | ||
8 | INCLUDE = -I../include | |
9 | ||
10 | INCLUDES = ../include/proxmark3.h ../include/at91sam7s128.h ../include/config_gpio.h ../include/usb_cmd.h | |
11 | ||
12 | CFLAGS = -g -c $(INCLUDE) -Wall | |
13 | ||
14 | OBJJTAG = $(OBJDIR)/bootrom.o $(OBJDIR)/ram-reset.o $(OBJDIR)/usb.o | |
15 | ||
16 | OBJFLASH = $(OBJDIR)/flash-reset.o $(OBJDIR)/fromflash.o | |
17 | ||
18 | all: bootrom.s19 bootrom-forjtag-swapped.s19 | |
19 | ||
20 | bootrom-merged.s19: bootrom.s19 bootrom-forjtag.s19 | |
21 | perl ../tools/merge-srec.pl bootrom.s19 bootrom-forjtag.s19 > bootrom-merged.s19 | |
22 | ||
23 | bootrom-forjtag-swapped.s19: bootrom-merged.s19 | |
24 | perl ../tools/srecswap.pl bootrom-forjtag.s19 > bootrom-forjtag-swapped.s19 | |
25 | ||
26 | bootrom.s19: $(OBJFLASH) | |
27 | @echo bootrom.s19 | |
28 | $(LD) -g -Tldscript-flash --oformat elf32-littlearm -o $(OBJDIR)/bootrom.elf $(OBJFLASH) | |
29 | $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/bootrom.elf bootrom.s19 | |
30 | ||
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 | |
35 | ||
36 | $(OBJDIR)/bootrom.o: bootrom.c $(INCLUDES) | |
37 | @echo $@ | |
38 | $(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@ | |
39 | ||
40 | $(OBJDIR)/fromflash.o: fromflash.c $(INCLUDES) | |
41 | @echo $@ | |
42 | $(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@ | |
43 | ||
44 | $(OBJDIR)/usb.o: ../common/usb.c $(INCLUDES) | |
45 | @echo $@ | |
46 | $(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@ | |
47 | ||
48 | $(OBJDIR)/ram-reset.o: ram-reset.s | |
49 | @echo $@ | |
50 | $(CC) $(CFLAGS) -mthumb-interwork -o $@ $< | |
51 | ||
52 | $(OBJDIR)/flash-reset.o: flash-reset.s | |
53 | @echo $@ | |
54 | $(CC) $(CFLAGS) -mthumb-interwork -o $@ $< | |
55 | ||
56 | # Those do not work in this Firmware distribution! | |
57 | flash: bootrom-merged.s19 | |
58 | ../linux/flasher bootrom bootrom-merged.s19 | |
59 | ||
60 | jtag-flash: bootrom-merged.s19 | |
61 | ../../OpenOCD/openocd -c "halt; flash write_image bootrom-merged.s19 0x00100000; halt; reset; resume; poll; exit" | |
62 | ||
63 | clean: | |
64 | rm -f $(OBJDIR)/*.o $(OBJDIR)/*.elf *.s19 | |
65 |