[erlang-questions] Erlang on ARM9?

64 views
Skip to first unread message

Guy Wiener

unread,
Sep 19, 2011, 4:14:21 AM9/19/11
to Erlang Questions
Hello Erlangers,
I am checking an option to use Erlang to control a Linux-based device (a programmable helicopter).  Is there an efficient port of Erlang that works on top of an ARM9 processor?  If so, the usage scenario will be many processes running on a single node, with frequent message-passing, some access to binary files, and no shared data (no ETS, DETS or Mnesia).  Is this scenario likely to perform well on an embedded Erlang?

Thanks,
  Guy Wiener,
  Dept. of Computer Science and Applied Math,
  Weizmann Institute for Science.

Banibrata Dutta

unread,
Sep 19, 2011, 4:17:33 AM9/19/11
to Guy Wiener, Erlang Questions
On Mon, Sep 19, 2011 at 1:44 PM, Guy Wiener <wiene...@gmail.com> wrote:
I am checking an option to use Erlang to control a Linux-based device (a programmable helicopter).  Is there an efficient port of Erlang that works on top of an ARM9 processor?

Here's a part answer.
http://www.erlang-embedded.com/
 
 If so, the usage scenario will be many processes running on a single node, with frequent message-passing, some access to binary files, and no shared data (no ETS, DETS or Mnesia).  Is this scenario likely to perform well on an embedded Erlang?

 
--
regards,
Banibrata
http://www.linkedin.com/in/bdutta
http://twitter.com/edgeliving

Daniel Goertzen

