From 9857d9d9d2b67cb1f94b36ad0c39afc6644b29b9 Mon Sep 17 00:00:00 2001 From: "fb@frank-buss.de" Date: Fri, 8 Nov 2019 17:16:28 +0100 Subject: [PATCH] adding support to flash an FBI image --- litex/soc/software/bios/boot.c | 51 +++++++++++++++++++++++++++------- litex/soc/software/bios/sfl.h | 2 ++ litex/tools/litex_term.py | 39 ++++++++++++++++++++++---- 3 files changed, 76 insertions(+), 16 deletions(-) diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index af05c3c1..f1b22966 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -8,6 +8,7 @@ // License: BSD #include +#include #include #include #include @@ -23,6 +24,10 @@ #include #endif +#ifdef CSR_SPIFLASH_BASE +#include +#endif + #include "sfl.h" #include "boot.h" @@ -95,6 +100,14 @@ static int check_ack(void) return ACK_TIMEOUT; } +static uint32_t get_uint32(unsigned char* data) +{ + return ((uint32_t) data[0] << 24) | + ((uint32_t) data[1] << 16) | + ((uint32_t) data[2] << 8) | + (uint32_t) data[3]; +} + #define MAX_FAILED 5 /* Returns 1 if other boot methods should be tried */ @@ -165,11 +178,7 @@ int serialboot(void) char *writepointer; failed = 0; - writepointer = (char *)( - ((unsigned long)frame.payload[0] << 24) - |((unsigned long)frame.payload[1] << 16) - |((unsigned long)frame.payload[2] << 8) - |((unsigned long)frame.payload[3] << 0)); + writepointer = (char *) get_uint32(&frame.payload[0]); for(i=4;i