DSPRelated.com
Forums

unzip on a 6713

Started by Bernhard 'Gustl' Bauer May 5, 2010
Hi,

I'm running short of external ROM, but have plenty external RAM. So why
don't I zip some code parts (all text) during compilation, place it in
ROM and unzip this code to RAM when booting.

What do you think about this?

Any idea where I can get an unzip source code?

TIA

Gustl

_____________________________________
Gustl,

I made a quick check and used some common zippers to compress various C6000
boot image files. The size reduction was 25 to 35 percent.

A Google search shows quite a few free unzip algorithms, mostly GPL.

Zipping will make sense only if you already have a larger ROM device in
your system. On small ROMs (256 or 512K bytes) the unzip code itself may
outweigh the savings.

Best Regards,
Adolf Klemenz, D.SignT
At 14:01 05.05.2010 +0200, Bernhard 'Gustl' Bauer wrote:
>Hi,
>
>I'm running short of external ROM, but have plenty external RAM. So why
>don't I zip some code parts (all text) during compilation, place it in
>ROM and unzip this code to RAM when booting.
>
>What do you think about this?
>
>Any idea where I can get an unzip source code?
>
>TIA
>
>Gustl

_____________________________________
Bernhard,

Your idea may work.
It depends on the size of the unzip code and how much compression is achieved.
I suspect that 'code' does not compress well due to the lack of re-occurring patterns of any significant length plus a good unzip algorithm, like the L/Z algorithm used by the typical zip/unzip utility is rather large.
Also remember that the unzip algorithm cannot be part of the compressed code.

BTW:
The L/Z algorithm, produces a zip file that contains, amongst many other things, for each re-occurring pattern, the length of a pattern+the pattern+a count of occurrances+a series of offsets where that pattern occurs in the unzipped code.
For short patterns and/or few occurrences of the pattern, the resulting zip'd file will have very little compression achieved.

I suspect you will spend a lot of time on the unzip algorithm that might better be spent on size optimization of the code algorithm.

R. Williams

---------- Original Message -----------
From: "Bernhard 'Gustl' Bauer"
To: C6x
Sent: Wed, 05 May 2010 14:01:47 +0200
Subject: [c6x] unzip on a 6713

> Hi,
>
> I'm running short of external ROM, but have plenty external RAM. So why
> don't I zip some code parts (all text) during compilation, place it in
> ROM and unzip this code to RAM when booting.
>
> What do you think about this?
>
> Any idea where I can get an unzip source code?
>
> TIA
>
> Gustl
Hello Gustl,

On Wed, May 5, 2010 at 10:27 AM, Richard Williams wrote:

> Bernhard,
>
> Your idea may work.
> It depends on the size of the unzip code and how much compression is
> achieved.
> I suspect that 'code' does not compress well due to the lack of
> re-occurring patterns of any significant length plus a good unzip algorithm,
> like the L/Z algorithm used by the typical zip/unzip utility is rather
> large.
> Also remember that the unzip algorithm cannot be part of the compressed
> code.
>
> BTW:
> The L/Z algorithm, produces a zip file that contains, amongst many other
> things, for each re-occurring pattern, the length of a pattern+the pattern+a
> count of occurrances+a series of offsets where that pattern occurs in the
> unzipped code.
> For short patterns and/or few occurrences of the pattern, the resulting
> zip'd file will have very little compression achieved.
>
> I suspect you will spend a lot of time on the unzip algorithm that might
> better be spent on size optimization of the code algorithm.
>

A few thoughts...
1. totally understand your current memory usage. eliminate the holes.
2. zip your code with your favorite 'zip utility' for max compression. Note:
Do not zip the '.out' file or an ascii hex file. It should be a 'loadable
binary image'. [ I assume that you already have something close to program
the Flash].
3. check the math on the compressed file. If it looks encouraging, proceed.
4. acquire an open source zip utility. cut it down and hard code it to do
only what you want. The port to c6000 should be fairly straight forward -
make sure that you convert all 'long ints'.
5. build it with the c6000 compiler and see what the ROM image size is. Does
the math work??

mikedunn

>
> R. Williams
> *---------- Original Message -----------*
> From: "Bernhard 'Gustl' Bauer"
> To: C6x
> Sent: Wed, 05 May 2010 14:01:47 +0200
> Subject: [c6x] unzip on a 6713
>
> > Hi,
> >
> > I'm running short of external ROM, but have plenty external RAM. So why
> > don't I zip some code parts (all text) during compilation, place it in
> > ROM and unzip this code to RAM when booting.
> >
> > What do you think about this?
> >
> > Any idea where I can get an unzip source code?
> >
> > TIA
> >
> > Gustl
>
>
>

--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
Adolf Klemenz schrieb:
> I made a quick check and used some common zippers to compress various
> C6000 boot image files. The size reduction was 25 to 35 percent.

I will use parts that contain mostly text. With winzip I can reduce
about 300k to 100k.

> Zipping will make sense only if you already have a larger ROM device in
> your system. On small ROMs (256 or 512K bytes) the unzip code itself may
> outweigh the savings.

That's part of my problem. I don't know how much space an unzip code needs.

_____________________________________