Move SerialHead declaration outside of loops
This commit is contained in:
parent
026145b78b
commit
8ced0579d6
|
|
@ -126,6 +126,7 @@ uint8_t optiboot_w25x20cl_enter()
|
||||||
}
|
}
|
||||||
selectedSerialPort = 0; //switch to Serial0
|
selectedSerialPort = 0; //switch to Serial0
|
||||||
MYSERIAL.flush(); //clear RX buffer
|
MYSERIAL.flush(); //clear RX buffer
|
||||||
|
int SerialHead = rx_buffer.head;
|
||||||
// Send the initial magic string.
|
// Send the initial magic string.
|
||||||
while (ptr != end)
|
while (ptr != end)
|
||||||
putch(pgm_read_byte(ptr ++));
|
putch(pgm_read_byte(ptr ++));
|
||||||
|
|
@ -143,7 +144,6 @@ uint8_t optiboot_w25x20cl_enter()
|
||||||
// With the volatile keyword the compiler generates exactly the same code as without it with only one difference:
|
// With the volatile keyword the compiler generates exactly the same code as without it with only one difference:
|
||||||
// the last brne instruction jumps onto the (*rx_head == SerialHead) check and NOT onto the wdr instruction bypassing the check.
|
// the last brne instruction jumps onto the (*rx_head == SerialHead) check and NOT onto the wdr instruction bypassing the check.
|
||||||
volatile int *rx_head = &rx_buffer.head;
|
volatile int *rx_head = &rx_buffer.head;
|
||||||
int SerialHead = rx_buffer.head;
|
|
||||||
while (*rx_head == SerialHead) {
|
while (*rx_head == SerialHead) {
|
||||||
wdt_reset();
|
wdt_reset();
|
||||||
if ( --boot_timer == 0) {
|
if ( --boot_timer == 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue