File tree Expand file tree Collapse file tree 5 files changed +39
-3
lines changed
variants/arduino_zero/linker_scripts/gcc Expand file tree Collapse file tree 5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,32 @@ static void check_start_application(void)
97
97
led_port -> DIRSET .reg = (1 <<30 );
98
98
led_port -> OUTCLR .reg = (1 <<30 );
99
99
100
+ #if defined(BOOT_DOUBLE_TAP_ADDRESS )
101
+ if (PM -> RCAUSE .bit .POR )
102
+ {
103
+ /* On power-on initialize double-tap */
104
+ BOOT_DOUBLE_TAP_DATA = 0 ;
105
+ }
106
+ else
107
+ {
108
+ if (BOOT_DOUBLE_TAP_DATA == 0 ) {
109
+ /* First tap */
110
+ BOOT_DOUBLE_TAP_DATA = 1 ;
111
+
112
+ for (uint32_t i = 0 ; i < 50000 ; i ++ ) /* 200ms */
113
+ /* force compiler to not optimize this... */
114
+ __asm__ __volatile__("" );
115
+
116
+ /* Timeout happened, continue boot... */
117
+ BOOT_DOUBLE_TAP_DATA = 0 ;
118
+ } else {
119
+ /* Second tap, stay in bootloader */
120
+ BOOT_DOUBLE_TAP_DATA = 0 ;
121
+ return ;
122
+ }
123
+ }
124
+ #endif
125
+
100
126
uint32_t app_start_address ;
101
127
102
128
/* Load the Reset Handler address of the application */
Original file line number Diff line number Diff line change 34
34
#define CPU_FREQUENCY 8000000
35
35
36
36
#define APP_START_ADDRESS 0x00002000
37
+
38
+ /*
39
+ * If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
40
+ * quickly tapping two times on the reset button.
41
+ * BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
42
+ * be touched from the loaded application.
43
+ */
44
+ #define BOOT_DOUBLE_TAP_ADDRESS 0x20007FFC
45
+ #define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
46
+
37
47
#define BOOT_LOAD_PIN PIN_PA21 //Pin 7
38
48
//#define BOOT_LOAD_PIN PIN_PA15 //Pin 5
39
49
#define BOOT_PIN_MASK (1U << (BOOT_LOAD_PIN & 0x1f))
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ SEARCH_DIR(.)
50
50
MEMORY
51
51
{
52
52
rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
53
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
53
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000-0x0004 /* 4 bytes used by bootloader to keep data between resets */
54
54
}
55
55
56
56
/* The stack size used by the application. NOTE : you need to adjust according to your application. */
Original file line number Diff line number Diff line change 25
25
*/
26
26
MEMORY
27
27
{
28
- FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000
29
- RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
28
+ FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
29
+ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000-0x0004 /* Last 4B used by bootloader */
30
30
}
31
31
32
32
/* Linker script to place sections and symbol values. Should be used together
You can’t perform that action at this time.
0 commit comments