@@ -44,37 +44,6 @@ static void check_start_application(void)
44
44
// LED_init();
45
45
// LED_off();
46
46
47
- #if defined(BOOT_DOUBLE_TAP_ADDRESS )
48
- #define DOUBLE_TAP_MAGIC 0x07738135
49
- if (PM -> RCAUSE .bit .POR )
50
- {
51
- /* On power-on initialize double-tap */
52
- BOOT_DOUBLE_TAP_DATA = 0 ;
53
- }
54
- else
55
- {
56
- if (BOOT_DOUBLE_TAP_DATA == DOUBLE_TAP_MAGIC )
57
- {
58
- /* Second tap, stay in bootloader */
59
- BOOT_DOUBLE_TAP_DATA = 0 ;
60
- return ;
61
- }
62
-
63
- /* First tap */
64
- BOOT_DOUBLE_TAP_DATA = DOUBLE_TAP_MAGIC ;
65
-
66
- /* Wait 0.5sec to see if the user tap reset again.
67
- * The loop value is based on SAMD21 default 1MHz clock @ reset.
68
- */
69
- for (uint32_t i = 0 ; i < 125000 ; i ++ ) /* 500ms */
70
- /* force compiler to not optimize this... */
71
- __asm__ __volatile__("" );
72
-
73
- /* Timeout happened, continue boot... */
74
- BOOT_DOUBLE_TAP_DATA = 0 ;
75
- }
76
- #endif
77
-
78
47
#if (!defined DEBUG ) || ((defined DEBUG ) && (DEBUG == 0 ))
79
48
uint32_t * pulSketch_Start_Address ;
80
49
#endif
@@ -108,6 +77,37 @@ uint32_t* pulSketch_Start_Address;
108
77
return ;
109
78
}
110
79
80
+ #if defined(BOOT_DOUBLE_TAP_ADDRESS )
81
+ #define DOUBLE_TAP_MAGIC 0x07738135
82
+ if (PM -> RCAUSE .bit .POR )
83
+ {
84
+ /* On power-on initialize double-tap */
85
+ BOOT_DOUBLE_TAP_DATA = 0 ;
86
+ }
87
+ else
88
+ {
89
+ if (BOOT_DOUBLE_TAP_DATA == DOUBLE_TAP_MAGIC )
90
+ {
91
+ /* Second tap, stay in bootloader */
92
+ BOOT_DOUBLE_TAP_DATA = 0 ;
93
+ return ;
94
+ }
95
+
96
+ /* First tap */
97
+ BOOT_DOUBLE_TAP_DATA = DOUBLE_TAP_MAGIC ;
98
+
99
+ /* Wait 0.5sec to see if the user tap reset again.
100
+ * The loop value is based on SAMD21 default 1MHz clock @ reset.
101
+ */
102
+ for (uint32_t i = 0 ; i < 125000 ; i ++ ) /* 500ms */
103
+ /* force compiler to not optimize this... */
104
+ __asm__ __volatile__("" );
105
+
106
+ /* Timeout happened, continue boot... */
107
+ BOOT_DOUBLE_TAP_DATA = 0 ;
108
+ }
109
+ #endif
110
+
111
111
/*
112
112
#if defined(BOOT_LOAD_PIN)
113
113
volatile PortGroup *boot_port = (volatile PortGroup *)(&(PORT->Group[BOOT_LOAD_PIN / 32]));
0 commit comments