From 1c6ab10a7049b9f08915ba1743d1c2796650996c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 3 Sep 2020 12:13:11 +0200 Subject: [PATCH] hal: workaround for UART FIFO read on ESP32 with -O2 optimization --- components/soc/src/esp32/include/hal/uart_ll.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/soc/src/esp32/include/hal/uart_ll.h b/components/soc/src/esp32/include/hal/uart_ll.h index 2be4adbe66..ce9e7169fd 100644 --- a/components/soc/src/esp32/include/hal/uart_ll.h +++ b/components/soc/src/esp32/include/hal/uart_ll.h @@ -170,6 +170,9 @@ static inline void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, uint32_t rd uint32_t fifo_addr = (hw == &UART0) ? UART_FIFO_REG(0) : (hw == &UART1) ? UART_FIFO_REG(1) : UART_FIFO_REG(2); for(int i = 0; i < rd_len; i++) { buf[i] = READ_PERI_REG(fifo_addr); +#ifdef CONFIG_COMPILER_OPTIMIZATION_PERF + __asm__ __volatile__("nop"); +#endif } }