REBOL Technologies

Cross-compiling Rebol for your favorite embedded board

Carl Sassenrath, CTO
REBOL Technologies
25-Dec-2012 21:37 GMT

Article #0526
Main page || Index || Prior Article [0525] || Next Article [0527] || 29 Comments || Send feedback

So, perhaps you found a nice gift package under the Christmas tree this year? Maybe it's a cute little embedded SoC (system-on-a-chip) board. Perhaps a Broadcom 2835 Raspberry Pi or TI OMAP Beaglebroad or Pandaboard? Cool.

Of course, the first thing you'll want to do after booting the board is to get Rebol running. It's easy, here's how.

To cross-compile Rebol you'll need the development toolchain and library header files for your SoC and Linux version. Usually you can download those from a website related to your specific board.

Next, figure out the paths to the embedded tools and includes (header files). For example on my box:

  1. The crosstools are at /opt/raspi/bin/ and they all begin with a prefix of arm-linux-
  2. The includes are at ~/raspi-linux/include

Assuming you already setup your R3 development environment (from github.com), you can now generate fresh R3 header files for your embedded linux using your local host environment (no crosstools yet):

carl@ub10:~/r3$ cd make
carl@ub10:~/r3/make$ make make OS_ID=0.4.3
carl@ub10:~/r3/make$ make clean prep

Note that the "make make 0.4.3" regenerates a makefile that will work for most embedded linux toolchains. (See src/tools/systems.r) You'll see the prep step rebuild the necessary R3 header files:

./r3-make -qs ../src/tools/make-headers.r
------ Building headers
... REBOL Interface Library
... Function Prototypes
698 function prototypes
... Function Argument Enums
... REBOL Constants Strings
...

Now, you are ready to make R3 with your crosstools and includes:

carl@ub10:~/r3/make$ make TOOLS=/opt/raspi/bin/arm-linux- INCL=~/raspi-linux/include

It will take just a minute to compile and link...

make[1]: Entering directory `/home/carl/r3/make'
mkdir -p objs
/opt/raspi/bin/arm-linux-gcc ../src/core/a-constants.c -c -DTO_LINUX -DREB_API
  -O2-fvisibility=hidden  -I/home/carl/raspi-linux/include -I../src/include/
  -o objs/a-constants.o
/opt/raspi/bin/arm-linux-gcc ../src/core/a-globals.c -c -DTO_LINUX -DREB_API
  -O2 -fvisibility=hidden  -I/home/carl/raspi-linux/include -I../src/include/
  -o objs/a-globals.o
...
/opt/raspi/bin/arm-linux-gcc -o r3 objs/a-constants.o objs/a-globals.o objs/a-lib.o ...
/opt/raspi/bin/arm-linux-strip r3
/opt/raspi/bin/arm-linux-nm -a r3
/opt/raspi/bin/arm-linux-nm: r3: no symbols
ls -l r3
-rwxrwxr-x 1 carl carl 449556 Dec 24 17:00 r3

Copy your new r3 over to your embedded system and power up Rebol. Now you've got some real power. It will run your Rebol programs identically to your other systems. You're all set to do great things.

Of course, R3 open source makes this possible now.

Merry Chirstmas. Enjoy.

29 Comments

Updated 10-Mar-2024   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code