unread,
Sep 19, 2011, 9:12:02 AM9/19/11
to Erlang Questions
I think that is cortex only, not ARM9 (correct me if I'm wrong).

I've built a working Erlang for a cortex-a8 before using vanilla sources; no special port was required.  I only tested it very briefly, but it seemed to work well.  I can't think of any reason why it wouldn't also work on an ARM9.  I built it from a Gentoo stage3 chroot on the target platform.  Browsing the gentoo mirrors, I see that stage3 tarballs are available for armv4, v5 (ARM926), v6, and v7(cortex).

I have also run Erlang on a 100MHz x86.  It was quite slow to start, but once up and running it was fine.  I suspect the slowness was due more to filesystem and io problems than Erlang itself.  Just wanted to give this datapoint because I know ARM9 devices operate in the low 100's of MHz.

Cheers,
Dan.

_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


Paulo Ferreira

unread,
Sep 20, 2011, 10:16:12 AM9/20/11
to Guy Wiener, Erlang Questions


Well, just it just compiles from source well.

I have experience using a S3C2440 board at 400 Mhz and on some informal benchmarks ( ring ) it is just 7 times slower than a 2,2 Ghz core 2 Duo Mac book.

From other erlang embedded experiences:

How do you control the hardware in C? Linux device drivers are very slow, when compared to direct memory access.
Doing NIFs and dynamic libs may be hard.
ARM processors are usually supported by the latest gcc version, and that is VERY good for Erlang porting.
If you try to compile Erlang with an older gcc version, you may get all the kind of "strange and wonderful" errors.
Check the gcc version of your toolchain!


My best regards

Paulo Ferreira

P.S.: Please replace "strange and wonderful" by the suitable words in your native language....

Guy Wiener

unread,
Sep 26, 2011, 7:38:19 AM9/26/11
to Paulo Ferreira, Daniel Goertzen, Erlang Questions
Looks like I'll have to compile from source - Embedded Erlang is not what I need because it includes its-own embedded Linux, and I need to install on an existing Linux.

Can someone who has done this before be as kind as writing a minimal how-to for cross-compiling Erlang to ARM?

Thanks again,
  Guy

Tony Rogvall

unread,
Sep 26, 2011, 7:48:05 AM9/26/11
to Guy Wiener, Erlang Questions
On 26 sep 2011, at 13:38, Guy Wiener wrote:

Looks like I'll have to compile from source - Embedded Erlang is not what I need because it includes its-own embedded Linux, and I need to install on an existing Linux.

Can someone who has done this before be as kind as writing a minimal how-to for cross-compiling Erlang to ARM?


I guess you found this link?:


/Tony


Thanks again,
  Guy

On Tue, Sep 20, 2011 at 5:16 PM, Paulo Ferreira <p...@isep.ipp.pt> wrote:

On 2011/09/19, at 09:14, Guy Wiener wrote:

> Hello Erlangers,
> I am checking an option to use Erlang to control a Linux-based device (a programmable helicopter).  Is there an efficient port of Erlang that works on top of an ARM9 processor?  If so, the usage scenario will be many processes running on a single node, with frequent message-passing, some access to binary files, and no shared data (no ETS, DETS or Mnesia).  Is this scenario likely to perform well on an embedded Erlang?
>
> Thanks,
>   Guy Wiener,
>   Dept. of Computer Science and Applied Math,
>   Weizmann Institute for Science.


Well, just it just compiles from source well.

I have experience using a S3C2440 board at 400 Mhz and on some informal benchmarks ( ring ) it is just 7 times slower than a 2,2 Ghz core 2 Duo Mac book.

>From other erlang embedded experiences:

       How do you control the hardware in C?  Linux device drivers are very slow, when compared to direct memory access.
       Doing NIFs and dynamic libs may be hard.
       ARM processors are usually supported by the latest gcc version, and that is VERY good for Erlang porting.
       If you try to compile Erlang with an older gcc version, you may get all the kind of "strange and wonderful"  errors.
       Check the gcc version of your toolchain!


My best regards

Paulo Ferreira

P.S.: Please replace "strange and wonderful" by the suitable words in your native language....

       

_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

"Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"



Banibrata Dutta

unread,
Sep 26, 2011, 8:22:22 AM9/26/11
to Guy Wiener, Erlang Questions
This ARM9 in question would have some kind of a cross compile environment. For example, there's a rather popular (& cheap) ARM9 board called mini2440, and there are 2-3 different cross compilers... there's one from FriendlyARM, there's one from a co. called Pengutronix, then there's an old one from ARM itself, and some folks have rolled their own.

Gustav Simonsson

unread,
Sep 26, 2011, 8:39:56 AM9/26/11
to Tony Rogvall, Erlang Questions

The trapexit guide assumes you have a proper cross compilation toolchain.
You can generate a ARM9 toolchain using OpenEmbedded either by following
one of the guides online for creating a OE toolchain or by configuring OE
for a ARM9 machine and building some app or system image with it, as that
will also generate a ARM9 toolchain.

Regards,
Gustav Simonsson

----- Ursprungligt meddelande -----
Från: "Tony Rogvall" <to...@rogvall.se>
Till: "Guy Wiener" <wiene...@gmail.com>
Kopia: "Erlang Questions" <erlang-q...@erlang.org>
Skickat: måndag, 26 sep 2011 13:48:05
Ämne: Re: [erlang-questions] Erlang on ARM9?

Matthias Lang

unread,
Sep 27, 2011, 1:03:39 PM9/27/11
to Gustav Simonsson, Erlang Questions
On Monday, September 26, Gustav Simonsson wrote:

> The trapexit guide assumes you have a proper cross compilation toolchain.

Yes. And, if you want to compile R14B (i.e. the current Erlang
version), it's best to ignore the trap exit guide, it's intended
for R13B03 and earlier.

(I wrote the trap exit guide for R10B, based on things I'd picked up
since R7 or something. A bit after R13B04 came out, I changed the wiki
page to say "don't bother reading this if you're using R13B04 or
later" near the top. Maybe it's time for me to retire the whole page,
R14B is firmly established.)

> You can generate a ARM9 toolchain using OpenEmbedded either by following
> one of the guides online for creating a OE toolchain or by configuring OE
> for a ARM9 machine and building some app or system image with it, as that
> will also generate a ARM9 toolchain.

Another popular (free) toolchain is DENX ELDK

http://www.denx.de/wiki/DULG/ELDK

I haven't used OpenEmbedded, so I don't know if it's better or worse;
just mentioning it as another alternative.

Matt

Guy Wiener

unread,
Oct 3, 2011, 6:25:54 AM10/3/11
to Erlang Questions
I've tried running the otp_build script with an xcomp configuration file, but encountered the following problem: the configuration script tries to run the file generated by the cross-compiler and fails, although the --host flag is given.

In details:
I run "./otp_build configure --xcomp-conf=xcomp/erl-xcomp-arm-linux-gnu.conf"
The bootstrap build system is configured properly.  When configuring the cross host system, it uses the following command:

./configure --disable-dynamic-ssl-lib --build=arm-unknown-linux-gnu --host=arm-unknown-linux-gnu   CC=/opt/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-gcc CFLAGS=-mcpu=arm926ej-s CXX=/opt/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-g++ LD=/opt/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-ld --disable-hipe --cache-file=/dev/null

But then it causes the following error:

checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

But the configuration command is given a proper --host option!

I attach the cross compilation configuration file.  Any advice is warmly welcomed.

Thanks,
  Guy Wiener.
erl-xcomp-arm-linux-gnu.conf

Matthias Lang

unread,
Oct 3, 2011, 8:33:03 AM10/3/11
to Guy Wiener, Erlang Questions
Hi,

It's pretty odd that in your case --build is an ARM. Are you typing those
commands on an ARM system or on an x86?

Or: I don't know what you're doing but it looks wrong.

As a quick way to give you more information, I've put a log which shows
exactly what I do to build my ARM version in a clean erlang source tree:

http://www.corelatus.com/~matthias/cross_arm.log.gz

The only non-comment difference between my ARM xconf file and the MIPS
one supplied with R14B03 is:

erl_xcomp_host=arm-linux

Matt

----------------------------------------------------------------------

Gustav Simonsson

unread,
Oct 3, 2011, 8:46:30 AM10/3/11
to Matthias Lang, Erlang Questions

Unless you are compiling on the ARM platform for the that platform,
your --build is most likely wrong, as Matt pointed out.

You have erl_xcomp_build=arm-unknown-linux-gnu in your xcomp file,
try setting this value to 'guess' and see if that works, that will
run erts/autoconf/config.guess to grab the (most likely) correct
value for --build. It is also the default value for Erlang xcomp
conf files.

Regards,
Gustav Simonsson

----- Ursprungligt meddelande -----
Från: "Matthias Lang" <matt...@corelatus.se>


Till: "Guy Wiener" <wiene...@gmail.com>
Kopia: "Erlang Questions" <erlang-q...@erlang.org>

Skickat: måndag, 3 okt 2011 14:33:03


Ämne: Re: [erlang-questions] Erlang on ARM9?

Hi,

Guy Wiener

unread,
Oct 3, 2011, 8:53:00 AM10/3/11
to Erlang Questions
Thanks a lot, Gustav and Matthias, now I see the error of my ways :)
After changing the built option to default, the configuration proceeds, but get stuck on some missing redundant library.
How do I configure the cross-compilation to build only the bare minimum?  I don't need auxiliary libs, just basic Erlang.

Thanks again,
  Guy.

Gustav Simonsson

unread,
Oct 3, 2011, 9:34:18 AM10/3/11
to erlang-q...@erlang.org

You can put a file named 'SKIP' in the application directories in the lib directory, which will tell the build
to exclude them.

Other things you might be interested in doing to reach the bare minimum in terms of disk size for your
resulting build:

 * run arm-none-linux-gnueabi-strip (I think that's the right name given your xcomp conf)
on the resulting erts binaries to strip them of debug symbols.
* Call http://www.erlang.org/doc/man/beam_lib.html#strip_release-1 on the built beam files
* Remove the following directories in the resulting erts directory, and in all resulting application
directories: src, include, doc, man, examples.
* Compress the Erlang applications into .ez files.
* Use fancy gcc options like the -Os optimisation flag

Regards,
Gustav Simonsson

Guy Wiener

unread,
Oct 3, 2011, 10:50:26 AM10/3/11
to erlang-q...@erlang.org
My mistake: The build did not get stuck on some library, but erts is dependent on libcurses, which is not a part of the toolchain that I use (Sourcery lite).  Can I compile Erlang somehow without this lib? Curses! :)

Guy

Matthias Lang

unread,
Oct 3, 2011, 3:03:52 PM10/3/11
to Guy Wiener, erlang-q...@erlang.org
On Monday, October 03, Guy Wiener wrote:

> My mistake: The build did not get stuck on some library, but erts is
> dependent on libcurses, which is not a part of the toolchain that I use
> (Sourcery lite). Can I compile Erlang somehow without this lib? Curses! :)

Have you tried passing

--without-termcap

when you run configure?

Matt

Guy Wiener

unread,
Oct 4, 2011, 4:38:34 AM10/4/11
to erlang-q...@erlang.org
It finally cross-compiled - Thanks a million, Matt and Gustav! 
Now I need to tweak and trim it, I hope it'll be simpler.

Thanks again,
  Guy

Guy Wiener

unread,
Oct 6, 2011, 10:12:03 AM10/6/11
to erlang-q...@erlang.org
Continuing the saga: I managed to run the two first steps of the cross-compilation, i.e., configure and build, but when I run "./otp_build release -a some_dir", that dir is empty after the script runs.

What's the proper way to run the cross-compilation scripts for release?  I'm obviously doing something wrong.

Thanks again,
  Guy

On Mon, Oct 3, 2011 at 9:03 PM, Matthias Lang <matt...@corelatus.se> wrote:
Reply all
Reply to author
Forward
0 new messages