circle icon indicating copy to clipboard operation
circle copied to clipboard

Serial flashing problems

Open PanosMich opened this issue 10 months ago • 6 comments

Hello Rene,

I am sorry to bother you again, but I am having problems flashing code with the serial port.

I tried the latest Flashy and it works great with files around 200K. However, trying to upload 2M files fails returning a "timeout awaiting response" error.

I also tried cflashy, but it does not seem to work. For example, in circle/sample/02-screenpixel, I build the sample using make and I use "objcopy -O ihex kernel8-32.elf kernel8-32.hex" to produce the .hex file. After that, executing: "make flash" or "../../tools/cflashy /dev/ttyS5 --flashBaud:115200 --userBaud:115200 kernel8-32.hex" or "../../tools/cflashy /dev/ttyS5 --flashBaud:115200 --userBaud:115200 --reboot:REBOOT kernel8-32.hex" or "../../tools/cflashy /dev/ttyS5 kernel8-32.hex" the command waits for ever with no feedback.

Sniffing the serial port I found out that commands without the --reboot:REBOOT option send a bunch of 0x80 characters and a "R" at the end, while the bootloader returns a "IHEX-F" message.

Commands with the --reboot:REBOOT option send a "REBOOT", then a bunch of 0x80 characters and a "R" at the end, while the bootloader returns a "IHEX-F<CR><LF>#ERR:format<CR><LF>IHEX-F" message.

Any thoughts?

PanosMich avatar Apr 09 '25 08:04 PanosMich

The serial bootloader does allow to load kernel images with a size of up to 2 MBytes by default. With this patch you can load up to 8 MBytes:

diff --git a/tools/bootloader/vectors.s b/tools/bootloader/vectors.s
index d9cf4791..3b644f9b 100644
--- a/tools/bootloader/vectors.s
+++ b/tools/bootloader/vectors.s
@@ -6,7 +6,7 @@
 _start:
     b skip
 
-.space 0x200000-0x8004,0
+.space 0x800000-0x8004,0
 
 skip:
     mov sp,#0x08000000
diff --git a/tools/bootloader/vectors64.s b/tools/bootloader/vectors64.s
index 8122db95..c20ec546 100644
--- a/tools/bootloader/vectors64.s
+++ b/tools/bootloader/vectors64.s
@@ -6,7 +6,7 @@
 _start:
     b skip
 
-.space 0x280000-0x80004,0
+.space 0x880000-0x80004,0
 
 skip:
     mov sp,#0x08000000

You have to build the bootloader images again after applying the patch with make bootloader or make bootloader64 in boot/.

It looks all right, what you have sniffed from cFlashy via the serial line. But perhaps it creates less effort to use the normal Flashy with this patch above, but to debug this problem further. BTW. This default 2 Mbytes size limit also applies to cFlashy.

rsta2 avatar Apr 09 '25 10:04 rsta2

The patch works fine. Thank you for that. I got flashy v.1 to work up to 230400 baud, however only with the nofast flag. For some reason, in my case, fast transfer is not working with large files at any speed. I don't know if it's because I am using WSL1. Have you ever tried flashy v.3 with the 43-multiwindow sample? Did it work for you?

PanosMich avatar Apr 11 '25 15:04 PanosMich

Unfortunately I never used WSL(1). I also did not try Flashy v3.

rsta2 avatar Apr 11 '25 21:04 rsta2

Did you find a solution?

rsta2 avatar Apr 24 '25 18:04 rsta2

Thank you for asking. I think I found one. It is called SDWire3. I should be receiving it in the following days. If you want, I can send you feedback once I try it.

PanosMich avatar Apr 24 '25 18:04 PanosMich

Thanks for info! That's an interesting solution and probably much quicker than a serial bootloader, but also more expensive.

rsta2 avatar Apr 24 '25 18:04 rsta2