Application under VxWorks - looking for suggestions

Matthias Lang matthias@REDACTED
Mon Oct 6 11:34:45 CEST 2003


Massimo Cesaro writes:

 > I'm starting to cross compile Erlang for VxWorks, and I looking for tips
 > and hints to speed from people on the list who maybe already did
 > that.

Last March, I was going through my HTTP logs and noticed someone who'd
stumbled upon our site with this search string:

  "help I run VxWorks get me out of here"

;-)

 > I'm looking for creating a stripped down version of Erlang and OTP
 > (there are a lot of goodies in OTP that I don't need) in order to
 > minimize RAM requirements, 

are you trying to minimise RAM or FLASH requirements? Stripping
unused modules won't save any RAM unless you're loading modules you
then don't use (why?), but it will save a lot flash.

We (corelatus) run Erlang on embedded hardware with no swap space. Our
older systems "only" have 32Mbyte of RAM. The typical total RAM
consumption of the Erlang VM running a fairly simple control
application is 8Mbyte, with an OS-enforced maximum of 14Mbyte. 

In other words: it's quite possible to run in 16Mbyte, but having more
DRAM will let you be lazier.

 > Given that I will only use a small subset of stdlib, is it 
 > safe to strip down the modules I don't need?

Module calls can be arbitrarily obfuscated in Erlang, e.g. you could
have code like this:

  apply(list_to_atom(lists:reverse("gnirts")), chr, ["hello", $e])

there's no tool in the world that can untangle that. So there is no
absolute safety. You can get relative safety by using the XREF tool
which comes with Erlang.

To make our embedded system, I wrote a script which stripped the
Erlang system. The result is about 1.2Mbyte of library .beams. I
didn't use SAE at all, partly because SAE was in its infancy when I
did the shrinking work and partly because we have enough flash so that
we don't have to worry about space that much.

Matthias



More information about the erlang-questions mailing list