From 199c3f107c619c02b744352eca2c2cd4b42cc718 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 16 Sep 2026 10:32:48 +0200 Subject: [PATCH] fix image too large for 256kb devices by adding guards --- CHANGELOG.md | 1 + armsrc/CMakeLists.txt | 4 ++++ armsrc/Makefile | 6 +++++- armsrc/appmain.c | 4 ++++ common_arm/Hal.cmake | 3 +++ common_arm/Makefile.hal | 4 ++++ tools/build_all_firmwares.sh | 2 +- 7 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc6b64ebd..289682230 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed build too large for 256kb images by guarding WITH_DESFIRE_SIM (@iceman1001) - Fixed `pm3 flash` - the progress bar no longer keeps SIGINT after it finishes, CTRL-C works again afterwards (@iceman1001) - Fixed `CTRL-C` / `CTRL-Z` - the client owns its signals instead of letting readline re-raise them, CTRL-C quits cleanly saving the history and CTRL-Z suspends reliably (@iceman1001) - Fixed `CTRL-C` / `CTRL-Z` - readline re-raised caught signals to itself, which in a threaded client looped instead of quitting or suspending (@iceman1001) diff --git a/armsrc/CMakeLists.txt b/armsrc/CMakeLists.txt index 6916590c2..2603e7acb 100644 --- a/armsrc/CMakeLists.txt +++ b/armsrc/CMakeLists.txt @@ -104,6 +104,10 @@ set(SRC_ISO14443a sam_sc.c ) +if (NOT SKIP_DESFIRE_SIM) + list(APPEND SRC_ISO14443a desfiresim.c) +endif () + #UNUSED: mifaresniff.c set(SRC_ISO14443b iso14443b.c) diff --git a/armsrc/Makefile b/armsrc/Makefile index 18ed75271..931370c4c 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -72,7 +72,11 @@ endif SRC_LF = lfops.c lfsampling.c pcf7931.c lfdemod.c lfadc.c SRC_HF = hfops.c SRC_ISO15693 = iso15693.c iso15693tools.c -SRC_ISO14443a = iso14443a.c secc.c mifareutil.c mifarecmd.c epa.c mifaresim.c desfiresim.c +SRC_ISO14443a = iso14443a.c secc.c mifareutil.c mifarecmd.c epa.c mifaresim.c + +ifneq (,$(findstring WITH_DESFIRE_SIM,$(APP_CFLAGS))) + SRC_ISO14443a += desfiresim.c +endif ifneq (,$(findstring WITH_SMARTCARD,$(APP_CFLAGS))) SRC_ISO14443a += sam_common.c sam_mfc.c sam_seos.c sam_sc.c diff --git a/armsrc/appmain.c b/armsrc/appmain.c index a6aad1b49..75bc937db 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -68,7 +68,9 @@ #include "mifarecmd.h" #include "mifaredesfire.h" #include "mifaresim.h" +#ifdef WITH_DESFIRE_SIM #include "desfiresim.h" +#endif #include "emvsim.h" #include "pcf7931.h" #include "Standalone/standalone.h" @@ -2549,10 +2551,12 @@ static void PacketReceived(PacketCommandNG *packet) { Mifare1ksim(payload->flags, payload->exitAfter, payload->uid, payload->atqa, payload->sak); break; } +#ifdef WITH_DESFIRE_SIM case CMD_HF_DESFIRE_SIMULATE: { SimulateDesfireTag(); break; } +#endif case CMD_HF_MIFARE_EML_MEMCLR: { //----------------------------------------------------------------------------- diff --git a/common_arm/Hal.cmake b/common_arm/Hal.cmake index 64299887b..6cde005c0 100644 --- a/common_arm/Hal.cmake +++ b/common_arm/Hal.cmake @@ -151,6 +151,9 @@ endif () if (NOT SKIP_ISO14443a) list(APPEND PLATFORM_DEFS -DWITH_ISO14443a) endif () +if (NOT SKIP_DESFIRE_SIM) + list(APPEND PLATFORM_DEFS -DWITH_DESFIRE_SIM) +endif () if (NOT SKIP_ICLASS) list(APPEND PLATFORM_DEFS -DWITH_ICLASS) endif () diff --git a/common_arm/Makefile.hal b/common_arm/Makefile.hal index a661c58d1..ca575e6d4 100644 --- a/common_arm/Makefile.hal +++ b/common_arm/Makefile.hal @@ -88,6 +88,7 @@ SKIP_ISO15693=1 SKIP_LEGICRF=1 SKIP_ISO14443b=1 SKIP_ISO14443a=1 +SKIP_DESFIRE_SIM=1 SKIP_ICLASS=1 SKIP_FELICA=1 SKIP_NFCBARCODE=1 @@ -278,6 +279,9 @@ endif ifneq ($(SKIP_ISO14443a),1) PLATFORM_DEFS += -DWITH_ISO14443a endif +ifneq ($(SKIP_DESFIRE_SIM),1) + PLATFORM_DEFS += -DWITH_DESFIRE_SIM +endif ifneq ($(SKIP_ICLASS),1) PLATFORM_DEFS += -DWITH_ICLASS endif diff --git a/tools/build_all_firmwares.sh b/tools/build_all_firmwares.sh index 419ad0fc0..33f42c6b7 100755 --- a/tools/build_all_firmwares.sh +++ b/tools/build_all_firmwares.sh @@ -22,7 +22,7 @@ echo "Destination: ${DEST:=firmware}" echo "Produce stats?: ${STATS:=false}" # Which parts to skip for the 256kb version? -SKIPS256="SKIP_HITAG=1 SKIP_LEGICRF=1 SKIP_FELICA=1 SKIP_EM4x50=1 SKIP_ISO14443b=1 SKIP_NFCBARCODE=1 SKIP_ZX8211=1 SKIP_LF=1" +SKIPS256="SKIP_HITAG=1 SKIP_LEGICRF=1 SKIP_FELICA=1 SKIP_EM4x50=1 SKIP_EM4x70=1 SKIP_ISO14443b=1 SKIP_NFCBARCODE=1 SKIP_ZX8211=1 SKIP_LF=1 SKIP_DESFIRE_SIM=1" make $MKFLAGS bootrom || exit 1 chmod 644 bootrom/obj/bootrom.elf