File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ uint16_t Timeout = 0;
68
68
uint16_t bootKey = 0x7777 ;
69
69
volatile uint16_t * const bootKeyPtr = (volatile uint16_t * )0x0800 ;
70
70
71
- void StartSketch (void )
71
+ void StartSketch (uint8_t mcusr_state )
72
72
{
73
73
cli ();
74
74
@@ -86,6 +86,8 @@ void StartSketch(void)
86
86
TX_LED_OFF ();
87
87
RX_LED_OFF ();
88
88
89
+ GPIOR0 = mcusr_state ;
90
+
89
91
/* jump to beginning of application space */
90
92
__asm__ volatile ("jmp 0x0000" );
91
93
}
@@ -126,10 +128,10 @@ int main(void)
126
128
} else if ((mcusr_state & (1 <<PORF )) && (pgm_read_word (0 ) != 0xFFFF )) {
127
129
// After a power-on reset skip the bootloader and jump straight to sketch
128
130
// if one exists.
129
- StartSketch ();
131
+ StartSketch (mcusr_state );
130
132
} else if ((mcusr_state & (1 <<WDRF )) && (bootKeyPtrVal != bootKey ) && (pgm_read_word (0 ) != 0xFFFF )) {
131
133
// If it looks like an "accidental" watchdog reset then start the sketch.
132
- StartSketch ();
134
+ StartSketch (mcusr_state );
133
135
}
134
136
135
137
/* Setup hardware required for the bootloader */
@@ -155,7 +157,7 @@ int main(void)
155
157
USB_Detach ();
156
158
157
159
/* Jump to beginning of application space to run the sketch - do not reset */
158
- StartSketch ();
160
+ StartSketch (mcusr_state );
159
161
}
160
162
161
163
/** Configures all hardware required for the bootloader. */
Original file line number Diff line number Diff line change 86
86
typedef void (* AppPtr_t )(void ) ATTR_NO_RETURN ;
87
87
88
88
/* Function Prototypes: */
89
- void StartSketch (void );
89
+ void StartSketch (uint8_t mcur_state );
90
90
void LEDPulse (void );
91
91
92
92
void CDC_Task (void );
You can’t perform that action at this time.
0 commit comments