[gambit-list] Gambit and termite on an embedded system (Nintendo DS)?

Marc Feeley feeley at iro.umontreal.ca
Wed Oct 18 09:41:50 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 18-Oct-06, at 6:51 AM, Andrew Lentvorski wrote:

> Marc Feeley wrote:
>
>> So for your project I think you should start with modifying lib/ 
>> os.h to select a minimal set of OS functions that are provided by  
>> the Nintendo DS operating system.  Once you have something minimal  
>> working, you can tie in to more and more OS functionality as your  
>> needs grow.
>> Please keep me informed.  In beta 20, I have reorganize the lib/ 
>> os* files so that porting Gambit to an embedded system is easier.   
>> If you find other things that would help I would like to add them  
>> to the runtime system.
>
> Well, the size of my gsi is too large for the DS.  Upon looking at  
> the symbol table with nm, the most obvious candidate for removal is  
> anything having to do with "six".
>
> Is there a particular file I should look at to remove this?
>
> Thanks,
> -a

How large is your gsi and how much memory do you have on the DS?  In  
principle you can remove all of the Gambit runtime except for  
_kernel.scm and you can still compile programs (as long as they don't  
use the stuff you removed of course).  You can also create your own  
specialized runtime library with whatever you need.  If you want to  
keep the Gambit runtime more or less like it is, here are some simple  
things you can do:

- - strip the executable, this saves about 15%
- - define ___OPTIMIZE_SPACE at the top of gambit.h, this saves about 3%
- - use the configure option --enable-char-size=1, this saves about 10%
- - remove the code for SIX (in _io.scm remove all the section with the  
title
   "Scheme infix extension (SIX) parser", and in _nonstd.scm remove  
all the
   section starting with (define-runtime-macro (six.!x x) ...)); this
   saves about 10%
- - change _num.scm so that it does not use the fast bignum algorithms,  
i.e.
   (##define-macro (use-fast-bignum-algorithms) #f), this saves about 4%
- - remove the procedures for homogeneous numeric vectors (in _std.scm  
remove
   the calls to the macro define-prim-vector-procedures for all the  
vector
   types you do not need)
- - in _io.scm get rid of the code for all the port types you do not need,
   for example, to get rid of process ports remove the section with  
the title
   "Implementation of process device ports."
- - experiment with different C compiler options to see what reduces  
the code size

The executatble for the unmodified Gambit on my MacBook Pro is 3.1  
megabytes.  After applying the first five suggestions the executable  
is 31% smaller.  I'm sure you can get it to half the original size  
with only a little bit more work.

I wish there was a more programmatic way to disable all these  
subsystems, but that's the best that can be done now.

Marc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD4DBQFFNi8e//V9Zc2T/v4RAtjfAJdP0NLFbnshl7U4vSpDGt2I97t+AKCGCB7/
Veb2U5jNEfGllUfUpPK0Rw==
=hSiJ
-----END PGP SIGNATURE-----



More information about the Gambit-list mailing list