Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 --- | 1 --- |
| 2 title: Fletch project | 2 title: Fletch project |
| 3 layout: page | 3 layout: page |
| 4 --- | 4 --- |
| 5 | 5 |
| 6 # The Fletch project | 6 # The Fletch project |
| 7 | 7 |
| 8 More details coming soon. | 8 Fletch is an **experimental** project to enable highly productive development |
| 9 for embedded devices. It is powered by the [Dart | |
| 10 language](https://www.dartlang.org/docs/dart-up-and-running/ch02.html) and a | |
| 11 fast, lean runtime. | |
| 12 | |
| 13 This page will take you through getting the Fletch platform installed on your | |
| 14 local developer PC so that you can run and write Fletch programs that target | |
| 15 embedded devices. Note that the current early version of Fletch supports only a | |
|
wibling
2015/10/05 15:19:59
NIT: I would swap "supports" and "only"
mit
2015/10/05 17:51:38
Done.
| |
| 16 single embedded device -- the Raspberry Pi 2 -- and that the only supported | |
|
wibling
2015/10/05 15:19:59
NIT: I would remove "that"
mit
2015/10/05 17:51:38
Done.
| |
| 17 client operating systems supported for development are MacOS and Linux (sorry, | |
| 18 no Windows support). | |
|
wibling
2015/10/05 15:19:59
yet? or is that promising too much?
mit
2015/10/05 17:51:38
I think so, let's just leave it as is until we und
| |
| 19 | |
| 20 If you just want to get a look at what Fletch programs look like, take a peak at | |
|
wibling
2015/10/05 15:19:59
peak -> peek
mit
2015/10/05 17:51:38
Done.
| |
| 21 our [samples page](samples.html). | |
| 22 | |
| 23 * [Installing the SDK](#installing-the-sdk) | |
| 24 * [Running your first program](#running-your-first-program) | |
| 25 * [Preparing your Raspberry Pi 2](#preparing-your-raspberry-pi-2) | |
| 26 * [Running on the Raspberry Pi](#running-on-the-raspberry-pi) | |
|
Søren Gjesse
2015/10/05 16:19:51
Add 2 here as well?
mit
2015/10/05 17:51:38
Done.
| |
| 27 * [Next steps](#next-steps) | |
| 28 | |
| 29 ## Installing the SDK | |
| 30 | |
| 31 First download the SDK. This is available as a .zip archive; pick the one that | |
|
Søren Gjesse
2015/10/05 16:19:51
`s around .zip
mit
2015/10/05 17:51:38
Done.
| |
| 32 matches the OS of the PC you will be developing your code on: | |
|
wibling
2015/10/05 15:19:58
Perhaps change "be developing your code on" to "be
mit
2015/10/05 17:51:39
Done.
| |
| 33 | |
| 34 * [MacOS, 32-bit](http://gsdview.appspot.com/fletch-archive/channels/dev/raw/0.1 .0-dev.3.0/sdk/fletch-sdk-macos-ia32-release.zip) | |
| 35 * [MacOS, 64-bit](http://gsdview.appspot.com/fletch-archive/channels/dev/raw/0.1 .0-dev.3.0/sdk/fletch-sdk-macos-x64-release.zip) | |
| 36 * [Linux, 32-bit](http://gsdview.appspot.com/fletch-archive/channels/dev/raw/0.1 .0-dev.3.0/sdk/fletch-sdk-linux-ia32-release.zip) | |
| 37 * [Linux, 64-bit](http://gsdview.appspot.com/fletch-archive/channels/dev/raw/0.1 .0-dev.3.0/sdk/fletch-sdk-linux-x64-release.zip) | |
| 38 | |
| 39 | |
| 40 Unzip this, and make sure that the Fletch command is in path by typing this in a | |
|
wibling
2015/10/05 15:19:59
NIT: remove "that"
"path" -> "the path"
Perhaps
mit
2015/10/05 17:51:38
Done.
| |
| 41 terminal window: | |
| 42 | |
| 43 ~~~ | |
| 44 cd $HOME | |
| 45 unzip ./Downloads/fletch-sdk-macos-x64-release.zip | |
| 46 export "PATH=$PATH:$HOME/fletch-sdk/bin" | |
| 47 ~~~ | |
| 48 | |
| 49 Test that the Fletch program works, it should print a version number to the cons ole: | |
|
wibling
2015/10/05 15:19:59
NIT: remove "that"
mit
2015/10/05 17:51:38
Done.
| |
| 50 | |
| 51 ~~~ | |
| 52 fletch --version | |
| 53 ~~~ | |
| 54 | |
| 55 ## Running your first program | |
| 56 | |
| 57 Let’s go ahead and run our first Fletch program. This is a simple program that | |
| 58 prints Hello. In your command line type: | |
| 59 | |
| 60 ~~~ | |
| 61 cd $HOME/fletch-sdk/samples/general/ | |
| 62 fletch run hello.dart | |
| 63 ~~~ | |
| 64 | |
| 65 You should see output that looks like this on your screen: | |
|
wibling
2015/10/05 15:19:59
Perhaps: "this" -> "the below"
mit
2015/10/05 17:51:39
Done.
| |
| 66 | |
| 67 ~~~ | |
| 68 Hello from Darwin running on ‘michael-pc2’ | |
| 69 ~~~ | |
| 70 | |
| 71 Try to open ```hello.dart``` in your favorite editor. We recommend the Atom | |
|
Søren Gjesse
2015/10/05 16:19:51
Isn't just one ` sufficient here?
mit
2015/10/05 17:51:39
Done.
| |
| 72 editor by Github with the Dart plugin. Pretty easy to read, right? | |
|
Søren Gjesse
2015/10/05 16:19:51
With the analyzer not supported you will see a bun
mit
2015/10/05 17:51:38
Yes, added a note, and filed an enhancement bug to
| |
| 73 | |
| 74 But what actually happened when we asked the ```fletch``` command to run | |
| 75 ```hello.dart```? By default ```fletch``` is connected to a local session, | |
| 76 which is connected to a local VM (Virtual Machine) running on your developer PC. | |
| 77 When you ask ```fletch``` to run the program, it compiles the program to byte | |
| 78 code, and then passes it to the local Fletch VM for execution. The VM passes | |
| 79 back the result, and fletch prints it to your command line. | |
| 80 | |
| 81  | |
| 82 | |
| 83 Now let’s get things running on your Raspberry! | |
|
Søren Gjesse
2015/10/05 16:19:51
Maybe add a paragraph:
If you already have a work
mit
2015/10/05 17:51:38
Done.
| |
| 84 | |
| 85 ## Preparing your Raspberry Pi 2 | |
| 86 | |
| 87 ### Step 1: Raspbian operating system | |
| 88 | |
| 89 In this first step we will get a copy of the Raspberry operating system, and get | |
|
wibling
2015/10/05 15:19:59
NIT: Either "Raspberry Pi 2's" or "Raspbian" inste
mit
2015/10/05 17:51:38
Done.
mit
2015/10/05 17:51:39
Done.
| |
| 90 it written to your SD card. You can skip this step if you already have Raspbian | |
| 91 running. Otherwise follow these steps to get the image installed: | |
| 92 | |
| 93 * Download the zip file containing 'Raspbian Jessie' from the [Raspbian download | |
| 94 page](https://www.raspberrypi.org/downloads/raspbian/). | |
| 95 * Unzip the file by typing this in a termnal window: | |
| 96 * On Mac: ```ditto -x -k 2015-09-24-raspbian-jessie.zip .``` | |
| 97 * On Linux: ```unzip 2015-09-24-raspbian-jessie.zip``` | |
| 98 * Follow the steps to [get the .img file onto your SD | |
| 99 Card](https://www.raspberrypi.org/documentation/installation/installing-images/ README.md). | |
| 100 | |
| 101 ### Step 2: Configure the IP address for the Raspberry Pi | |
| 102 | |
| 103 We need to enable IP communication between your developer PC and your Raspberry | |
| 104 Pi. You can either connect your Raspberry to your router (via a cable or WiFi), | |
| 105 or you | |
| 106 add a second Ethernet adapter to your developer PC and connect to the | |
|
wibling
2015/10/05 15:19:59
NIT: missing a "can" between "you" and "add"
mit
2015/10/05 17:51:38
Done.
| |
| 107 Raspberry Pi directly via a cable. | |
| 108 | |
| 109 There are several ways you can configure the IP number of the Raspberry: | |
| 110 | |
| 111 * *Option 1*: If you have your Raspberry connected to a monitor and you are conn ecting it to a router that uses DHCP (i.e. allocates IPs automatically), then yo u can use this approach: | |
| 112 * Boot the Raspberry | |
| 113 * After boot enter ```sudo ip show addr``` in a terminal prompt on the Raspber ry. | |
| 114 * Note down the IP as we will be using it below. | |
|
wibling
2015/10/05 15:19:59
You could also mention that the user can assign a
mit
2015/10/05 17:51:39
Done.
| |
| 115 | |
| 116 * *Option 2*: If you are on a Linux developer PC, you can also configure the ima ge directly from your developer PC. | |
| 117 * Mount the SD card | |
| 118 * Enter the following in a console: ```$HOME/fletch-sdk/platforms/raspberry-pi 2/setup-ip.sh <path to SD card's boot partition>``` | |
| 119 | |
| 120 * *Option 3*: If you are on a Mac developer PC, you can connect directly to the Raspberry Pi via an USB Network adapter connected to the Raspberry Pi via a netw orking cable: | |
| 121 * Turn off your Raspberry Pi | |
| 122 * Open System Preferences and pick the Network icon | |
| 123 * Plug the USB Ethernet adapter into your Mac | |
| 124 * Change the IPv4 option to ```Manually``` | |
| 125 * Enter the IP Address ```192.168.2.1``` | |
| 126 * Go back to System Preferences and pick the Sharing icon | |
|
wibling
2015/10/05 15:19:59
Perhaps also mention "Enable sharing for the USB E
mit
2015/10/05 17:51:38
Done.
| |
| 127 * Turn your Raspberry Pi back on | |
| 128 * After a little while you should be able to ping the Raspberry Pi at ```192.1 68.2.2``` | |
|
Søren Gjesse
2015/10/05 16:19:51
Is the Mac acting as a DHCP server always assignin
mit
2015/10/05 17:51:39
Yup. (That is, assuming the Raspberry is the first
| |
| 129 | |
| 130 ### Step 3: Install Fletch binaries | |
| 131 | |
| 132 **Note**: In the steps below, replace ```192.168..``` with whatever IP address y ou configured above. | |
| 133 | |
| 134 The last step is to install the Fletch runtime on the Raspberry Pi (see the | |
| 135 right-hand side of the architecture diagram above). Use the following commands. | |
| 136 | |
| 137 A. Copy the fletch package to the Raspberry Pi (the default password for | |
|
Søren Gjesse
2015/10/05 16:19:51
fletch package -> fletch-agent package.
mit
2015/10/05 17:51:38
Done.
| |
| 138 Raspbian is 'raspberry'): | |
|
Søren Gjesse
2015/10/05 16:19:50
for Raspbian -> for user 'pi' on Raspbian
mit
2015/10/05 17:51:39
Done.
| |
| 139 | |
| 140 ~~~ | |
| 141 cd $HOME/fletch-sdk | |
| 142 scp ./platforms/raspberry-pi2/fletch-agent*.deb pi@192.168..:/home/pi/ | |
| 143 ~~~ | |
| 144 | |
| 145 B. Install the package: | |
| 146 | |
| 147 ~~~ | |
| 148 ssh pi@192.168.. sudo dpkg --install /home/pi/fletch-agent*.deb | |
| 149 ~~~ | |
| 150 | |
| 151 You should see something like ```Unpacking fletch-agent...``` on your screen. | |
| 152 | |
| 153 ## Running on the Raspberry Pi | |
| 154 | |
| 155 The Fletch platform is now available on the Raspberry Pi 2. Let’s make our Hello | |
|
wibling
2015/10/05 15:19:58
NIT: Consistent use of "Raspberry Pi 2" or "Raspbe
mit
2015/10/05 17:51:38
Done.
| |
| 156 program run again, this time on the Raspberry Pi 2. Type the following command o n | |
|
Søren Gjesse
2015/10/05 16:19:51
nit: long line
mit
2015/10/05 17:51:39
Done.
| |
| 157 your local developer PC: | |
| 158 | |
| 159 ~~~ | |
| 160 cd $HOME/fletch-sdk/ | |
| 161 fletch run ./samples/general/hello.dart in session remote | |
| 162 ~~~ | |
| 163 | |
| 164 The first time you run in the remote session you will be asked to enter the IP | |
| 165 address. Enter the IP you picked in the previous step, e.g. ```192.168.2.2```. | |
| 166 | |
| 167 You should then see the following output on your screen: | |
| 168 | |
| 169 ~~~ | |
| 170 Hello from Linux running on raspberrypi. | |
| 171 ~~~ | |
| 172 | |
| 173 Do you notice the difference? As before Fletch compiled the hello.dart program | |
|
wibling
2015/10/05 15:19:59
NIT: Do -> Did
You have talked in past tense in m
mit
2015/10/05 17:51:38
Done.
| |
| 174 to byte code, but this time rather than passing it to the local VM via the local | |
| 175 session it passed it to the Raspberry Pi via the remote session. On the | |
| 176 Raspberry Pi, the Fletch VM Agent made sure that a VM (Virtual Machine) was spun | |
| 177 up, and the program was executed on it. The result of the program (the printing | |
| 178 to the console) was passed back by the VM to the Fletch command on the developer | |
| 179 PC, and it was printed to the local console. | |
| 180 | |
| 181 ## Next steps | |
| 182 | |
| 183 Ready for some more fun? Take a look at our [samples](samples.html), and read | |
| 184 more about the [Fletch tool]()tool.html. | |
| 185 | |
| 186 And don’t forget to send us some [feedback](feedback.html), and ask some | |
| 187 [questions](faq.html). | |
| OLD | NEW |