EmbeddedRelated.com
Forums

Flash Memory - Loading an Application of 2M size into 1M Flash memory

Started by KBG September 26, 2006
Hi,

Ok, so embed a decompression algorithm into your bootloader and
you're good to go. Linux uses deflate (the zip/gzip algorithm),
of which versions are freely available. Look at how Linux does
it.

>>>>>>> Yes, i too believe that this is a good idea and need to work about it.
Need to know the size of Memory that this Deflate algorithm will eat while residing and while execution . Are you aware of it ? Normally the compression / decompression algorithm results will be very poor if we compress Executable files . But how does this 'Deflate' work here ??? Is it successful in compressing executables / binaries with a good compression ratio ? Here i Need to compress/decompress the ELF files, BIN files . Kindly share your views / ideas. Tonnes of Thx in advans, Karthik Balaguru
KBG wrote:
>>>>>>>> Yes, i too believe that this is a good idea and need to work about it.
So stop asking us to do your work for you and GO AND LOOK AT THE THINGS WE'VE ALREADY TOLD YOU. > Need to know the size of Memory that this Deflate algorithm will eat > while residing and while execution . Are you aware of it ? Yes. No, I won't tell you - it's time you go and *find out*. To get you started, here's some facts from my Linux box: # ls -l /usr/src/linux/arch/i386/boot/compressed/ [..snip..] -rwxr-xr-x 1 root root 1041787 2006-07-22 17:13 vmlinux* -rwxr-xr-x 1 root root 2025956 2006-07-22 17:13 vmlinux.bin* -rw-r--r-- 1 root root 1027095 2006-07-22 17:13 vmlinux.bin.gz The .bin file is uncompressed, the .bin.gz is compressed, and the other file has the decompressor at the start. That's for an Intel architechure machine; you'll have to "gzip" your own binary image file to find out how it works on your architecture. Now run along and do some experiments and googling by yourself. It's p^%$ easy for any half-competent programmer to find the facts you want, so there's no reason to continue asking here.
On 28 Sep 2006 00:30:19 -0700, "KBG"
<karthik.balaguru@lntinfotech.com> wrote:

>Normally the compression / decompression algorithm results will be very >poor if we compress Executable files .
An experienced person reading disassembled code can quite easily detect which compiler has been used to generate the code and quite reliably guess what the high level language source statements were. This clearly proves that a compiler generates various idiomatic sequences, which are easily detectable by a trained eye and are often repeated multiple times in a program and should thus be easily be compressed to one or two bytes. The same applies to frequent macro expansions in assemblers as well as any text strings (menus etc). Since you apparently only need to go from 1.4 MiB (not 2 MiB as originally claimed) down to 1 MiB, this should not be too hard, even considering the decompression code size. Paul
Hi,
Fine, Thankyou for your ideas and feedbacks which are really very
helpful.

Warm Regards,
Karthik Balaguru


Paul Keinanen wrote:
> On 28 Sep 2006 00:30:19 -0700, "KBG" > <karthik.balaguru@lntinfotech.com> wrote: > > >Normally the compression / decompression algorithm results will be very > >poor if we compress Executable files . > > An experienced person reading disassembled code can quite easily > detect which compiler has been used to generate the code and quite > reliably guess what the high level language source statements were. > This clearly proves that a compiler generates various idiomatic > sequences, which are easily detectable by a trained eye and are often > repeated multiple times in a program and should thus be easily be > compressed to one or two bytes. The same applies to frequent macro > expansions in assemblers as well as any text strings (menus etc). > > Since you apparently only need to go from 1.4 MiB (not 2 MiB as > originally claimed) down to 1 MiB, this should not be too hard, even > considering the decompression code size. > > Paul
KBG wrote:
>
... snip ...
> > Need to know the size of Memory that this Deflate algorithm will eat > while residing and while execution . Are you aware of it ? > > Normally the compression / decompression algorithm results will be very > poor if we compress Executable files . But how does this 'Deflate' work > here ???
Look up some of the literature on LZ77. "The Compression Book" is a useful reference. What the decompressor requires is dependent on the compressor, but most systems will function with a 4k to 8k buffer plus some working memory. Decompression is fast and simple. Compression is relatively slow and complex. Maintain proper quotes and attributions in your articles. Read the following links. -- Some informative links: <news:news.announce.newusers <http://www.geocities.com/nnqweb/> <http://www.catb.org/~esr/faqs/smart-questions.html> <http://www.caliburn.nl/topposting.html> <http://www.netmeister.org/news/learn2quote.html> <http://cfaj.freeshell.org/google/>