1 #-----------------------------------------------------------------------------
 
   2 # This code is licensed to you under the terms of the GNU GPL, version 2 or,
 
   3 # at your option, any later version. See the LICENSE.txt file for the text of
 
   5 #-----------------------------------------------------------------------------
 
   6 # Makefile for armsrc, see ../common/Makefile.common for common settings
 
   7 #-----------------------------------------------------------------------------
 
  11 #remove one of the following defines and comment out the relevant line
 
  12 #in the next section to remove that particular feature from compilation
 
  13 APP_CFLAGS      = -DWITH_ISO14443a_StandAlone -DWITH_LF -DWITH_ISO15693 -DWITH_ISO14443a -DWITH_ISO14443b -DWITH_ICLASS -DWITH_LEGICRF -DWITH_HITAG  -DWITH_CRC -DON_DEVICE -DWITH_HFSNOOP \
 
  14                                 -fno-strict-aliasing -ffunction-sections -fdata-sections
 
  17 #SRC_LCD = fonts.c LCD.c
 
  18 SRC_LF = lfops.c hitag2.c hitagS.c lfsampling.c pcf7931.c lfdemod.c protocols.c
 
  19 SRC_ISO15693 = iso15693.c iso15693tools.c
 
  20 SRC_ISO14443a = epa.c iso14443a.c mifareutil.c mifarecmd.c mifaresniff.c
 
  21 SRC_ISO14443b = iso14443b.c
 
  22 SRC_CRAPTO1 = crypto1.c des.c aes.c
 
  23 SRC_CRC = iso14443crc.c crc.c crc16.c crc32.c parity.c
 
  25 #the FPGA bitstream files. Note: order matters!
 
  26 FPGA_BITSTREAMS = fpga_lf.bit fpga_hf.bit
 
  28 #the zlib source files required for decompressing the fpga config at run time
 
  29 SRC_ZLIB = inflate.c inffast.c inftrees.c adler32.c zutil.c
 
  30 #additional defines required to compile zlib
 
  31 ZLIB_CFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
 
  32 APP_CFLAGS += $(ZLIB_CFLAGS)
 
  34 APP_CFLAGS += -I../zlib
 
  36 # Compile these in thumb mode (small size)
 
  49 # These are to be compiled in ARM mode
 
  50 ARMSRC = fpgaloader.c \
 
  62 # Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
 
  63 include ../common/Makefile.common
 
  65 OBJS = $(OBJDIR)/fullimage.s19
 
  66 FPGA_COMPRESSOR = ../client/fpga_compress
 
  72 $(OBJDIR)/fpga_all.o: $(OBJDIR)/fpga_all.bit.z
 
  73         $(OBJCOPY) -O elf32-littlearm -I binary -B arm --prefix-sections=fpga_all_bit $^ $@
 
  75 $(OBJDIR)/fpga_all.bit.z: $(FPGA_BITSTREAMS) $(FPGA_COMPRESSOR)
 
  76         $(FPGA_COMPRESSOR) $(filter %.bit,$^) $@
 
  79                 make -C ../client $(notdir $(FPGA_COMPRESSOR))
 
  81 $(OBJDIR)/fullimage.stage1.elf: $(VERSIONOBJ) $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ)
 
  82         $(CC) $(LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS)
 
  84 $(OBJDIR)/fullimage.nodata.bin: $(OBJDIR)/fullimage.stage1.elf
 
  85         $(OBJCOPY) -O binary -I elf32-littlearm --remove-section .data $^ $@
 
  87 $(OBJDIR)/fullimage.nodata.o: $(OBJDIR)/fullimage.nodata.bin
 
  88         $(OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=stage1_image $^ $@
 
  90 $(OBJDIR)/fullimage.data.bin: $(OBJDIR)/fullimage.stage1.elf
 
  91         $(OBJCOPY) -O binary -I elf32-littlearm --only-section .data $^ $@
 
  93 $(OBJDIR)/fullimage.data.bin.z: $(OBJDIR)/fullimage.data.bin $(FPGA_COMPRESSOR)
 
  94         $(FPGA_COMPRESSOR) $(filter %.bin,$^) $@
 
  96 $(OBJDIR)/fullimage.data.o: $(OBJDIR)/fullimage.data.bin.z
 
  97         $(OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=compressed_data $^ $@
 
  99 $(OBJDIR)/fullimage.elf: $(OBJDIR)/fullimage.nodata.o $(OBJDIR)/fullimage.data.o
 
 100         $(CC) $(LDFLAGS) -Wl,-T,ldscript,-e,_osimage_entry,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^
 
 103         $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(OBJS:%=armsrc/%) $(OBJS:%.s19=armsrc/%.elf)
 
 106         $(DELETE) $(OBJDIR)$(PATHSEP)*.o
 
 107         $(DELETE) $(OBJDIR)$(PATHSEP)*.elf
 
 108         $(DELETE) $(OBJDIR)$(PATHSEP)*.s19
 
 109         $(DELETE) $(OBJDIR)$(PATHSEP)*.map
 
 110         $(DELETE) $(OBJDIR)$(PATHSEP)*.d
 
 111         $(DELETE) $(OBJDIR)$(PATHSEP)*.z
 
 112         $(DELETE) $(OBJDIR)$(PATHSEP)*.bin
 
 115 .PHONY: all clean help
 
 117         @echo Multi-OS Makefile, you are running on $(DETECTED_OS)
 
 118         @echo Possible targets:
 
 119         @echo + all    - Build the full image $(OBJDIR)/fullimage.s19
 
 120         @echo + clean  - Clean $(OBJDIR)