in port/espressif/src/boot_serial_port.c [92:121]
static uint32_t readline( uint8_t * buf, uint32_t cap )
{
volatile uint32_t len = 0;
volatile uint32_t n_read = 0;
volatile bool stop = false;
static uart_dev_t * pxUART = &UART1;
do
{
len = uart_ll_get_rxfifo_len( pxUART );
for( uint32_t i=0; i<len; i++ )
{
uart_ll_read_rxfifo( pxUART, &buf[n_read], 1u );
n_read++;
/* Stop at capacity or once full packet is ingested */
if( n_read == cap || buf[n_read-1] == '\n' )
{
stop = true;
}
}
esp_rom_delay_us( 1000u );
} while( !stop );
return n_read;
}