1
- # JavaScript* Runtime for Zephyr* OS
1
+ # JavaScript\ * Runtime for Zephyr& trade ; OS
2
2
3
- The JavaScript Runtime for Zephyr OS project (ZJS for short) provides an IoT
3
+ The JavaScript\* Runtime for the Zephyr& trade ; OS project (ZJS for short) provides an IoT
4
4
web runtime environment with JavaScript APIs for the Zephyr operating system,
5
- based on the JerryScript engine. It is intended for systems with low memory
5
+ based on the JerryScript engine. It is intended for systems with little memory
6
6
where Node.js with V8 is too big.
7
7
8
- This code requires a local copy of JerryScript and Zephyr source, and we
8
+ This code requires a local copy of JerryScript and Zephyr OS source. We
9
9
will upstream patches to those projects as appropriate, but this repo is for
10
10
everything else.
11
11
12
12
## Getting Started
13
13
14
14
This section will walk you through building and running your first ZJS
15
- application on Arduino 101.
15
+ application on Arduino 101\* .
16
16
17
17
### Prerequisites
18
18
* [ Arduino 101 board] ( https://www.arduino.cc/en/Main/ArduinoBoard101 )
19
- * Ubuntu 16.04 host; adapt as necessary for other platforms.
19
+ * Ubuntu\* 16.04 host; adapt as necessary for other platforms.
20
20
* If you're behind a proxy, go through all the [ usual pain]
21
21
(https://github.com/01org/zephyr.js/wiki/Proxy ) to get ssh working to
22
22
github.com and http working to zephyrproject.org.
@@ -39,7 +39,7 @@ $ git clone http://github.com/01org/zephyr.js.git
39
39
```
40
40
41
41
#### Install the Zephyr SDK
42
- Download the [ latest Zephyr SDK] (https://nexus .zephyrproject.org/content/repositories/releases/org/zephyrproject/zephyr-sdk/ ), then:
42
+ Download the [ latest Zephyr SDK] (https://www .zephyrproject.org/downloads/tools ), then:
43
43
``` bash
44
44
$ chmod +x /path/to/zephyr-sdk-< VERSION> -i686-setup.run
45
45
$ sudo /path/to/zephyr-sdk-< VERSION> -i686-setup.run
@@ -48,15 +48,14 @@ $ sudo /path/to/zephyr-sdk-<VERSION>-i686-setup.run
48
48
Follow the prompts, but the defaults should be fine.
49
49
50
50
#### Set up Zephyr SDK environment variables
51
- It is recommended that you add the following two lines to your ` ~/.bashrc ` so
52
- that you don't have to type them again. If you installed your Zephyr SDK
51
+ Add the following two lines to your ` ~/.bashrc ` . If you installed your Zephyr SDK
53
52
elsewhere, adjust as needed.
54
53
``` bash
55
54
export ZEPHYR_GCC_VARIANT=zephyr
56
55
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
57
56
```
58
57
59
- Then source the .bashrc again :
58
+ Then source the .bashrc :
60
59
``` bash
61
60
$ source ~ /.bashrc
62
61
```
@@ -162,8 +161,8 @@ commands. If not, press the Master Reset button, and either way do:
162
161
$ make dfu
163
162
```
164
163
165
- After this completes flashing successfully, reboot the device with the Master
166
- Reset button to start the application, and after a few seconds the onboard LEDs
164
+ After this flashing completes successfully, reboot the device with the Master
165
+ Reset button to start the application. After a few seconds the onboard LEDs
167
166
should start cycling.
168
167
169
168
You have built and run your first ZJS application!
@@ -178,22 +177,22 @@ you just need to repeat the last two steps with the desired JavaScript filename.
178
177
Without the serial console set up, you won't be able to see error messages and
179
178
other output from your ZJS application. To hook up the serial console, you need
180
179
a USB to TTL Serial Cable, such as the TTL-232R-3V3. On that particular cable,
181
- you wire the black wire to ground on the Arduino, the orange wire to GPIO pin 0
180
+ you wire the black wire to ground on the Arduino 101 board , the orange wire to GPIO pin 0
182
181
(RX), and the yellow wire to GPIO pin 1 (TX). The other three are unused.
183
182
184
- When you plug this in, the device should show up as something like
183
+ When you plug this in, the device should show up as something such as
185
184
` /dev/ttyUSB0 ` . You can then use the screen command to connect to the device
186
- with a command like this:
185
+ with a command such as this:
187
186
188
187
``` bash
189
188
$ watch screen /dev/ttyUSB0 115200
190
189
```
191
190
192
- The watch utility will restart screen you disconnect and reconnect your
193
- Arduino, so you shouldn't miss anything. You can leave a dedicated terminal
191
+ The ` watch ` utility will restart screen when you disconnect and reconnect your
192
+ Arduino 101 , so you shouldn't miss anything. You can leave a dedicated terminal
194
193
running to watch the output.
195
194
196
- In screen, you can view scrollback with Ctrl-a , Esc, followed by PgUp/PgDn.
195
+ In ` screen ` , you can scroll back the output with Ctrl-A , Esc, followed by PgUp/PgDn.
197
196
Then Esc again to get back to the latest output (out of "Copy Mode").
198
197
199
198
#### Debugging
@@ -204,7 +203,7 @@ to connect to the device with a debugger. Then you can set breakpoints such as
204
203
205
204
#### Additional details
206
205
207
- See below for more details , such as increasing the space available for your
206
+ See below for a few more tips , such as increasing the space available for your
208
207
application on the Arduino 101, or how to use ZJS with the FRDM-K64F.
209
208
210
209
## Contributing
@@ -247,8 +246,8 @@ you (
[email protected] ). I need to make sure of the license details before
247
246
I add it to the repo.
248
247
249
248
The ZJS_PARTITION environment variable, set automatically by zjs-env.sh, is
250
- what controls whether the build targets 144KB or 256KB. The symptom if you use
251
- the wrong one is that the ARC side won't come up, because we'll be attempting
249
+ what controls whether the build targets 144KB or 256KB. If you use
250
+ the wrong one, the ARC side won't come up because we'll be attempting
252
251
to start it from the wrong place on the flash. (Note: both the ARC and X86
253
252
images have to be rebuilt and reflashed when you switch partition sizes.)
254
253
@@ -295,7 +294,7 @@ attempt the DFU command, or it will fail.)
295
294
$ make JS=samples/HelloWorld.js
296
295
```
297
296
298
- This will build the system image, resulting in outdir/zephyr.bin as the final
297
+ This will build the system image, resulting in ` outdir/zephyr.bin ` as the final
299
298
output. To flash this to your device with dfu-util, first press the Master Reset
300
299
button on your Arduino 101, and about three seconds later type:
301
300
@@ -316,18 +315,19 @@ as with `HelloWorld.js` above.
316
315
317
316
## JS Minifier
318
317
319
- To save space it is recommended to use a minifier. In convert.sh, the script
320
- used to encode your JS into a source file, we use uglifyjs. If you didn't
318
+ To save space it is recommended to use a minifier. In ` convert.sh ` , the script
319
+ used to encode your JS into a source file, we use ` uglifyjs ` . If you didn't
321
320
install this earlier, you can do so with the command:
322
321
``` bash
323
322
sudo apt-get install node-uglify
324
323
```
325
324
326
325
## FRDM-K64F Platform
327
326
328
- See the [ Zephyr Wiki] (https://wiki.zephyrproject.org/view/NXP_FRDM-K64F ) for general information about Zephyr on the FRDM-K64F.
327
+ See the [ Zephyr Project Wiki] (https://wiki.zephyrproject.org/view/NXP_FRDM-K64F ) for general information
328
+ about running Zephyr OS on the FRDM-K64F.
329
329
330
- The instructions below are assuming Ubuntu 14.04 on the host PC.
330
+ The instructions below assume Ubuntu 14.04 on the host PC.
331
331
332
332
Connect a micro-USB cable from the device to your PC.
333
333
342
342
$ minicom -D /dev/ttyACM0
343
343
```
344
344
345
- worked for me, but I typically had to try either command several times before it
346
- would work. The benefit of minicom is it will keep running even if you unplug
345
+ ( I typically had to try either command several times before it
346
+ would work.) The benefit of minicom is it will keep running even if you unplug
347
347
the cable and then plug it back in later.
348
348
349
- ( Check your dmesg output or watch your /dev directory to know what device it
350
- shows up as.)
349
+ Check your dmesg output or watch your /dev directory to know what device it
350
+ shows up as.
351
351
352
352
Then, follow [ these instructions] (https://developer.mbed.org/handbook/Firmware-FRDM-K64F ) to update your firmware.
353
353
@@ -357,16 +357,16 @@ $ make BOARD=frdm_k64f JS=samples/HelloWorld.js
357
357
$ cp outdir/zephyr.bin /media/< USERNAME> /MBED/
358
358
```
359
359
360
- After you copy the new .bin file to that directory, the device will reboot,
361
- blink an LED quickly as it writes the image somewhere , and then you should see
360
+ After you copy the new ` .bin ` file to that directory, the device will reboot,
361
+ blink an LED quickly as it writes the image, and then you should see
362
362
the device reconnect as a USB storage device to your PC. Then you can press the
363
363
Reset button to run the Zephyr image. You should see "Hello, ZJS world!" output
364
364
on the serial console in less than a second.
365
365
366
366
If something doesn't work, you may want to establish that you're able to
367
367
upload the K64F [ hello world application] (https://developer.mbed.org/platforms/FRDM-K64F/#flash-a-project-binary ).
368
368
369
- Then, you could try the Zephyr hello_world sample to narrow down the problem:
369
+ Then, you could try the Zephyr OS ` hello_world ` sample to narrow down the problem:
370
370
``` bash
371
371
$ cd deps/zephyr/samples/hello_world/nanokernel
372
372
$ make pristine && make BOARD=frdm_k64f
@@ -376,4 +376,4 @@ $ cp outdir/zephyr.bin /media/<USERNAME>/MBED/
376
376
Using the same procedure as above, once you hit Reset you should see
377
377
"Hello World!" within a second on your serial console.
378
378
379
- * Other names and brands may be claimed as the property of others.
379
+ Zephyr is a trademark of the Linux Foundation. * Other names and brands may be claimed as the property of others.
0 commit comments