[Xorp-hackers] XORP on memory stringent embedded platform

edrt edrt@citiz.net
Fri, 26 Nov 2004 14:20:22 +0800

>> I managed to port the multicast subsystem of XORP to a embedded system,
>> functionalities including PIM-SM+Mld6igmp+MFEA+lib{xorp,proto,comm,mrt,xrl}.
>> The embedded system is memeory stringent (32M). The orignal system image size
>> is about 5M (os + app, which contains a lot functionalities implemented using C).
>> After add the XORP related functionality, the image grows to about 11M (debugging
>> information stripped) and the system free memory fall down to a low level.
>> So I doubt if I should port other part of XORP system to that embedded platform. 
>> I guess the main reason is because XORP is written in C++. Does the big image size
>> related to stl/template ? Is there good ways to reduce XORP image size? 
>> (BTW, I have tried -Os option, but the compiler seems too old to support that.
>>  May be I should upgrade the compiler.)
>I just did two compilations (using gcc-3.4.2) with the -O2 flag and
>the -Os flag respectively. The size of the stripped pim/test_pim
>stand-alone binary (which contains all multicast-related stuff) with
>the -O2 flag is 6.4MB. The size with the -Os flag is 5.8MB.
>Of course, there is no guarantee that you will similar size
>reduction if you upgrade your compiler, but it may be worth to try.
>Does your system supports dynamic libraries? If yes, then using
>XORP dynamic libraries can also help to reduce the size (see the
>previous email on the subject by Bruce who is working right now on
>enabling dynamic linkage).

Thanks Bruce and Pavlin for the suggestion.

Yes, VxWorks (the embedded os I'm using) supports dynamic library.
And I'll try to make the multicast functionality dynamically loadded as
you suggested.

But on the other hand, even if XORP is dynamically loadded, it still
consumes much of the system memeory after it is loadded. Also, some of
the embedded platform is Flash stringent (16M), as XORP grows this could
also become a problem on embedded platform (though, at present, I can
compress the dynamic library stored on the flash), 

If stl/template is the main factor result in big image size, is there any
possiblity XORP can also be build & release with some kind of small memory
footprint library? (if XORP is also intended to be deployed on embedded system) 

I just do a quick google search, and found this

	uSTL (micro-STL) is a partial implementation of the STL specification
	intended to reduce code size of the derivative programs. 

seems worth a try...

Anyway, if anyone knows any tricky method that could reduce the XORP program
size, pls post it on the thread, I'm really appreciate of that.