Explorar o código

Merge branch 'bugfix/uart_read_o2' into 'master'

hal: workaround for UART FIFO read on ESP32 with -O2 optimization

Closes IDFCI-97

See merge request espressif/esp-idf!10263
Ivan Grokhotkov %!s(int64=5) %!d(string=hai) anos
pai
achega
3a51584fbb
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      components/hal/esp32/include/hal/uart_ll.h

+ 3 - 0
components/hal/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
     }
 }