2022-01-07 08:58:03 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# See LICENSE.txt for the text of the license.
|
|
|
|
#-----------------------------------------------------------------------------
|
2019-06-02 04:49:28 +08:00
|
|
|
# Default platform if no platform specified
|
|
|
|
PLATFORM?=PM3RDV4
|
|
|
|
|
2019-07-17 01:18:45 +08:00
|
|
|
# Standalone Mode info (path depends if make is called at top or from armsrc)
|
2019-08-09 22:03:14 +08:00
|
|
|
# Guard Makefile.hal against implicit rules: (with % to avoid being first goal)
|
|
|
|
%/Makefile.hal: ;
|
2019-07-17 01:18:45 +08:00
|
|
|
-include armsrc/Standalone/Makefile.hal
|
|
|
|
-include Standalone/Makefile.hal
|
|
|
|
ifndef DEFAULT_STANDALONE
|
|
|
|
$(error Could not find armsrc/Standalone/Makefile.hal)
|
|
|
|
endif
|
|
|
|
|
|
|
|
define KNOWN_PLATFORM_DEFINITIONS
|
2019-06-01 06:23:38 +08:00
|
|
|
|
|
|
|
Known definitions:
|
2019-03-11 07:21:14 +08:00
|
|
|
|
2019-08-22 02:06:14 +08:00
|
|
|
+============================================+
|
|
|
|
| PLATFORM | DESCRIPTION |
|
|
|
|
+============================================+
|
2021-01-14 21:23:00 +08:00
|
|
|
| PM3RDV4 (def) | Proxmark3 RDV4 |
|
2019-08-22 02:06:14 +08:00
|
|
|
+--------------------------------------------+
|
2021-01-14 21:23:00 +08:00
|
|
|
| PM3GENERIC | Proxmark3 generic target |
|
2019-08-22 02:06:14 +08:00
|
|
|
+--------------------------------------------+
|
2021-08-22 05:43:06 +08:00
|
|
|
| PM3ICOPYX | iCopy-X with XC3S100E |
|
|
|
|
+--------------------------------------------+
|
2019-08-22 02:06:14 +08:00
|
|
|
|
|
|
|
+============================================+
|
|
|
|
| PLATFORM_EXTRAS | DESCRIPTION |
|
|
|
|
+============================================+
|
2021-01-14 21:23:00 +08:00
|
|
|
| BTADDON | Proxmark3 RDV4 BT add-on |
|
2019-08-22 02:06:14 +08:00
|
|
|
+--------------------------------------------+
|
2019-03-11 07:21:14 +08:00
|
|
|
|
2019-07-17 01:18:45 +08:00
|
|
|
endef
|
2019-06-01 06:23:38 +08:00
|
|
|
|
2019-07-17 01:18:45 +08:00
|
|
|
define HELP_DEFINITIONS
|
2019-06-01 06:23:38 +08:00
|
|
|
Options to define platform, platform extras and/or standalone mode:
|
2019-08-22 02:06:14 +08:00
|
|
|
(1) Run make with your PLATFORM, PLATFORM_EXTRAS and/or STANDALONE choices as follows:
|
2021-01-14 21:23:00 +08:00
|
|
|
make PLATFORM=PM3GENERIC STANDALONE=$(HELP_EXAMPLE_STANDALONE)
|
2019-03-11 07:21:14 +08:00
|
|
|
|
2019-08-22 02:06:14 +08:00
|
|
|
(2) Save a file called Makefile.platform with contents, e.g.:
|
2021-01-14 21:23:00 +08:00
|
|
|
PLATFORM=PM3GENERIC
|
2019-03-11 07:21:14 +08:00
|
|
|
|
2019-05-04 04:30:17 +08:00
|
|
|
or if you have a Proxmark 3 RDV4 with the BT add-on:
|
|
|
|
PLATFORM=PM3RDV4
|
|
|
|
PLATFORM_EXTRAS=BTADDON
|
|
|
|
|
2019-07-17 01:18:45 +08:00
|
|
|
Default standalone mode is $(DEFAULT_STANDALONE).
|
2019-06-02 16:17:52 +08:00
|
|
|
To disable standalone modes, set explicitly an empty STANDALONE:
|
|
|
|
STANDALONE=
|
2020-11-05 09:33:01 +08:00
|
|
|
|
|
|
|
For Proxmarks with only 256k, you can define
|
|
|
|
PLATFORM_SIZE=256
|
|
|
|
to be warned if the image is too big for your device
|
|
|
|
and you can specify which parts to skip in order to reduce the size:
|
|
|
|
SKIP_LF=1
|
|
|
|
SKIP_HITAG=1
|
|
|
|
SKIP_EM4x50=1
|
|
|
|
SKIP_ISO15693=1
|
|
|
|
SKIP_LEGICRF=1
|
|
|
|
SKIP_ISO14443b=1
|
|
|
|
SKIP_ISO14443a=1
|
|
|
|
SKIP_ICLASS=1
|
|
|
|
SKIP_FELICA=1
|
|
|
|
SKIP_NFCBARCODE=1
|
|
|
|
SKIP_HFSNIFF=1
|
|
|
|
SKIP_HFPLOT=1
|
2021-12-24 22:24:32 +08:00
|
|
|
SKIP_ZX8211=1
|
2019-03-11 07:21:14 +08:00
|
|
|
endef
|
|
|
|
|
2019-07-17 01:18:45 +08:00
|
|
|
define KNOWN_DEFINITIONS
|
|
|
|
$(KNOWN_PLATFORM_DEFINITIONS)
|
|
|
|
$(KNOWN_STANDALONE_DEFINITIONS)
|
|
|
|
$(HELP_DEFINITIONS)
|
|
|
|
endef
|
|
|
|
|
2019-03-11 07:21:14 +08:00
|
|
|
PLTNAME = Unknown Platform
|
2021-08-22 05:43:06 +08:00
|
|
|
PLATFORM_FPGA = fpga-undefined
|
2019-03-11 07:21:14 +08:00
|
|
|
|
|
|
|
ifeq ($(PLATFORM),PM3RDV4)
|
2020-02-12 17:29:00 +08:00
|
|
|
PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH -DRDV4
|
2021-01-14 21:23:00 +08:00
|
|
|
PLTNAME = Proxmark3 RDV4
|
2021-08-22 05:43:06 +08:00
|
|
|
PLATFORM_FPGA = xc2s30
|
2019-08-22 02:06:14 +08:00
|
|
|
else ifeq ($(PLATFORM),PM3OTHER)
|
2021-01-14 21:41:08 +08:00
|
|
|
$(warning PLATFORM=PM3OTHER is deprecated, please use PLATFORM=PM3GENERIC)
|
2021-01-14 21:23:00 +08:00
|
|
|
PLTNAME = Proxmark3 generic target
|
2021-08-22 05:43:06 +08:00
|
|
|
PLATFORM_FPGA = xc2s30
|
2021-01-14 21:23:00 +08:00
|
|
|
else ifeq ($(PLATFORM),PM3GENERIC)
|
|
|
|
PLTNAME = Proxmark3 generic target
|
2021-08-22 05:43:06 +08:00
|
|
|
PLATFORM_FPGA = xc2s30
|
|
|
|
else ifeq ($(PLATFORM),PM3ICOPYX)
|
|
|
|
PLATFORM_DEFS = -DWITH_FLASH -DICOPYX -DXC3
|
|
|
|
PLTNAME = iCopy-X with XC3S100E
|
|
|
|
PLATFORM_FPGA = xc3s100e
|
2021-01-14 21:23:00 +08:00
|
|
|
|
2019-03-11 07:21:14 +08:00
|
|
|
else
|
2019-06-01 06:23:38 +08:00
|
|
|
$(error Invalid or empty PLATFORM: $(PLATFORM). $(KNOWN_DEFINITIONS))
|
2019-03-11 07:21:14 +08:00
|
|
|
endif
|
|
|
|
|
2019-05-04 04:30:17 +08:00
|
|
|
# parsing additional PLATFORM_EXTRAS tokens
|
|
|
|
PLATFORM_EXTRAS_TMP:=$(PLATFORM_EXTRAS)
|
|
|
|
ifneq (,$(findstring BTADDON,$(PLATFORM_EXTRAS_TMP)))
|
2019-05-07 02:45:59 +08:00
|
|
|
PLATFORM_DEFS += -DWITH_FPC_USART_HOST
|
|
|
|
PLATFORM_EXTRAS_TMP := $(strip $(filter-out BTADDON,$(PLATFORM_EXTRAS_TMP)))
|
2019-05-04 04:30:17 +08:00
|
|
|
endif
|
|
|
|
ifneq (,$(findstring FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
|
2019-05-07 02:45:59 +08:00
|
|
|
PLATFORM_DEFS += -DWITH_FPC_USART_DEV
|
|
|
|
PLATFORM_EXTRAS_TMP := $(strip $(filter-out FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
|
2019-05-04 04:30:17 +08:00
|
|
|
endif
|
|
|
|
ifneq (,$(PLATFORM_EXTRAS_TMP))
|
2019-05-07 02:45:59 +08:00
|
|
|
$(error Unknown PLATFORM_EXTRAS token(s): $(PLATFORM_EXTRAS_TMP))
|
2019-05-04 04:30:17 +08:00
|
|
|
endif
|
|
|
|
|
2019-04-26 04:15:16 +08:00
|
|
|
# common LF support
|
2020-11-05 09:33:01 +08:00
|
|
|
ifneq ($(SKIP_LF),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_LF
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_HITAG),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_HITAG
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_EM4x50),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_EM4x50
|
|
|
|
endif
|
2020-12-06 06:47:03 +08:00
|
|
|
ifneq ($(SKIP_EM4x70),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_EM4x70
|
|
|
|
endif
|
2021-12-24 20:32:28 +08:00
|
|
|
ifneq ($(SKIP_ZX8211),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_ZX8211
|
|
|
|
endif
|
2019-04-26 04:15:16 +08:00
|
|
|
|
|
|
|
# common HF support
|
2022-06-25 05:36:42 +08:00
|
|
|
ifneq ($(SKIP_HF),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_GENERAL_HF
|
|
|
|
endif
|
2020-11-05 09:33:01 +08:00
|
|
|
ifneq ($(SKIP_ISO15693),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_ISO15693
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_LEGICRF),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_LEGICRF
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_ISO14443b),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_ISO14443b
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_ISO14443a),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_ISO14443a
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_ICLASS),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_ICLASS
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_FELICA),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_FELICA
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_NFCBARCODE),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_NFCBARCODE
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_HFSNIFF),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_HFSNIFF
|
|
|
|
endif
|
|
|
|
ifneq ($(SKIP_HFPLOT),1)
|
|
|
|
PLATFORM_DEFS += -DWITH_HFPLOT
|
|
|
|
endif
|
2020-12-29 05:48:41 +08:00
|
|
|
ifeq ($(SKIP_COMPRESSION),1)
|
2020-12-30 07:19:21 +08:00
|
|
|
PLATFORM_DEFS += -DWITH_NO_COMPRESSION
|
2020-12-29 05:48:41 +08:00
|
|
|
endif
|
2019-08-04 03:17:52 +08:00
|
|
|
|
2019-04-26 04:15:16 +08:00
|
|
|
# Standalone mode
|
2019-07-24 19:37:09 +08:00
|
|
|
ifneq ($(strip $(filter $(PLATFORM_DEFS),$(STANDALONE_REQ_DEFS))),$(strip $(STANDALONE_REQ_DEFS)))
|
|
|
|
$(error Chosen Standalone mode $(STANDALONE) requires $(strip $(STANDALONE_REQ_DEFS)), unsupported by $(PLTNAME))
|
|
|
|
endif
|
2020-12-01 08:23:36 +08:00
|
|
|
ifneq (,$(STANDALONE_PLATFORM_DEFS))
|
|
|
|
PLATFORM_DEFS+=$(STANDALONE_PLATFORM_DEFS)
|
|
|
|
endif
|
2019-04-26 04:15:16 +08:00
|
|
|
|
|
|
|
$(info $(findstring WITH_STANDALONE_*,$(PLATFORM_DEFS)))
|
|
|
|
|
2020-11-30 19:25:53 +08:00
|
|
|
# Misc (LCD support)
|
|
|
|
ifneq (,$(findstring WITH_LCD,$(PLATFORM_DEFS)))
|
|
|
|
#PLATFORM_DEFS += -DWITH_LCD
|
|
|
|
endif
|
2019-04-26 04:15:16 +08:00
|
|
|
|
|
|
|
# Add flags dependencies :
|
|
|
|
|
2019-05-04 04:30:17 +08:00
|
|
|
# WITH_FPC_USART_* needs WITH_FPC_USART :
|
|
|
|
ifneq (,$(findstring WITH_FPC_USART_,$(PLATFORM_DEFS)))
|
2019-05-07 02:45:59 +08:00
|
|
|
PLATFORM_DEFS += -DWITH_FPC_USART
|
2019-04-03 04:06:10 +08:00
|
|
|
endif
|
2019-04-26 04:15:16 +08:00
|
|
|
|
|
|
|
PLATFORM_DEFS_INFO = $(strip $(filter-out STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS))))
|
|
|
|
PLATFORM_DEFS_INFO_STANDALONE = $(strip $(subst STANDALONE_,, $(filter STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS)))))
|
|
|
|
|
|
|
|
# Check that only one Standalone mode has been chosen
|
|
|
|
ifneq (,$(word 2, $(PLATFORM_DEFS_INFO_STANDALONE)))
|
2019-05-07 02:45:59 +08:00
|
|
|
$(error You must choose only one Standalone mode!: $(PLATFORM_DEFS_INFO_STANDALONE))
|
2019-04-26 04:15:16 +08:00
|
|
|
endif
|
|
|
|
|
2019-06-02 21:51:17 +08:00
|
|
|
PLATFORM_EXTRAS_INFO = $(PLATFORM_EXTRAS)
|
|
|
|
# info when no extra
|
|
|
|
ifeq (,$(PLATFORM_EXTRAS_INFO))
|
|
|
|
PLATFORM_EXTRAS_INFO = No extra selected
|
|
|
|
endif
|
|
|
|
|
2019-06-02 16:17:52 +08:00
|
|
|
# info when no standalone mode
|
|
|
|
ifeq (,$(PLATFORM_DEFS_INFO_STANDALONE))
|
|
|
|
PLATFORM_DEFS_INFO_STANDALONE = No standalone mode selected
|
|
|
|
endif
|
2019-04-03 04:06:10 +08:00
|
|
|
|
2020-11-05 09:32:41 +08:00
|
|
|
ifeq ($(PLATFORM_SIZE),)
|
|
|
|
PLATFORM_SIZE=512
|
|
|
|
endif
|
|
|
|
|
2019-06-01 07:37:02 +08:00
|
|
|
PLATFORM_CHANGED=false
|
|
|
|
ifneq ($(PLATFORM), $(CACHED_PLATFORM))
|
|
|
|
PLATFORM_CHANGED=true
|
|
|
|
else ifneq ($(PLATFORM_EXTRAS), $(CACHED_PLATFORM_EXTRAS))
|
|
|
|
PLATFORM_CHANGED=true
|
|
|
|
else ifneq ($(PLATFORM_DEFS), $(CACHED_PLATFORM_DEFS))
|
|
|
|
PLATFORM_CHANGED=true
|
|
|
|
endif
|
2019-06-02 04:49:28 +08:00
|
|
|
|
2019-07-17 01:18:45 +08:00
|
|
|
export PLATFORM
|
|
|
|
export PLATFORM_EXTRAS
|
|
|
|
export PLATFORM_EXTRAS_INFO
|
2020-11-05 09:32:41 +08:00
|
|
|
export PLATFORM_SIZE
|
2019-07-17 01:18:45 +08:00
|
|
|
export PLTNAME
|
2021-08-22 05:43:06 +08:00
|
|
|
export PLATFORM_FPGA
|
2019-07-17 01:18:45 +08:00
|
|
|
export PLATFORM_DEFS
|
|
|
|
export PLATFORM_DEFS_INFO
|
|
|
|
export PLATFORM_DEFS_INFO_STANDALONE
|
|
|
|
export PLATFORM_CHANGED
|
|
|
|
|
2019-06-02 04:49:28 +08:00
|
|
|
$(info ===================================================================)
|
2021-09-05 07:18:42 +08:00
|
|
|
$(info Version info: $(shell tools/mkversion.sh --short 2>/dev/null || ../tools/mkversion.sh --short 2>/dev/null))
|
2019-06-02 04:49:28 +08:00
|
|
|
$(info Platform name: $(PLTNAME))
|
|
|
|
$(info PLATFORM: $(PLATFORM))
|
2021-08-22 05:43:06 +08:00
|
|
|
$(info PLATFORM_FPGA: $(PLATFORM_FPGA))
|
2020-11-05 09:32:41 +08:00
|
|
|
$(info PLATFORM_SIZE: $(PLATFORM_SIZE))
|
2019-06-02 21:51:17 +08:00
|
|
|
$(info Platform extras: $(PLATFORM_EXTRAS_INFO))
|
2019-06-02 04:49:28 +08:00
|
|
|
$(info Included options: $(PLATFORM_DEFS_INFO))
|
|
|
|
$(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE))
|
|
|
|
$(info ===================================================================)
|