]>
Commit | Line | Data |
---|---|---|
b1d0de0a | 1 | # This makefile needs to be edited to reflect the location |
bb06be43 | 2 | # of your own arm-elf-gcc toolchain (ARMLIB variable) |
b1d0de0a | 3 | |
4 | CC = arm-elf-gcc | |
5 | AS = arm-elf-as | |
6 | LD = arm-elf-ld | |
7 | OBJCOPY = arm-elf-objcopy | |
8 | ||
bb06be43 | 9 | # Indicate where your gnuarm toolchain libgcc.a interworking library is located |
10 | # or set $ARMLIB in your environment: | |
11 | #ARMLIB = /usr/local/lib/gcc/arm-elf/4.3.3/interwork | |
12 | ||
b1d0de0a | 13 | |
aa4d9d9b | 14 | # Add -DWITH_LCD to EXTRA_CFLAGS if you want support for LCD |
15 | # in your firmware (add OBJLCD to OBJ too!) | |
16 | #EXTRA_CFLAGS = -DWITH_LCD | |
17 | EXTRA_CFLAGS = | |
18 | ||
19 | ### You should not need to edit below this line | |
20 | ||
21 | INCLUDE = -I../include | |
22 | INCLUDES = ../include/proxmark3.h ../include/at91sam7s128.h ../include/config_gpio.h ../include/usb_cmd.h apps.h | |
b1d0de0a | 23 | CFLAGS_COMMON = -O6 -c $(INCLUDE) -Wall -mthumb-interwork |
aa4d9d9b | 24 | CFLAGS = $(CFLAGS_COMMON) $(EXTRA_CFLAGS) -mthumb |
b1d0de0a | 25 | |
26 | ||
27 | OBJDIR = obj | |
b1d0de0a | 28 | |
aa4d9d9b | 29 | OBJLCD = $(OBJDIR)/LCD.o\ |
30 | $(OBJDIR)/fonts.o | |
31 | ||
32 | OBJ = $(OBJDIR)/start.o \ | |
33 | $(OBJDIR)/appmain.o \ | |
34 | $(OBJDIR)/fpga.o \ | |
9bea179a | 35 | $(OBJDIR)/lfops.o \ |
aa4d9d9b | 36 | $(OBJDIR)/iso15693.o \ |
aa4d9d9b | 37 | $(OBJDIR)/util.o |
b1d0de0a | 38 | |
0e25ae11 | 39 | # To be compiled in ARM mode, not thumb mode: larger but faster |
40 | # Alleviates the 'blew circular buffer' issues somehow... | |
41 | OBJFAST = $(OBJDIR)/iso14443.o \ | |
42 | $(OBJDIR)/iso14443a.o | |
b1d0de0a | 43 | |
aa4d9d9b | 44 | OBJFPGA = $(OBJDIR)/fpgaimg.o |
45 | ||
46 | OBJCOMMON = $(OBJDIR)/usb.o | |
b1d0de0a | 47 | |
48 | all: osimage.s19 fpgaimage.s19 fullimage.s19 | |
49 | ||
50 | fpgaimage.s19: $(OBJFPGA) | |
51 | @echo fpgaimage.s19 | |
aa4d9d9b | 52 | $(LD) -g -Tldscript-fpga -o $(OBJDIR)/fpgaimage.elf $^ |
53 | $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/fpgaimage.elf fpgaimage.s19 | |
b1d0de0a | 54 | |
55 | osimage.s19: $(OBJ) $(OBJFAST) $(OBJCOMMON) | |
56 | @echo osimage.s19 | |
890bf4be | 57 | $(LD) -g -Tldscript -o $(OBJDIR)/osimage.elf -Map=osimage.map $^ $(ARMLIB)/libgcc.a |
aa4d9d9b | 58 | $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/osimage.elf osimage.s19 |
b1d0de0a | 59 | |
60 | fullimage.s19: $(OBJ) $(OBJFAST) $(OBJCOMMON) $(OBJFAST) $(OBJFPGA) | |
61 | @echo fullimage.s19 | |
bb06be43 | 62 | $(LD) -g -Tldscript-full -o $(OBJDIR)/fullimage.elf $^ $(ARMLIB)/libgcc.a |
aa4d9d9b | 63 | $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/fullimage.elf fullimage.s19 |
b1d0de0a | 64 | |
aa4d9d9b | 65 | # Directives to put the *.o in the OBJDIR directory: |
66 | $(OBJ): $(OBJDIR)/%.o : %.c | |
67 | $(CC) $(CFLAGS) $< -o $@ | |
b1d0de0a | 68 | |
aa4d9d9b | 69 | $(OBJFPGA): $(OBJDIR)/%.o : %.c |
70 | $(CC) $(CFLAGS) $< -o $@ | |
b1d0de0a | 71 | |
aa4d9d9b | 72 | $(OBJFAST): $(OBJDIR)/%.o : %.c |
73 | $(CC) $(CFLAGS_COMMON) $< -o $@ | |
b1d0de0a | 74 | |
aa4d9d9b | 75 | $(OBJCOMMON): $(OBJDIR)/%.o : ../common/%.c |
76 | $(CC) $(CFLAGS) $< -o $@ | |
b1d0de0a | 77 | |
1dd23352 | 78 | flash-both: flash flash-fpga |
79 | ||
b1d0de0a | 80 | flash-fpga: fpgaimage.s19 |
81 | ../linux/flasher fpga fpgaimage.s19 | |
82 | ||
83 | flash: osimage.s19 | |
84 | ../linux/flasher os osimage.s19 | |
85 | ||
1dd23352 | 86 | # Those do not work on the current firmware ! |
b1d0de0a | 87 | jtag-flash-full: fullimage.s19 |
88 | ../../OpenOCD/openocd -c "halt; flash write_image fullimage.s19 0x00100000; halt; reset; resume; poll; exit" | |
89 | ||
90 | jtag-flash-fpga: fpgaimage.s19 | |
91 | ../../OpenOCD/openocd -c "halt; flash write_image fpgaimage.s19 0x00100000; halt; reset; resume; poll; exit" | |
92 | ||
93 | jtag-flash: osimage.s19 | |
94 | ../../OpenOCD/openocd -c "halt; flash write_image osimage.s19 0x00100000; halt; reset; resume; poll; exit" | |
95 | ||
96 | clean: | |
890bf4be | 97 | rm -f $(OBJDIR)/*.o $(OBJDIR)/*.elf *.s19 osimage.map |
b1d0de0a | 98 | |
99 | .PHONY: all clean |