From c616f47d6b6bf0a62034b8b814848dd9aebdd6f5 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 25 Apr 2019 22:40:46 +0200 Subject: [PATCH 1/2] Use placeholder for standalone mode if needed --- armsrc/Makefile | 2 +- armsrc/Standalone/placeholder.c | 9 +++++++++ armsrc/appmain.c | 8 -------- 3 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 armsrc/Standalone/placeholder.c diff --git a/armsrc/Makefile b/armsrc/Makefile index d03448293..29f5505e3 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -77,7 +77,7 @@ endif # Generic standalone Mode injection of source code -SRC_STANDALONE = +SRC_STANDALONE = placeholder.c # WITH_STANDALONE_LF_ICERUN ifneq (,$(findstring WITH_STANDALONE_LF_ICERUN,$(APP_CFLAGS))) SRC_STANDALONE = lf_icerun.c diff --git a/armsrc/Standalone/placeholder.c b/armsrc/Standalone/placeholder.c new file mode 100644 index 000000000..e179bc876 --- /dev/null +++ b/armsrc/Standalone/placeholder.c @@ -0,0 +1,9 @@ +#include "standalone.h" // standalone definitions +#include "apps.h" // debug statements + +void ModInfo(void) { + DbpString(" No standalone mode present"); +} + +void RunMod() { +} diff --git a/armsrc/appmain.c b/armsrc/appmain.c index b6bba90d6..8c42a6017 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1549,16 +1549,8 @@ void __attribute__((noreturn)) AppMain(void) { /* * So this is the trigger to execute a standalone mod. Generic entrypoint by following the standalone/standalone.h headerfile * All standalone mod "main loop" should be the RunMod() function. - * Since the standalone is either LF or HF, the somewhat bisarr defines below exists. */ -#if defined (WITH_LF) && ( defined (WITH_STANDALONE_LF_SAMYRUN) || defined (WITH_STANDALONE_LF_HIDBRUTE) || defined (WITH_STANDALONE_LF_PROXBRUTE) ) RunMod(); -#endif - -#if defined (WITH_ISO14443a) && ( defined (WITH_STANDALONE_HF_YOUNG) || defined(WITH_STANDALONE_HF_COLIN) || defined(WITH_STANDALONE_HF_MATTYRUN) || defined(WITH_STANDALONE_HF_BOG) ) - RunMod(); -#endif - } } } From 423e6bfb321255e01ea8beba2d3941774a3867fd Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 25 Apr 2019 22:43:08 +0200 Subject: [PATCH 2/2] adjust standalone doc --- armsrc/Standalone/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armsrc/Standalone/readme.md b/armsrc/Standalone/readme.md index e5746e97b..85cbdb1ca 100644 --- a/armsrc/Standalone/readme.md +++ b/armsrc/Standalone/readme.md @@ -7,7 +7,7 @@ Have a look at the skeleton standalone mode called IceRun, in the files `lf_ice ## Implementing a standalone mode -Each standalone mod needs to have its own compiler flag to be added in `armsrc\makefile` and inside the function `AppMain` inside AppMain.c. Inside Appmain a call to RunMod is needed. It looks strange because of what kinds of dependencies your mode will have. +Each standalone mod needs to have its own compiler flag to be added in `armsrc\makefile`. The RunMod function is your "main" function when running. You need to check for Usb commands, in order to let the pm3 client break the standalone mode. See this basic skeleton of main function RunMod(). ```` @@ -49,7 +49,7 @@ Samples of directive flag used in the `common/Makefile.hal`: #PLATFORM_DEFS += -DWITH_STANDALONE_HF_COLIN #PLATFORM_DEFS += -DWITH_STANDALONE_HF_BOG ``` -Add your source code file like the following sample in the `armsrc\makefile` +Add your source code file like the following sample in the `armsrc/Makefile` ``` # WITH_STANDALONE_HF_COLIN