proxmark3/armsrc/Standalone
2019-04-25 23:23:44 +02:00
..
hf_bog.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
hf_bog.h remove random 2019-04-07 11:00:28 +02:00
hf_colin.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
hf_colin.h Revert c7a4d7af, remove redundant include 2019-04-22 22:11:57 +02:00
hf_mattyrun.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
hf_mattyrun.h Revert c7a4d7af, remove redundant include 2019-04-22 22:11:57 +02:00
hf_young.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
hf_young.h Add missing EOF LF 2019-03-12 00:12:26 +01:00
lf_hidbrute.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
lf_hidbrute.h Add missing EOF LF 2019-03-12 00:12:26 +01:00
lf_icerun.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
lf_icerun.h chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
lf_proxbrute.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
lf_proxbrute.h Add missing EOF LF 2019-03-12 00:12:26 +01:00
lf_samyrun.c chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00
lf_samyrun.h Add missing EOF LF 2019-03-12 00:12:26 +01:00
placeholder.c Use placeholder for standalone mode if needed 2019-04-25 22:40:46 +02:00
readme.md Update readme.md 2019-04-25 23:23:44 +02:00
standalone.h chg: refactor standalone mode info string 2019-04-25 21:44:34 +02:00

StandAlone Modes

This contains functionality for different StandAlone modes. The fullimage will be built given the correct compiler flags used. Build targets for these files are contained in armsrc/Makefile and common/Makefile.hal

If you want to implement a new standalone mode, you need to implement the methods provided in standalone.h. Have a look at the skeleton standalone mode called IceRun, in the files lf_icerun.c lf_icerun.h.

As it is now, you can only have one standalone mode installed at the time.

Implementing a standalone mode

We suggest you keep your standalone code inside the Armsrc/Standalone folder. And that you name your files according to your standalone mode name.

The standalone.h states that you must have two function implemented.

The ModInfo function, which is your identification of your standalone mode. This string will show when running the command hw status on the client.

The RunMod function, which 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() and Modinfo() below.

void ModInfo(void) {
    DbpString("   LF good description of your mode - aka FooRun (my name)");
}

void RunMod(void) {
    // led show
    StandAloneMode();

    // Do you target LF or HF?
    FpgaDownloadAndGo(FPGA_BITSTREAM_LF);

    // main loop
    for (;;) {
        WDT_HIT();

        // exit from standalone mode, just send a usbcommand
        if (usb_poll_validate_length()) break;

        // do your standalone stuff..
    }

Each standalone mode needs to have its own compiler flag to be added in armsrc\makefile.

Naming your standalone mode

We suggest that you follow these guidelines,

  • Use HF/LF to denote which frequence your mod is targeting.
  • Use you own github name/similar for perpetual honour to denote your mode.

sample: LF_FOORUN

Which indicates your mode targets LF and is called FOO.

This leads to your next step, your DEFINE name needed in Makefile.

WITH_STANDALONE_LF_FOORUN

Update COMMON/MAKEFILE.HAL

Samples of directive flag used in the common/Makefile.ha and your suggested DEFINE.

#PLATFORM_DEFS += -DWITH_STANDALONE_LF_SAMYRUN
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_ICERUN
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_PROXBRUTE
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_HIDBRUTE
#PLATFORM_DEFS += -DWITH_STANDALONE_HF_YOUNG
#PLATFORM_DEFS += -DWITH_STANDALONE_HF_MATTYRUN
#PLATFORM_DEFS += -DWITH_STANDALONE_HF_COLIN
#PLATFORM_DEFS += -DWITH_STANDALONE_HF_BOG
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_FOORUN

Update ARMSRC/MAKEFILE

Add your source code files like the following sample in the armsrc/Makefile

# WITH_STANDALONE_LF_ICERUN
ifneq (,$(findstring WITH_STANDALONE_LF_ICERUN,$(APP_CFLAGS)))
	SRC_STANDALONE = lf_icerun.c
endif

# WITH_STANDALONE_LF_FOO
ifneq (,$(findstring WITH_STANDALONE_LF_FOO,$(APP_CFLAGS)))
    SRC_STANDALONE = lf_foo.c
endif

Adding identification string of your mode

Do please add a identification string in a function called ModInfo inside your source code file. This will enable an easy way to detect on client side which standalone mods has been installed on the device.

void ModInfo(void) {
    DbpString("   LF good description of your mode - aka FooRun (my name)");
}

Compiling your standalone mode

Once all this is done, you and others can now easily compile different standalone modes by just selecting one of the standalone modes in common/Makefile.hal, e.g.:

PLATFORM_DEFS += -DWITH_STANDALONE_LF_FOO

Remember only one can be selected at a time for now.