[syslinux:master] memdump: srecs need a length, and max 32 data bytes

syslinux-bot for H. Peter Anvin hpa at zytor.com
Fri Feb 5 18:18:02 PST 2010


Commit-ID:  247dbe7aaec8d4a29fdf599e21dbb5a54de14f8b
Gitweb:     http://syslinux.zytor.com/commit/247dbe7aaec8d4a29fdf599e21dbb5a54de14f8b
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 5 Feb 2010 18:17:10 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 5 Feb 2010 18:17:10 -0800

memdump: srecs need a length, and max 32 data bytes

Length + 32 data bytes max...

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 memdump/srecsend.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/memdump/srecsend.c b/memdump/srecsend.c
index 668d16c..78f32ed 100644
--- a/memdump/srecsend.c
+++ b/memdump/srecsend.c
@@ -16,12 +16,7 @@ static void make_srec(struct serial_if *sif, char type, size_t addr,
     uint8_t csum;
 
     p = buf;
-    *p++ = 'S';
-    *p++ = type;
-    if (type == '0')
-	p += sprintf(p, "%04zX", addr);
-    else
-	p += sprintf(p, "%08zX", addr);
+    p += sprintf(p, "S%c%02X%0*zX", type, len+alen+1, alen, addr);
     
     csum = (len+alen+1) + addr + (addr >> 8) + (addr >> 16) + (addr >> 24);
     while (len) {
@@ -62,7 +57,7 @@ void send_srec(struct serial_if *sif, struct file_info *fileinfo,
 	
 	np = blk_buf;
 	while (bytes) {
-	    chunk = bytes > 64 ? 64 : bytes;
+	    chunk = bytes > 32 ? 32 : bytes;
 
 	    make_srec(sif, '3', addr, np, chunk);
 



More information about the Syslinux-commits mailing list