1 #-----------------------------------------------------------------------------
2 # Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # See LICENSE.txt for the text of the license.
15 #-----------------------------------------------------------------------------
16 # Default platform if no platform specified
19 # Standalone Mode info (path depends if make is called at top or from armsrc)
20 # Guard Makefile.hal against implicit rules: (with % to avoid being first goal)
22 -include armsrc/Standalone/Makefile.hal
23 -include Standalone/Makefile.hal
24 ifndef DEFAULT_STANDALONE
25 $(error Could not find armsrc/Standalone/Makefile.hal)
28 define KNOWN_PLATFORM_DEFINITIONS
32 +============================================+
33 | PLATFORM | DESCRIPTION |
34 +============================================+
35 | PM3RDV4 (def) | Proxmark3 RDV4 |
36 +--------------------------------------------+
37 | PM3GENERIC | Proxmark3 generic target |
38 +--------------------------------------------+
39 | PM3ICOPYX | iCopy-X with XC3S100E |
40 +--------------------------------------------+
42 +============================================+
43 | PLATFORM_EXTRAS | DESCRIPTION |
44 +============================================+
45 | BTADDON | Proxmark3 RDV4 BT add-on |
46 +--------------------------------------------+
50 define HELP_DEFINITIONS
52 Options to define platform, platform extras and/or standalone mode:
54 (1) Run make with your PLATFORM, PLATFORM_EXTRAS and/or STANDALONE choices as follows:
55 make PLATFORM=PM3GENERIC STANDALONE=$(HELP_EXAMPLE_STANDALONE)
57 (2) Save a file called Makefile.platform with contents, e.g.:
60 or if you have a Proxmark 3 RDV4 with the BT add-on:
62 PLATFORM_EXTRAS=BTADDON
64 Default standalone mode is $(DEFAULT_STANDALONE).
65 To disable standalone modes, set explicitly an empty STANDALONE:
68 For Proxmarks with only 256k, you can define
71 to be warned if the image is too big for your device
72 and you can specify which parts to skip in order to reduce the size:
90 define KNOWN_DEFINITIONS
91 $(KNOWN_PLATFORM_DEFINITIONS)
92 $(KNOWN_STANDALONE_DEFINITIONS)
96 PLTNAME = Unknown Platform
97 PLATFORM_FPGA = fpga-undefined
99 ifeq ($(PLATFORM),PM3RDV4)
100 # FPGA bitstream files, the order doesn't matter anymore
101 FPGA_BITSTREAMS = fpga_pm3_hf.bit
103 FPGA_BITSTREAMS += fpga_pm3_lf.bit
105 ifneq ($(SKIP_FELICA),1)
106 FPGA_BITSTREAMS += fpga_pm3_felica.bit
108 ifneq ($(SKIP_ISO15693),1)
109 FPGA_BITSTREAMS += fpga_pm3_hf_15.bit
111 PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH -DRDV4
112 PLTNAME = Proxmark3 RDV4
113 PLATFORM_FPGA = xc2s30
115 else ifeq ($(PLATFORM),PM3OTHER)
116 $(warning PLATFORM=PM3OTHER is deprecated, please use PLATFORM=PM3GENERIC)
117 # FPGA bitstream files, the order doesn't matter anymore
118 FPGA_BITSTREAMS = fpga_pm3_hf.bit
120 FPGA_BITSTREAMS += fpga_pm3_lf.bit
122 ifneq ($(SKIP_FELICA),1)
123 FPGA_BITSTREAMS += fpga_pm3_felica.bit
125 ifneq ($(SKIP_ISO15693),1)
126 FPGA_BITSTREAMS += fpga_pm3_hf_15.bit
128 PLTNAME = Proxmark3 generic target
129 PLATFORM_FPGA = xc2s30
130 ifeq ($(LED_ORDER),PM3EASY)
131 PLATFORM_DEFS = -DLED_ORDER_PM3EASY
133 else ifeq ($(PLATFORM),PM3GENERIC)
134 # FPGA bitstream files, the order doesn't matter anymore
135 FPGA_BITSTREAMS = fpga_pm3_hf.bit
137 FPGA_BITSTREAMS += fpga_pm3_lf.bit
139 ifneq ($(SKIP_FELICA),1)
140 FPGA_BITSTREAMS += fpga_pm3_felica.bit
142 ifneq ($(SKIP_ISO15693),1)
143 FPGA_BITSTREAMS += fpga_pm3_hf_15.bit
145 PLTNAME = Proxmark3 generic target
146 PLATFORM_FPGA = xc2s30
147 ifeq ($(LED_ORDER),PM3EASY)
148 PLATFORM_DEFS = -DLED_ORDER_PM3EASY
150 else ifeq ($(PLATFORM),PM3ICOPYX)
151 # FPGA bitstream files, the order doesn't matter anymore - only hf has a bitstream
152 FPGA_BITSTREAMS = fpga_icopyx_hf.bit
153 PLATFORM_DEFS = -DWITH_FLASH -DICOPYX -DXC3
154 PLTNAME = iCopy-X with XC3S100E
155 PLATFORM_FPGA = xc3s100e
158 $(error Invalid or empty PLATFORM: $(PLATFORM). $(KNOWN_DEFINITIONS))
161 # parsing additional PLATFORM_EXTRAS tokens
162 PLATFORM_EXTRAS_TMP:=$(PLATFORM_EXTRAS)
163 ifneq (,$(findstring SMARTCARD,$(PLATFORM_EXTRAS_TMP)))
164 PLATFORM_DEFS += -DWITH_SMARTCARD
165 PLATFORM_EXTRAS_TMP := $(strip $(filter-out SMARTCARD,$(PLATFORM_EXTRAS_TMP)))
167 ifneq (,$(findstring FLASH,$(PLATFORM_EXTRAS_TMP)))
168 PLATFORM_DEFS += -DWITH_FLASH
169 PLATFORM_EXTRAS_TMP := $(strip $(filter-out FLASH,$(PLATFORM_EXTRAS_TMP)))
171 ifneq (,$(findstring BTADDON,$(PLATFORM_EXTRAS_TMP)))
172 PLATFORM_DEFS += -DWITH_FPC_USART_HOST
173 PLATFORM_EXTRAS_TMP := $(strip $(filter-out BTADDON,$(PLATFORM_EXTRAS_TMP)))
175 ifneq (,$(findstring FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
176 PLATFORM_DEFS += -DWITH_FPC_USART_DEV
177 PLATFORM_EXTRAS_TMP := $(strip $(filter-out FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
179 ifneq (,$(PLATFORM_EXTRAS_TMP))
180 $(error Unknown PLATFORM_EXTRAS token(s): $(PLATFORM_EXTRAS_TMP))
185 PLATFORM_DEFS += -DWITH_LF
187 ifneq ($(SKIP_HITAG),1)
188 PLATFORM_DEFS += -DWITH_HITAG
190 ifneq ($(SKIP_EM4x50),1)
191 PLATFORM_DEFS += -DWITH_EM4x50
193 ifneq ($(SKIP_EM4x70),1)
194 PLATFORM_DEFS += -DWITH_EM4x70
196 ifneq ($(SKIP_ZX8211),1)
197 PLATFORM_DEFS += -DWITH_ZX8211
202 PLATFORM_DEFS += -DWITH_GENERAL_HF
204 ifneq ($(SKIP_ISO15693),1)
205 PLATFORM_DEFS += -DWITH_ISO15693
207 ifneq ($(SKIP_LEGICRF),1)
208 PLATFORM_DEFS += -DWITH_LEGICRF
210 ifneq ($(SKIP_ISO14443b),1)
211 PLATFORM_DEFS += -DWITH_ISO14443b
213 ifneq ($(SKIP_ISO14443a),1)
214 PLATFORM_DEFS += -DWITH_ISO14443a
216 ifneq ($(SKIP_ICLASS),1)
217 PLATFORM_DEFS += -DWITH_ICLASS
219 ifneq ($(SKIP_FELICA),1)
220 PLATFORM_DEFS += -DWITH_FELICA
222 ifneq ($(SKIP_NFCBARCODE),1)
223 PLATFORM_DEFS += -DWITH_NFCBARCODE
225 ifneq ($(SKIP_HFSNIFF),1)
226 PLATFORM_DEFS += -DWITH_HFSNIFF
228 ifneq ($(SKIP_HFPLOT),1)
229 PLATFORM_DEFS += -DWITH_HFPLOT
231 ifneq ($(SKIP_COMPRESSION),1)
232 PLATFORM_DEFS += -DWITH_COMPRESSION
236 ifneq ($(strip $(filter $(PLATFORM_DEFS),$(STANDALONE_REQ_DEFS))),$(strip $(STANDALONE_REQ_DEFS)))
237 $(error Chosen Standalone mode $(STANDALONE) requires $(strip $(STANDALONE_REQ_DEFS)), unsupported by $(PLTNAME))
239 ifneq (,$(STANDALONE_PLATFORM_DEFS))
240 PLATFORM_DEFS+=$(STANDALONE_PLATFORM_DEFS)
243 $(info $(findstring WITH_STANDALONE_*,$(PLATFORM_DEFS)))
246 ifneq (,$(findstring WITH_LCD,$(PLATFORM_DEFS)))
247 #PLATFORM_DEFS += -DWITH_LCD
250 # Add flags dependencies :
252 # WITH_FPC_USART_* needs WITH_FPC_USART :
253 ifneq (,$(findstring WITH_FPC_USART_,$(PLATFORM_DEFS)))
254 PLATFORM_DEFS += -DWITH_FPC_USART
257 PLATFORM_DEFS_INFO = $(strip $(filter-out STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS))))
258 PLATFORM_DEFS_INFO_STANDALONE = $(strip $(subst STANDALONE_,, $(filter STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS)))))
260 # Check that only one Standalone mode has been chosen
261 ifneq (,$(word 2, $(PLATFORM_DEFS_INFO_STANDALONE)))
262 $(error You must choose only one Standalone mode!: $(PLATFORM_DEFS_INFO_STANDALONE))
265 PLATFORM_EXTRAS_INFO = $(PLATFORM_EXTRAS)
267 ifeq (,$(PLATFORM_EXTRAS_INFO))
268 PLATFORM_EXTRAS_INFO = No extra selected
271 # info when no standalone mode
272 ifeq (,$(PLATFORM_DEFS_INFO_STANDALONE))
273 PLATFORM_DEFS_INFO_STANDALONE = No standalone mode selected
276 ifeq ($(PLATFORM_SIZE),)
280 PLATFORM_CHANGED=false
281 ifneq ($(PLATFORM), $(CACHED_PLATFORM))
282 PLATFORM_CHANGED=true
283 else ifneq ($(PLATFORM_EXTRAS), $(CACHED_PLATFORM_EXTRAS))
284 PLATFORM_CHANGED=true
285 else ifneq ($(PLATFORM_DEFS), $(CACHED_PLATFORM_DEFS))
286 PLATFORM_CHANGED=true
290 export PLATFORM_EXTRAS
291 export PLATFORM_EXTRAS_INFO
296 export PLATFORM_DEFS_INFO
297 export PLATFORM_DEFS_INFO_STANDALONE
298 export PLATFORM_CHANGED
299 export FPGA_BITSTREAMS
301 $(info ===================================================================)
302 $(info Version info: $(shell tools/mkversion.sh --short 2>/dev/null || ../tools/mkversion.sh --short 2>/dev/null))
303 $(info Platform name: $(PLTNAME))
304 $(info PLATFORM: $(PLATFORM))
305 $(info PLATFORM_FPGA: $(PLATFORM_FPGA))
306 $(info PLATFORM_SIZE: $(PLATFORM_SIZE))
307 $(info Platform extras: $(PLATFORM_EXTRAS_INFO))
308 $(info Included options: $(PLATFORM_DEFS_INFO))
309 $(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE))
310 $(info ===================================================================)