Wednesday, April 16, 2014

Dart on Raspberry Pi.

Building Dart VM for the Raspberry Pi.

Introduction
These instructions will let you build and run the Dart standalone VM for a Raspberry Pi device running the Raspbian distribution of Linux. For now, this process will likely only work on a Linux machine.

Build
First, grab the Dart source as described in PreparingYourMachine and GettingTheSource.

Cross-compile
This build will require a cross-compiler that you can obtain by cloning this repository from github.

You can specify the cross-compiler to the build.py command using the --toolchain argument, as follows. From your Dart checkout:

$ ./tools/build.py -m release -a arm \
  --toolchain=/path/to/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf \
  runtime
You'll find the build products under out/ReleaseXARM/. You can optionally strip the dart binary to make it smaller:

$ /path/to/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-strip \
  out/ReleaseXARM/dart
Run on Hardware
To run Dart programs on the Pi, we'll need to create a dart-sdk using the host toolchain:

$ ./tools/build.py -m release -a ia32 runtime create_sdk
Then, we'll upload this sdk to the device:

$ scp -r out/ReleaseIA32/dart-sdk pi@[raspberry pi ip address]:./dart-sdk