This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: ELF loader slowness & getc_info help
- From: Matthew J Fletcher <amimjf at sky dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Sun, 26 Apr 2009 16:08:56 +0100
- Subject: Re: [ECOS] ELF loader slowness & getc_info help
- References: <49F2BF6B.60500@sky.com> <49F319C0.7070709@mlbassoc.com>
> I see plenty of things to comment on, but without knowing where this
> code lives and how it's being called, I hesitate to say much.
>
> A patch against the current tree would be much simpler to work with.
>
Thanks for the reply, i was mostly trying to bounce ideas around to see
if my idea of reducing the getc call overhead was a sensible one.
I already changed both CYGNUM_REDBOOT_GETC_BUFFER and
CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER to 0x2000
All changes in load_elf_image() function, against rev 1.51
regards
---
Matthew J Fletcher
amimjf(at)sky.com
www.amimjf.org
---
--- load.c.151 2009-04-26 15:51:11.000000000 +0100
+++ load.c 2009-04-26 16:02:35.000000000 +0100
@@ -402,7 +402,7 @@
}
// Copy data into memory
- while (len-- > 0) {
+ while (len > 0) {
#ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
if (!(valid_address(addr)
#ifdef CYGBLD_REDBOOT_LOAD_INTO_FLASH
@@ -414,26 +414,39 @@
return 0;
}
#endif
- if ((ch = (*getc)()) < 0) {
- err_printf(SHORT_DATA);
- redboot_getc_terminate(true);
- return 0;
- }
-#ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
- if (valid_address(addr))
-#endif
- *addr++ = ch;
-
-#ifdef CYGBLD_REDBOOT_LOAD_INTO_FLASH
- else {
- flash_load_write(addr, ch);
- addr++;
- }
-#endif
- offset++;
- if ((unsigned long)(addr-addr_offset) > highest_address) {
- highest_address = (unsigned long)(addr - addr_offset);
- }
+
+ getc_info.bufp = getc_info.buf;
+ getc_info.len = (*getc_info.fun)(getc_info.bufp, read_size, &getc_info.err);
+ getc_info.avail = getc_info.len;
+
+ for (i =0; i < getc_info.len; i++)
+ {
+ #ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
+ if (valid_address(addr))
+ #endif
+ *addr++ = *getc_info.bufp++;
+
+ #ifdef CYGBLD_REDBOOT_LOAD_INTO_FLASH
+ else {
+ flash_load_write(addr, *getc_info.bufp++);
+ addr++;
+ }
+ #endif
+ // knock off what was read
+ len--;
+ getc_info.avail--;
+
+ if (getc_info.err < 0) {
+ err_printf(SHORT_DATA);
+ redboot_getc_terminate(true);
+ return 0;
+ }
+
+ offset++;
+ if ((unsigned long)(addr-addr_offset) > highest_address) {
+ highest_address = (unsigned long)(addr - addr_offset);
+ }
+ }
}
}
}
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss