From ebdc38fc91d6d0855671128c7b958bd75937eb73 Mon Sep 17 00:00:00 2001 From: Feliks Date: Mon, 23 Mar 2020 23:04:36 -0400 Subject: [PATCH] flush rx buffer when bad crc and fix frame payload length --- litex/soc/software/bios/boot.c | 15 ++++++++++----- litex/soc/software/bios/sfl.h | 2 +- litex/tools/litex_term.py | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 41230ec36..62c83e307 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -122,6 +122,7 @@ int serialboot(void) printf("Booting from serial...\n"); printf("Press Q or ESC to abort boot completely.\n"); + // send the "magic" request to host for a firmware download c = str; while(*c) { uart_write(*c); @@ -145,18 +146,22 @@ int serialboot(void) int goodcrc; /* Get one Frame */ - frame.length = uart_read(); + frame.payload_length = uart_read(); frame.crc[0] = uart_read(); frame.crc[1] = uart_read(); frame.cmd = uart_read(); - for(i=0;i