x86 code compression

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

Reply to
josef.angermeier
Loading thread data ...

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
Reply to
Rene Tschaggelar

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.
Reply to
Matthias Melcher

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
Reply to
Andrew Reilly

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.

Reply to
Gob Stopper

4K.

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

Reply to
TheDoc

Hi Josef,

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

formatting link

Peter

Reply to
Peter Petersen

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

formatting link

Regards, Richard.

formatting link

Reply to
Richard

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.