in port/espressif/src/boot_serial_port.c [184:192]
static int boot_port_serial_read( char * str, int cnt, int *newline )
{
volatile uint32_t n_read = 0;
n_read = readline( (uint8_t *)str, cnt );
*newline = (str[n_read-1] == '\n') ? 1 : 0;
return n_read;
}