|
| 1 | +### About Curie BSP port |
| 2 | +[Intel® Curie BSP](https://github.com/CurieBSP/main/blob/master/README.rst) is the SDK that will help you developing software on Curie based boards, for example with the [Arduino 101 board (AKA Genuino 101)](https://www.arduino.cc/en/Main/ArduinoBoard101). |
| 3 | + |
| 4 | +This folder contains necessary files to integrate JerryScript with Intel® Curie BSP, so that JavaScript can run on Arduino 101 board (AKA Genuino 101). |
| 5 | + |
| 6 | +### How to build |
| 7 | +#### 1. Preface |
| 8 | + |
| 9 | +Curie BSP only support Ubuntu GNU/Linux as host OS envirenment. |
| 10 | + |
| 11 | +Necessary hardwares |
| 12 | +* [FlySwatter2 JTAG debugger](https://www.tincantools.com/wiki/Flyswatter2) |
| 13 | +* [ARM-JTAG-20-10](https://www.amazon.com/PACK-ARM-JTAG-20-10-Micro-JTAG-adapter/dp/B010ATK9OC/ref=sr_1_1?ie=UTF8&qid=1469635131&sr=8-1&keywords=ARM+Micro+JTAG+Connector) |
| 14 | +* [USB to TTL Serial Cable](https://www.adafruit.com/products/954) |
| 15 | + |
| 16 | +#### 2. Prepare Curie BSP |
| 17 | + |
| 18 | +You can refer to a detailed document [Curie BSP](https://github.com/CurieBSP/main/releases). But, we summary the main steps below: |
| 19 | + |
| 20 | +##### 1. Get repo: |
| 21 | +``` |
| 22 | +mkdir ~/bin |
| 23 | +wget http://commondatastorage.googleapis.com/git-repo-downloads/repo -O ~/bin/repo |
| 24 | +chmod a+x ~/bin/repo |
| 25 | +``` |
| 26 | + |
| 27 | +##### 2. In ``~/.bashrc`` add: |
| 28 | +``` |
| 29 | +PATH=$PATH:~/bin |
| 30 | +``` |
| 31 | + |
| 32 | +##### 3. Create your directory for CurieBSP (eg. Curie_BSP): |
| 33 | +``` |
| 34 | +mkdir Curie_BSP && cd $_ |
| 35 | +``` |
| 36 | + |
| 37 | +##### 4. Initialize your repo: |
| 38 | +``` |
| 39 | +repo init -u https://github.com/CurieBSP/manifest |
| 40 | +``` |
| 41 | + |
| 42 | +##### 5. Download the sources files: |
| 43 | +``` |
| 44 | +repo sync -j 5 -d |
| 45 | +``` |
| 46 | + |
| 47 | +##### 6. Get toolchain (compilation/debug): |
| 48 | +Download [issm-toolchain-linux-2016-05-12.tar.gz](https://software.intel.com/en-us/articles/issm-toolchain-only-download), and uncompress it. |
| 49 | +**TOOLCHAIN_DIR** environment variable needs to match the toolchain destination folder |
| 50 | +You can use the command:``export TOOLCHAIN_DIR='path to files of the toolchain'`` |
| 51 | + |
| 52 | +Or you can just uncompress the toolchain tarball and copy the contents (`licensing readme.txt tools version.txt`) into `wearable_device_sw/external/toolchain`. |
| 53 | + |
| 54 | +##### 7. Get BLE firmware: |
| 55 | +Download [curie-ble-v3.1.1.tar.gz]( https://registrationcenter.intel.com/en/forms/?productid=2783) and uncompress the retrieved package into ``wearable_device_sw/packages`` folder |
| 56 | + |
| 57 | +You will first register in the web page. Then you will receive an email where is a download link. Click the link in the mail, choose the `curie-ble-v3.1.1.tar.gz (118 KB)` and download. |
| 58 | + |
| 59 | +##### 8. Get tools to flash the device: |
| 60 | +[https://01.org/android-ia/downloads/intel-platform-flash-tool-lite](https://01.org/android-ia/downloads/intel-platform-flash-tool-lite) |
| 61 | + |
| 62 | + |
| 63 | +#### 3. Build JerryScript and Curie BSP |
| 64 | +##### 1. Generate makefiles |
| 65 | +Run the Python script ``setup.py`` in ``jerryscript/targets/curie_bsp/`` with the full path or relative path of the ``Curie_BSP``: |
| 66 | +``` |
| 67 | +python setup.py <path of Curie_BSP> |
| 68 | +``` |
| 69 | + |
| 70 | +##### 2. One time setup. It will check/download/install the necessary tools, and must be run only once. |
| 71 | +In the directory ``Curie_BSP`` |
| 72 | +``` |
| 73 | +make -C wearable_device_sw/projects/curie_bsp_jerry/ one_time_setup |
| 74 | +``` |
| 75 | + |
| 76 | +##### 3. In the directory ``Curie_BSP`` |
| 77 | +``` |
| 78 | +mkdir out && cd $_ |
| 79 | +make -f ../wearable_device_sw/projects/curie_bsp_jerry/Makefile setup |
| 80 | +make image |
| 81 | +``` |
| 82 | + |
| 83 | +##### 4. Connect JTAG Debugger and TTL Serial Cable to Arduino 101 as below: |
| 84 | + |
| 85 | + |
| 86 | +##### 5. Flash the firmware |
| 87 | +``` |
| 88 | +make flash FLASH_CONFIG=jtag_full |
| 89 | +``` |
| 90 | + |
| 91 | + |
| 92 | +#### 4. Serial terminal |
| 93 | +Assume the serial port is ``ttyUSB0`` in ``/dev`` directory, we can type command ``screen ttyUSB0 115200`` to open a serial terminal. |
| 94 | + |
| 95 | +After the board boot successfully, you should see something like this: |
| 96 | +``` |
| 97 | +Quark SE ID 16 Rev 0 A0 |
| 98 | +ARC Core state: 0000400 |
| 99 | +BOOT TARGET: 0 |
| 100 | + 6135|QRK| CFW| INFO| GPIO service init in progress.. |
| 101 | + 6307|ARC|MAIN| INFO| BSP init done |
| 102 | + 6315|ARC| CFW| INFO| ADC service init in progress.. |
| 103 | + 6315|ARC| CFW| INFO| GPIO service init in progress... |
| 104 | + 6315|ARC| CFW| INFO| GPIO service init in progress... |
| 105 | + 6315|ARC|MAIN| INFO| CFW init done |
| 106 | +``` |
| 107 | +To test the JavaScript command, you should add characters ``js e `` to the beginning of the JavaScript command, like this: |
| 108 | +``js e print ('Hello World!');`` |
| 109 | + |
| 110 | +It is the uart command format of Curie BSP. `js` is cmd group, `e` is cmd name, which is short for eval, and `print ('Hello World!');` is the cmd parameters, which is the JavaScript code we want to run. |
| 111 | + |
| 112 | +You can see the result through the screen: |
| 113 | +``` |
| 114 | +js e print ('Hello World!');js e 1 ACK |
| 115 | +Hello World! |
| 116 | +undefined |
| 117 | +js e 1 OK |
| 118 | +``` |
| 119 | + |
| 120 | +`js e 1 ACK` and `js e 1 OK` are debug info of Curie BSP uart commands, which mean it receive and execute the command sucessfully. `Hello World!` is the printed content. `undefined` is the return value of the statement `print ('Hello World!')`. |
0 commit comments