1 # This makefile needs to be edited to reflect the location
2 # of your own arm-elf-gcc toolchain (LIB variable)
7 OBJCOPY = arm-elf-objcopy
9 # Indicate where your gnuarm toolchain libgcc.a library is located:
10 LIB = /usr/local/new/gnuarm-4.3.0/lib/gcc/arm-elf/4.3.0/interwork
12 # Add -DWITH_LCD to EXTRA_CFLAGS if you want support for LCD
13 # in your firmware (add OBJLCD to OBJ too!)
14 #EXTRA_CFLAGS = -DWITH_LCD
17 ### You should not need to edit below this line
19 INCLUDE = -I../include
20 INCLUDES = ../include/proxmark3.h ../include/at91sam7s128.h ../include/config_gpio.h ../include/usb_cmd.h apps.h
21 CFLAGS_COMMON = -O6 -c $(INCLUDE) -Wall -mthumb-interwork
22 CFLAGS = $(CFLAGS_COMMON) $(EXTRA_CFLAGS) -mthumb
27 OBJLCD = $(OBJDIR)/LCD.o\
30 OBJ = $(OBJDIR)/start.o \
33 $(OBJDIR)/iso15693.o \
36 # To be compiled in ARM mode, not thumb mode: larger but faster
37 # Alleviates the 'blew circular buffer' issues somehow...
38 OBJFAST = $(OBJDIR)/iso14443.o \
41 OBJFPGA = $(OBJDIR)/fpgaimg.o
43 OBJCOMMON = $(OBJDIR)/usb.o
45 all: osimage.s19 fpgaimage.s19 fullimage.s19
47 fpgaimage.s19: $(OBJFPGA)
49 $(LD) -g -Tldscript-fpga -o $(OBJDIR)/fpgaimage.elf $^
50 $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/fpgaimage.elf fpgaimage.s19
52 osimage.s19: $(OBJ) $(OBJFAST) $(OBJCOMMON)
54 $(LD) -g -Tldscript -o $(OBJDIR)/osimage.elf $^ $(LIB)/libgcc.a
55 $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/osimage.elf osimage.s19
57 fullimage.s19: $(OBJ) $(OBJFAST) $(OBJCOMMON) $(OBJFAST) $(OBJFPGA)
59 $(LD) -g -Tldscript-full -o $(OBJDIR)/fullimage.elf $^ $(LIB)/libgcc.a
60 $(OBJCOPY) -Osrec --srec-forceS3 $(OBJDIR)/fullimage.elf fullimage.s19
62 # Directives to put the *.o in the OBJDIR directory:
63 $(OBJ): $(OBJDIR)/%.o : %.c
64 $(CC) $(CFLAGS) $< -o $@
66 $(OBJFPGA): $(OBJDIR)/%.o : %.c
67 $(CC) $(CFLAGS) $< -o $@
69 $(OBJFAST): $(OBJDIR)/%.o : %.c
70 $(CC) $(CFLAGS_COMMON) $< -o $@
72 $(OBJCOMMON): $(OBJDIR)/%.o : ../common/%.c
73 $(CC) $(CFLAGS) $< -o $@
75 # Those do not work on the current firmware !
76 flash-fpga: fpgaimage.s19
77 ../linux/flasher fpga fpgaimage.s19
80 ../linux/flasher os osimage.s19
82 jtag-flash-full: fullimage.s19
83 ../../OpenOCD/openocd -c "halt; flash write_image fullimage.s19 0x00100000; halt; reset; resume; poll; exit"
85 jtag-flash-fpga: fpgaimage.s19
86 ../../OpenOCD/openocd -c "halt; flash write_image fpgaimage.s19 0x00100000; halt; reset; resume; poll; exit"
88 jtag-flash: osimage.s19
89 ../../OpenOCD/openocd -c "halt; flash write_image osimage.s19 0x00100000; halt; reset; resume; poll; exit"
92 rm -f $(OBJDIR)/*.o $(OBJDIR)/*.elf *.s19