From 8ced0579d636d88ab7ed6bbfbcce51b14ae97636 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Wed, 3 Mar 2021 14:35:37 +0200 Subject: [PATCH] Move SerialHead declaration outside of loops --- Firmware/optiboot_w25x20cl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {