Porting Erlang

Kent Boortz kent@REDACTED
Mon Oct 23 17:39:36 CEST 2000


> Does anyone have any pointers on what it would take to port Erlang
> to VRTX? (http://www.mentor.com/embedded/vrtxos/index.html)
> 
> The target system would be an MPC850 running VRTX and it would have
> only a boot flash - though a ram disk filesystem could be created
> from the flash image if needed.

I don't think there is anything written about porting Erlang to a new
embedded target. There have been prototype ports to some embedded
operating systems. The only supported embedded port is VxWorks.

Erlang/OTP is a bit POSIX/Unix oriented but it is possible to port it
to a non POSIX OS as well, only a bit harder. The Window port shows it
can be done.

Some comments:

  - VRTX seem to have a POSIX library and a complete TCP/IP stack so
    the libraries needed are probably there. Erlang put some high
    demands on the socket library so if there are some strange bugs in
    VRTX TCP/IP stack, especially with non blocking I/O, then you will
    probably run into it.

  - All C files, except "beam_emu.c", should compile with any ANSI C
    compiler. We compile "beam_emu.c" with GCC to use a special GCC
    feature that makes the decoding of the Erlang virtual instructions
    twice as fast.  But you should be able to compile without GCC if
    you define the preprocessor symbol NO_JUMP_TABLE. You define it by
    running make like

        % gmake TYPE_FLAGS="-g -O2 -DNO_JUMP_TABLE"

    Also note that "beam_emu.c" contains a huge switch statement,
    your C compiler or your machine setup may not be able to handle
    it. If not, try disabling the optimizations first, "-O1" or
    even "-O0" but this will of cause reduce the speed even more.
    I think it is possible to use GCC for compiling to a VRTX target
    but haven't found any real prof of this.

  - I assume you have to cross compile. The usual configure script
    does not handle this. Look at the VxWork specific files and
    do something similar.

  - The Erlang distribution, i.e. how Erlang nodes communicate,
    normally use TCP/IP. But you can write your own driver and enable
    Erlang nodes to use the native message passing in VRTX. I don't
    know how much work this is but the process is documented.

kent



More information about the erlang-questions mailing list