-do_spm:
-;input: spmcrval determines SPM action
-;disable interrupts if enabled, store status
-;temp1 will be register: r7
-;temp2 will be register: r8
-;spmcrval will be register: r9
-
-in temp2, SREG ; --> has to be done before calling
-cli ; --> has to be done before calling
- ;check for previous SPM complete
-wait:
-in temp1, SPMCR
-sbrc temp1, SPMEN
-rjmp wait
- ;SPM timed sequence
-out SPMCR, spmcrval
-spm
- ;restore SREG (to enable interrupts if originally enabled)
-out SREG, temp2
-ret
+ * This feature prevents old updaters to do sth. undefined on wrong magic.
+ */
+
+/* all boards should use a magic to make it safe to confuse updatefiles :-) */
+#define HAVE_SPMINTEREFACE_MAGICVALUE 0
+/* If this feature is enabled (value != 0), the configured 32bit value is
+ * used as a magic value within spminterface. "bootloader__do_spm" will check
+ * additional four (4) registers for this value and only proceed, if they contain
+ * the right value. With this feature you can identify your board and avoid
+ * updating the wrong bootloader to the wrong board!
+ *
+ * Not all values are possible - "SPMINTEREFACE_MAGICVALUE" must be very sparse!
+ * To avoid collisions, magic-values will be organized centrally by Stephan
+ * Following values are definitly blocked or reserved and must not be used:
+ * 0x00000000, 0x12345678,
+ * 0x00a500a5, 0x00a5a500, 0xa50000a5, 0xa500a500,
+ * 0x005a005a, 0x005a5a00, 0x5a00005a, 0x5a005a00,
+ * 0x5aa55aa5, 0x5aa5a55a, 0xa55a5aa5, 0xa55aa55a,
+ * 0x5a5a5a5a, 0xa5a5a5a5,
+ * 0xffa5ffa5, 0xffa5a5ff, 0xa5ffffa5, 0xa5ffa5ff,
+ * 0xff5aff5a, 0xff5a5aff, 0x5affff5a, 0x5aff5aff,
+ * 0x00ff00ff, 0x00ffff00, 0xff0000ff, 0xff00ff00,
+ * 0xffffffff