diff --git a/Firmware/ChameleonMini/Application/MifareClassic.c b/Firmware/ChameleonMini/Application/MifareClassic.c
index c68c1c9..8eed342 100644
--- a/Firmware/ChameleonMini/Application/MifareClassic.c
+++ b/Firmware/ChameleonMini/Application/MifareClassic.c
@@ -7,6 +7,10 @@
*
*/
+#if defined(CONFIG_MF_CLASSIC_SUPPORT) || defined(CONFIG_MF_CLASSIC_DETECTION_SUPPORT) \
+ || defined(CONFIG_MF_CLASSIC_BRUTE_SUPPORT) || defined(SUPPORT_MF_CLASSIC_MAGIC_MODE) \
+ || defined(CONFIG_MF_CLASSIC_LOG_SUPPORT)
+
#include "MifareClassic.h"
#include "ISO14443-3A.h"
#include "Crypto1.h"
@@ -334,11 +338,9 @@ void MifareClassicAppInit4K(void) {
(ActiveConfiguration.UidSize == MFCLASSIC_UID_7B_SIZE) );
}
-#ifdef CONFIG_MF_CLASSIC_MINI_SUPPORT
void MifareClassicAppInitMini(void) {
MifareClassicAppInit(MFCLASSIC_MINI_ATQA_VALUE, MFCLASSIC_MINI_SAK_VALUE, false);
}
-#endif
#ifdef CONFIG_MF_CLASSIC_DETECTION_SUPPORT
void MifareClassicAppDetectionInit(void) {
@@ -505,11 +507,6 @@ void MifareClassicAppReset(void) {
State = STATE_IDLE;
}
-void MifareClassicAppTask(void) {
-
-}
-
-
/* Handle a MFCLASSIC_CMD_HALT during main process, as can be raised in many states.
* Sets State, response buffer and response size. Returns if valid HALT. */
bool mfcHandleHaltCommand(uint8_t * Buffer, uint16_t * RetValue) {
@@ -1028,3 +1025,5 @@ void MifareClassicGetSak(uint8_t * Sak) {
void MifareClassicSetSak(uint8_t Sak) {
CardSAKValue = Sak;
}
+
+#endif /* Compilation support */
diff --git a/Firmware/ChameleonMini/Application/MifareClassic.h b/Firmware/ChameleonMini/Application/MifareClassic.h
index e2fb9c8..b2136b5 100644
--- a/Firmware/ChameleonMini/Application/MifareClassic.h
+++ b/Firmware/ChameleonMini/Application/MifareClassic.h
@@ -7,6 +7,10 @@
*
*/
+#if defined(CONFIG_MF_CLASSIC_SUPPORT) || defined(CONFIG_MF_CLASSIC_DETECTION_SUPPORT) \
+ || defined(CONFIG_MF_CLASSIC_BRUTE_SUPPORT) || defined(SUPPORT_MF_CLASSIC_MAGIC_MODE) \
+ || defined(CONFIG_MF_CLASSIC_LOG_SUPPORT)
+
#ifndef MIFARECLASSIC_H_
#define MIFARECLASSIC_H_
@@ -17,9 +21,7 @@
#define MFCLASSIC_UID_7B_SIZE ISO14443A_UID_SIZE_DOUBLE
#define MFCLASSIC_1K_MEM_SIZE 1024
#define MFCLASSIC_4K_MEM_SIZE 4096
-#ifdef CONFIG_MF_CLASSIC_MINI_SUPPORT
#define MFCLASSIC_MINI_MEM_SIZE 320
-#endif
#define MFCLASSIC_1K_ATQA_VALUE 0x0004
#define MFCLASSIC_1K_7B_ATQA_VALUE 0x0044
@@ -28,10 +30,8 @@
#define MFCLASSIC_7B_ATQA_MASK 0x40
#define MFCLASSIC_1K_SAK_VALUE 0x08
#define MFCLASSIC_4K_SAK_VALUE 0x18
-#ifdef CONFIG_MF_CLASSIC_MINI_SUPPORT
#define MFCLASSIC_MINI_ATQA_VALUE MFCLASSIC_1K_ATQA_VALUE
#define MFCLASSIC_MINI_SAK_VALUE 0x09
-#endif
#define MFCLASSIC_SAK_CL1_VALUE ISO14443A_SAK_INCOMPLETE
#define MFCLASSIC_MEM_S0B0_ADDRESS 0x00
@@ -214,8 +214,8 @@ C1 C2 C3 read write increment decrement,
void MifareClassicAppInit1K(void);
void MifareClassicAppInit4K(void);
+void MifareClassicAppInitMini(void);
void MifareClassicAppReset(void);
-void MifareClassicAppTask(void);
uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount);
@@ -228,10 +228,6 @@ void MifareClassicSetAtqa(uint16_t Atqa);
void MifareClassicGetSak(uint8_t * Sak);
void MifareClassicSetSak(uint8_t Sak);
-#ifdef CONFIG_MF_CLASSIC_MINI_SUPPORT
-void MifareClassicAppInitMini(void);
-#endif
-
#ifdef CONFIG_MF_CLASSIC_DETECTION_SUPPORT
void MifareClassicAppDetectionInit(void);
#endif
@@ -249,3 +245,5 @@ void MifareClassicAppLogToggle(void);
#endif
#endif /* MIFARECLASSIC_H_ */
+
+#endif /* Compilation support */
diff --git a/Firmware/ChameleonMini/ChameleonMini.cproj b/Firmware/ChameleonMini/ChameleonMini.cproj
index acfc04b..c69534c 100644
--- a/Firmware/ChameleonMini/ChameleonMini.cproj
+++ b/Firmware/ChameleonMini/ChameleonMini.cproj
@@ -222,8 +222,7 @@
DEFAULT_BUTTON_ACTION=BUTTON_ACTION_CYCLE_SETTINGS
DEFAULT_BUTTON_LONG_ACTION=BUTTON_ACTION_CYCLE_SETTINGS
CONFIG_MF_ULTRALIGHT_SUPPORT
- CONFIG_MF_CLASSIC_1K_SUPPORT
- CONFIG_MF_CLASSIC_4K_SUPPORT
+ CONFIG_MF_CLASSIC_SUPPORT
CONFIG_MF_CLASSIC_DETECTION_SUPPORT
SUPPORT_FIRMWARE_UPGRADE
@@ -281,8 +280,7 @@
DEFAULT_BUTTON_ACTION=BUTTON_ACTION_CYCLE_SETTINGS
DEFAULT_BUTTON_LONG_ACTION=BUTTON_ACTION_CYCLE_SETTINGS
CONFIG_MF_ULTRALIGHT_SUPPORT
- CONFIG_MF_CLASSIC_1K_SUPPORT
- CONFIG_MF_CLASSIC_4K_SUPPORT
+ CONFIG_MF_CLASSIC_SUPPORT
CONFIG_MF_CLASSIC_DETECTION_SUPPORT
SUPPORT_FIRMWARE_UPGRADE
diff --git a/Firmware/ChameleonMini/Configuration.c b/Firmware/ChameleonMini/Configuration.c
index fb057b7..597dca8 100644
--- a/Firmware/ChameleonMini/Configuration.c
+++ b/Firmware/ChameleonMini/Configuration.c
@@ -19,19 +19,11 @@ static const MapEntryType ConfigurationMap[] PROGMEM = {
{ .Id = CONFIG_MF_ULTRALIGHT_EV1_80B, .Text = "MF_ULTRALIGHT_EV1_80B" },
{ .Id = CONFIG_MF_ULTRALIGHT_EV1_164B, .Text = "MF_ULTRALIGHT_EV1_164B" },
#endif
-#ifdef CONFIG_MF_CLASSIC_1K_SUPPORT
+#ifdef CONFIG_MF_CLASSIC_SUPPORT
{ .Id = CONFIG_MF_CLASSIC_1K, .Text = "MF_CLASSIC_1K" },
-#endif
-#ifdef CONFIG_MF_CLASSIC_1K_7B_SUPPORT
{ .Id = CONFIG_MF_CLASSIC_1K_7B, .Text = "MF_CLASSIC_1K_7B" },
-#endif
-#ifdef CONFIG_MF_CLASSIC_4K_SUPPORT
{ .Id = CONFIG_MF_CLASSIC_4K, .Text = "MF_CLASSIC_4K" },
-#endif
-#ifdef CONFIG_MF_CLASSIC_4K_7B_SUPPORT
{ .Id = CONFIG_MF_CLASSIC_4K_7B, .Text = "MF_CLASSIC_4K_7B" },
-#endif
-#ifdef CONFIG_MF_CLASSIC_MINI_SUPPORT
{ .Id = CONFIG_MF_CLASSIC_MINI, .Text = "MF_CLASSIC_MINI" },
#endif
#ifdef CONFIG_MF_CLASSIC_DETECTION_SUPPORT
@@ -147,13 +139,13 @@ static const PROGMEM ConfigurationType ConfigurationTable[] = {
.ReadOnly = false
},
#endif
-#ifdef CONFIG_MF_CLASSIC_1K_SUPPORT
+#ifdef CONFIG_MF_CLASSIC_SUPPORT
[CONFIG_MF_CLASSIC_1K] = {
.CodecInitFunc = ISO14443ACodecInit,
.CodecTaskFunc = ISO14443ACodecTask,
.ApplicationInitFunc = MifareClassicAppInit1K,
.ApplicationResetFunc = MifareClassicAppReset,
- .ApplicationTaskFunc = MifareClassicAppTask,
+ .ApplicationTaskFunc = ApplicationTaskDummy,
.ApplicationTickFunc = ApplicationTickDummy,
.ApplicationButtonFunc = ApplicationButtonFuncDummy,
.ApplicationProcessFunc = MifareClassicAppProcess,
@@ -168,14 +160,12 @@ static const PROGMEM ConfigurationType ConfigurationTable[] = {
.WorkingMemorySize = MEMORY_NO_MEMORY,
.ReadOnly = false
},
-#endif
-#ifdef CONFIG_MF_CLASSIC_1K_7B_SUPPORT
[CONFIG_MF_CLASSIC_1K_7B] = {
.CodecInitFunc = ISO14443ACodecInit,
.CodecTaskFunc = ISO14443ACodecTask,
.ApplicationInitFunc = MifareClassicAppInit1K,
.ApplicationResetFunc = MifareClassicAppReset,
- .ApplicationTaskFunc = MifareClassicAppTask,
+ .ApplicationTaskFunc = ApplicationTaskDummy,
.ApplicationTickFunc = ApplicationTickDummy,
.ApplicationButtonFunc = ApplicationButtonFuncDummy,
.ApplicationProcessFunc = MifareClassicAppProcess,
@@ -190,14 +180,12 @@ static const PROGMEM ConfigurationType ConfigurationTable[] = {
.WorkingMemorySize = MEMORY_NO_MEMORY,
.ReadOnly = false
},
-#endif
-#ifdef CONFIG_MF_CLASSIC_4K_SUPPORT
[CONFIG_MF_CLASSIC_4K] = {
.CodecInitFunc = ISO14443ACodecInit,
.CodecTaskFunc = ISO14443ACodecTask,
.ApplicationInitFunc = MifareClassicAppInit4K,
.ApplicationResetFunc = MifareClassicAppReset,
- .ApplicationTaskFunc = MifareClassicAppTask,
+ .ApplicationTaskFunc = ApplicationTaskDummy,
.ApplicationTickFunc = ApplicationTickDummy,
.ApplicationButtonFunc = ApplicationButtonFuncDummy,
.ApplicationProcessFunc = MifareClassicAppProcess,
@@ -212,14 +200,12 @@ static const PROGMEM ConfigurationType ConfigurationTable[] = {
.WorkingMemorySize = MEMORY_NO_MEMORY,
.ReadOnly = false
},
-#endif
-#ifdef CONFIG_MF_CLASSIC_4K_7B_SUPPORT
[CONFIG_MF_CLASSIC_4K_7B] = {
.CodecInitFunc = ISO14443ACodecInit,
.CodecTaskFunc = ISO14443ACodecTask,
.ApplicationInitFunc = MifareClassicAppInit4K,
.ApplicationResetFunc = MifareClassicAppReset,
- .ApplicationTaskFunc = MifareClassicAppTask,
+ .ApplicationTaskFunc = ApplicationTaskDummy,
.ApplicationTickFunc = ApplicationTickDummy,
.ApplicationButtonFunc = ApplicationButtonFuncDummy,
.ApplicationProcessFunc = MifareClassicAppProcess,
@@ -234,14 +220,12 @@ static const PROGMEM ConfigurationType ConfigurationTable[] = {
.WorkingMemorySize = MEMORY_NO_MEMORY,
.ReadOnly = false
},
-#endif
-#ifdef CONFIG_MF_CLASSIC_MINI_SUPPORT
[CONFIG_MF_CLASSIC_MINI] = {
.CodecInitFunc = ISO14443ACodecInit,
.CodecTaskFunc = ISO14443ACodecTask,
.ApplicationInitFunc = MifareClassicAppInitMini,
.ApplicationResetFunc = MifareClassicAppReset,
- .ApplicationTaskFunc = MifareClassicAppTask,
+ .ApplicationTaskFunc = ApplicationTaskDummy,
.ApplicationTickFunc = ApplicationTickDummy,
.ApplicationButtonFunc = ApplicationButtonFuncDummy,
.ApplicationProcessFunc = MifareClassicAppProcess,
diff --git a/Firmware/ChameleonMini/Configuration.h b/Firmware/ChameleonMini/Configuration.h
index 124cfb0..8b53599 100644
--- a/Firmware/ChameleonMini/Configuration.h
+++ b/Firmware/ChameleonMini/Configuration.h
@@ -29,19 +29,11 @@ typedef enum {
CONFIG_MF_ULTRALIGHT_EV1_80B,
CONFIG_MF_ULTRALIGHT_EV1_164B,
#endif
-#ifdef CONFIG_MF_CLASSIC_1K_SUPPORT
+#ifdef CONFIG_MF_CLASSIC_SUPPORT
CONFIG_MF_CLASSIC_1K,
-#endif
-#ifdef CONFIG_MF_CLASSIC_1K_7B_SUPPORT
CONFIG_MF_CLASSIC_1K_7B,
-#endif
-#ifdef CONFIG_MF_CLASSIC_4K_SUPPORT
CONFIG_MF_CLASSIC_4K,
-#endif
-#ifdef CONFIG_MF_CLASSIC_4K_7B_SUPPORT
CONFIG_MF_CLASSIC_4K_7B,
-#endif
-#ifdef CONFIG_MF_CLASSIC_MINI_SUPPORT
CONFIG_MF_CLASSIC_MINI,
#endif
#ifdef CONFIG_MF_CLASSIC_DETECTION_SUPPORT
diff --git a/Firmware/ChameleonMini/Makefile b/Firmware/ChameleonMini/Makefile
index 6552653..674876d 100644
--- a/Firmware/ChameleonMini/Makefile
+++ b/Firmware/ChameleonMini/Makefile
@@ -16,14 +16,8 @@ PYTHON_BIN = /usr/bin/env python3
CRYPTO_TOOL = ../../Software/Tools/crypt_operations.py
#Supported configurations
-SETTINGS += -DCONFIG_MF_CLASSIC_1K_SUPPORT
-SETTINGS += -DCONFIG_MF_CLASSIC_1K_7B_SUPPORT
-SETTINGS += -DCONFIG_MF_CLASSIC_4K_SUPPORT
-SETTINGS += -DCONFIG_MF_CLASSIC_4K_7B_SUPPORT
-SETTINGS += -DCONFIG_MF_CLASSIC_MINI_SUPPORT
+SETTINGS += -DCONFIG_MF_CLASSIC_SUPPORT
SETTINGS += -DCONFIG_MF_ULTRALIGHT_SUPPORT
-#SETTINGS += -DCONFIG_ISO14443A_SNIFF_SUPPORT
-#SETTINGS += -DCONFIG_ISO14443A_READER_SUPPORT
SETTINGS += -DCONFIG_MF_CLASSIC_DETECTION_SUPPORT
SETTINGS += -DCONFIG_MF_CLASSIC_BRUTE_SUPPORT
SETTINGS += -DCONFIG_MF_CLASSIC_LOG_SUPPORT
@@ -31,54 +25,21 @@ SETTINGS += -DCONFIG_MF_CLASSIC_LOG_SUPPORT
#Support magic mode on mifare classic configuration
#SETTINGS += -DSUPPORT_MF_CLASSIC_MAGIC_MODE
-#Don't touch manufacturer byte with BUTTON_ACTION_UID_LEFT_(DE/IN)CREMENT
-#SETTINGS += -DSUPPORT_UID7_FIX_MANUFACTURER_BYTE
-
#Support activating firmware upgrade mode through command-line
SETTINGS += -DSUPPORT_FIRMWARE_UPGRADE
#Enable the MEMORYTEST and/or MEMORYINFO commands to help with memory management debug
-#SETTINGS += -DCONFIG_DEBUG_MEMORYTEST_COMMAND
-#SETTINGS += -DCONFIG_DEBUG_MEMORYINFO_COMMAND
+SETTINGS += -DCONFIG_DEBUG_MEMORYTEST_COMMAND
+SETTINGS += -DCONFIG_DEBUG_MEMORYINFO_COMMAND
#Default configuration
SETTINGS += -DDEFAULT_CONFIGURATION=CONFIG_NONE
-#SETTINGS += -DDEFAULT_CONFIGURATION=CONFIG_MF_CLASSIC_1K
-#SETTINGS += -DDEFAULT_CONFIGURATION=CONFIG_MF_CLASSIC_4K
-#SETTINGS += -DDEFAULT_CONFIGURATION=CONFIG_MF_ULTRALIGHT
-#SETTINGS += -DDEFAULT_CONFIGURATION=CONFIG_ISO14443A_READER
#Default button actions
-#SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_NONE
-#SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_UID_RANDOM
-#SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_UID_LEFT_INCREMENT
-#SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_UID_RIGHT_INCREMENT
-#SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_UID_LEFT_DECREMENT
-#SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_UID_RIGHT_DECREMENT
SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_CYCLE_SETTINGS
-#SETTINGS += -DDEFAULT_BUTTON_ACTION=BUTTON_ACTION_STORE_MEM
-
#Default long button action
SETTINGS += -DDEFAULT_BUTTON_LONG_ACTION=BUTTON_ACTION_NONE
-#Define if button action setting should be independent of active setting
-#SETTINGS += -DBUTTON_SETTING_GLOBAL
-
-#Default LED functions
-#SETTINGS += -DDEFAULT_RED_LED_ACTION=LED_SETTING_CHANGE
-#SETTINGS += -DDEFAULT_GREEN_LED_ACTION=LED_POWERED
-
-#Define if LED function setting should be independent of active setting
-#SETTINGS += -DLED_SETTING_GLOBAL
-
-#Default logging mode
-#SETTINGS += -DDEFAULT_LOG_MODE=LOG_MODE_OFF
-#SETTINGS += -DDEFAULT_LOG_MODE=LOG_MODE_MEMORY
-#SETTINGS += -DDEFAULT_LOG_MODE=LOG_MODE_TERMINAL
-
-#Define if log settings should be global
-#SETTINGS += -DLOG_SETTING_GLOBAL
-
#Default setting
SETTINGS += -DDEFAULT_SETTING=0
diff --git a/Firmware/ChameleonMini/Memory/Memory.h b/Firmware/ChameleonMini/Memory/Memory.h
index df812ef..0ba7da0 100644
--- a/Firmware/ChameleonMini/Memory/Memory.h
+++ b/Firmware/ChameleonMini/Memory/Memory.h
@@ -18,7 +18,7 @@
#define MEMORY_NO_MEMORY 0x00
#define MEMORY_ALL_MEMORY 0xFFFFFFFF
#define MEMORY_NO_ADDR 0
-#ifdef CONFIG_MF_CLASSIC_4K_SUPPORT
+#ifdef CONFIG_MF_CLASSIC_SUPPORT
#define MEMORY_MIN_BYTES_PER_APP MFCLASSIC_4K_MEM_SIZE
#else
#define MEMORY_MIN_BYTES_PER_APP 512