Merge branch 'bugfix/uart_read_o2_v4.1' into 'release/v4.1'

hal: workaround for UART FIFO read on ESP32 with -O2 optimization (backport v4.1)

See merge request espressif/esp-idf!12660
This commit is contained in:
Michael (XIAO Xufeng) 2021-03-22 07:41:40 +00:00
commit c10fd0edb2

View File

@ -167,6 +167,9 @@ FORCE_INLINE_ATTR void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, uint32_
uint32_t fifo_addr = (hw == &UART0) ? UART_FIFO_REG(0) : (hw == &UART1) ? UART_FIFO_REG(1) : UART_FIFO_REG(2);
for(uint32_t i = 0; i < rd_len; i++) {
buf[i] = READ_PERI_REG(fifo_addr);
#ifdef CONFIG_COMPILER_OPTIMIZATION_PERF
__asm__ __volatile__("nop");
#endif
}
}