3 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 `Makefile.inc` and `Makefile.hal`
5 If you want to implement a new standalone mode, you need to implement the methods provided in `standalone.h`.
6 Have a look at the skeleton standalone mode, in the file `lf_skeleton.c`.
8 As it is now, you can only have one standalone mode installed at the time.
10 ## Implementing a standalone mode
12 We suggest you keep your standalone code inside the `armsrc/Standalone` folder. And that you name your files according to your standalone mode name.
14 The `standalone.h` states that you must have two functions implemented.
16 The ModInfo function, which is your identification of your standalone mode. This string will show when running the command `hw status` on the client.
18 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.
22 DbpString(" LF good description of your mode - aka FooRun (your name)");
29 // Do you target LF or HF?
30 FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
36 // exit from standalone mode, just send a usbcommand
37 if (data_available()) break;
39 // do your standalone stuff..
43 ## Naming your standalone mode
45 We suggest that you follow these guidelines:
46 - Use HF/LF to denote which frequency your mode is targeting.
47 - Use you own github name/similar for perpetual honour to denote your mode.
52 Which indicates your mode targets LF and is called FOO.
54 This leads to your next step, your DEFINE name needed in Makefile.
56 `WITH_STANDALONE_LF_FOO`
59 ## Update MAKEFILE.HAL
61 Add your mode to the `Makefile.hal` help and modes list (alphabetically):
63 +==========================================================+
64 | STANDALONE | DESCRIPTION |
65 +==========================================================+
67 +----------------------------------------------------------+
68 | LF_FOO | My foobar mode will make you coffee |
69 +----------------------------------------------------------+
71 STANDALONE_MODES := LF_... LF_FOO
72 STANDALONE_MODES += HF_...
75 If your mode is using one of the unique features of the RDV4, add it to the proper list:
78 STANDALONE_MODES_REQ_SMARTCARD :=
79 STANDALONE_MODES_REQ_FLASH :=
80 STANDALONE_MODES_REQ_BT :=
83 ## Update MAKEFILE.INC
84 Add your source code files like the following sample in the `Makefile.inc`
87 # WITH_STANDALONE_LF_SKELETON
88 ifneq (,$(findstring WITH_STANDALONE_LF_SKELETON,$(APP_CFLAGS)))
89 SRC_STANDALONE = lf_skeleton.c
92 # WITH_STANDALONE_LF_FOO
93 ifneq (,$(findstring WITH_STANDALONE_LF_FOO,$(APP_CFLAGS)))
94 SRC_STANDALONE = lf_foo.c
98 ## Adding identification string of your mode
99 Do please add a identification string in a function called `ModInfo` inside your source code file.
100 This will enable an easy way to detect on client side which standalone mode has been installed on the device.
104 DbpString(" LF good description of your mode - aka FooRun (your name)");
108 ## Compiling your standalone mode
109 Once all this is done, you and others can now easily compile different standalone modes by just selecting one of the standalone modes (list in `Makefile.hal` or ) , e.g.:
111 - rename Makefile.platform.sample -> Makefile.platform
112 - edit the "STANDALONE" row inside Makefile.platform. You need to uncomment it and add your standalone mode name
114 Makefile.platform.sample
116 # If you want to use it, copy this file as Makefile.platform and adjust it to your needs
118 #PLATFORM_EXTRAS=BTADDON
119 #STANDALONE=LF_SAMYRUN
125 # If you want to use it, copy this file as Makefile.platform and adjust it to your needs
127 #PLATFORM_EXTRAS=BTADDON
131 Remember only one can be selected at a time for now.
133 The final steps is to
134 - force recompilation of all code. ```make clean```
135 - compile ```make -j```
137 - connect to your device
138 - press button long time to trigger ledshow and enter your new standalone mode
139 - if connected with usb / fpc , you can also see debug statements from your device in standalone mode. Useful for debugging :)
141 When compiling you will see a header showing what configurations your project compiled with.
142 Make sure it says your standalone mode name.
144 ## Submitting your code
146 Once you're ready to share your mode, please
148 * add a line in CHANGELOG.md
149 * add your mode in the modes table in doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md