EmbeddedRelated.com
Forums

x86 code compression

Started by Unknown August 16, 2005
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

josef.angermeier@web.de wrote:

> 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. >
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
josef.angermeier@web.de wrote:
> 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.
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.
On Tue, 16 Aug 2005 17:01:18 +0200, Matthias Melcher wrote:
> 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.
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
josef.angermeier@web.de wrote:
> 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 >
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.
"Gob Stopper" <Noone@anywhere.net> wrote in message
news:LdwMe.1078$_F1.63@lakeread04...
> josef.angermeier@web.de wrote: > > 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 > > > > 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. likewise, but with a COSMAC 1802 !!!!.. 4k.. that's a luxury !! lol
Hi Josef,

> 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.
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
<josef.angermeier@web.de> wrote in message
news:1124183824.154950.3730@g47g2000cwa.googlegroups.com...
> 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 >
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