bios/flash: minor cleanup on serialboot flashing, add flash address support
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 8 Nov 2019 23:00:55 +0000 (00:00 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 8 Nov 2019 23:05:36 +0000 (00:05 +0100)
litex/soc/software/bios/boot.c
litex/tools/litex_term.py

index f1b22966d0e458f3c0a567dd7ca595c543dfe10b..0eabf6d5f349eb87e47751925239a27e3c9150a2 100644 (file)
@@ -103,9 +103,9 @@ static int check_ack(void)
 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];
+                  ((uint32_t) data[1] << 16) |
+                  ((uint32_t) data[2] << 8) |
+                   (uint32_t) data[3];
 }
 
 #define MAX_FAILED 5
@@ -200,7 +200,7 @@ int serialboot(void)
 
                                failed = 0;
                                addr = get_uint32(&frame.payload[0]);
-                
+
                                for (i = 4; i < frame.length; i++) {
                                        // erase page at sector boundaries before writing
                                        if ((addr & (SPIFLASH_SECTOR_SIZE - 1)) == 0) {
index 9e20530a36420082e9f5c9d1f4ba4b2ddd4d775b..68a4dff7734e89f1129df34cfcf616c20103b0af 100755 (executable)
@@ -201,12 +201,9 @@ class LiteXTerm:
         f.seek(0, 2)
         length = f.tell()
         f.seek(0, 0)
-        if self.flash:
-            print("[LXTERM] Flashing {} ({} bytes)...".format(filename, length))
-            current_address = 0
-        else:
-            print("[LXTERM] Uploading {} to 0x{:08x} ({} bytes)...".format(filename, address, length))
-            current_address = address
+        print("[LXTERM] {} {} to 0x{:08x} ({} bytes)...".format(
+            "Flashing" if self.flash else "Uploading", filename, address, length))
+        current_address = address
         position = 0
         start = time.time()
         remaining = length
@@ -368,7 +365,6 @@ def main():
     term = LiteXTerm(args.serial_boot, args.kernel, args.kernel_adr, args.images, args.no_crc, args.flash)
     term.open(args.port, int(float(args.speed)))
     term.console.configure()
-
     term.start()
     term.join(True)