Wednesday, April 16, 2014

Dart on Raspberry Pi.

Building Dart VM for the Raspberry Pi.

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.

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

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 command using the --toolchain argument, as follows. From your Dart checkout:

$ ./tools/ -m release -a arm \
  --toolchain=/path/to/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf \
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 \
Run on Hardware
To run Dart programs on the Pi, we'll need to create a dart-sdk using the host toolchain:

$ ./tools/ -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