x86 code compression

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello

In my project i just got 128kb memory space for my x86-ROM-code. So i'd
like to try to get more code executed in this limited memory space.

I wonder if anyone ever used x86 code compression successfully to save
memory footage !? URLs & book references appreciated.


thanks in advance
josef


Re: x86 code compression

Quoted text here. Click to load it

You save a lot of Binary code space by not using
a C++ compiler. And don't include libraries that
you do not use. 128kBytes are a lot on a X86.

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net

Re: x86 code compression
Quoted text here. Click to load it

You have basically three choices:

1: and probably the best - use the correct optimizer settings for the
best compiler you can find. SOme compilers are great at size
optimizations. Also, C and C++ can be trimmed down by writing smart
code. Avoid virtual function, use the smalles type, possible, use
individual bit instead of bool, avoid templates and printf, etc. . Also,
get a good compiler that throws dead code out and reuses duplicate strings.

2: actually compress you code in ROM, using gz, zip, bz2 or whatever,
and unpack your code into RAM when you need it. If you don't mind the
pain and have limited RAM, you can page sections of code into RAM as needed.

3: use an interpreter. I am not kidding. In some cases, using an
interpreter on precompield code (similar to Java and a virtual machine)
can minimize your overall code. On a Basic stamp, for example, you can
write useful programs in 256 byte flash RAM using PicBASIC in the ROM.
This depends of course on your interpreter and the size of the required
library.

Re: x86 code compression
Quoted text here. Click to load it

I was going to suggest FORTH, for the same sort of reason.

Use of (re)factoring tools in modern IDEs can help too, by minimising
cut-and-paste duplication.  (Or just do that work manually.)

--
Andrew


Re: x86 code compression
Quoted text here. Click to load it

ONLY 128K??????!!!???

I know of a missile control program running on a 186 processor, that
does yaw, pitch and roll real-time control, with floating point math, in 4K.

Re: x86 code compression

Quoted text here. Click to load it
4K.

likewise, but with a COSMAC 1802 !!!!.. 4k.. that's a luxury !! lol




Re: x86 code compression
Hi Josef,

Quoted text here. Click to load it

The locator of On Time RTOS-32 can compress code which is then expanded to
RAM at boot time. The compressed code typically has a size of 50% of the
original code, so you could run a 256k code segment with just 128k ROM
(assuming you don't have too much inialized data which is also decompressed
from ROM to RAM).

More information and a free downloadable test version of On Time RTOS-32 is
available at http://www.on-time.com .

Peter



Re: x86 code compression

Quoted text here. Click to load it


You don't say what OS you are using, so might not be any good for you, but
...

http://upx.sourceforge.net/


Regards,
Richard.

http://www.FreeRTOS.org



Site Timeline