diff --git a/Firmware/optiboot_w25x20cl.cpp b/Firmware/optiboot_w25x20cl.cpp index 05ae8931f..9e2296e7c 100644 --- a/Firmware/optiboot_w25x20cl.cpp +++ b/Firmware/optiboot_w25x20cl.cpp @@ -126,6 +126,7 @@ uint8_t optiboot_w25x20cl_enter() } selectedSerialPort = 0; //switch to Serial0 MYSERIAL.flush(); //clear RX buffer + int SerialHead = rx_buffer.head; // Send the initial magic string. while (ptr != end) 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: // 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; - int SerialHead = rx_buffer.head; while (*rx_head == SerialHead) { wdt_reset(); if ( --boot_timer == 0) {