The Zephyr Project* is a small open source real-time operating system (RTOS) for the Internet of Things (IoT). It’s ideal for low-powered, small memory footprint devices and prioritizes task execution like the Arduino 101* (branded Genuino 101* outside the U.S.). The Arduino 101 is a learning and development platform that uses a low-power Intel® Curie™ module powered by the Intel® Quark™ SE SoC. The Intel Quark SE SoC contains a single core 32 MHz x86 processor and the 32 MHz ARC processor. This guide demonstrates steps to flash a Zephyr application onto the X86, and ARC processors on an Arduino 101 platform. This is done with Ubuntu* in a VMware* workstation using a JTAG adapter. This JTAG method enables engineers to perform advanced development and debugging on the Arduino 101 platform through a small number of dedicated pins.
The hardware components used in this project are listed below:
- Arduino 101 module
- Two standard A plug to B plug USB cable
- A FlySwatter2
- An ARM-JTAG-20-10 ARM Micro JTAG adapter
Go to VMwarewebsite to download and install the latest VMware Workstation player for Windows*. Browse to the Ubuntu website to download the latest version of Ubuntu Desktop. Open VMware and create a new virtual machine using the downloaded Ubuntu image. Check virtualization settings in your computer’s BIOS to ensure they are enabled, otherwise VMware will not work.
Ensure the Ubuntu OS is up to date and install dependent Ubuntu packages.
- sudo apt-get update
- sudo apt-get install git make gcc gcc-multilib g++ libc6-dev-i386 g++-multilib python3-ply
Install the Zephyr Software Development (SDK) kit and run the installation binary.
- wget https://nexus.zephyrproject.org/content/repositories/releases/org/zephyrproject/zephyr-sdk/0.8-i686/zephyr-sdk-0.8-i686-setup.run
- chmod +x zephyr-sdk-0.8-i686-setup.run
- ./zephyr-sdk-0.8-i686-setup.run
Export the Zephyr SDK environment variables. ZEPHYR_SDK_INSTALL is where the Zephyr SDK installed.
- export ZEPHYR_GCC_VARIANT=zephyr
- export ZEPHYR_SDK_INSTALL=/home/nnle/zephyr-sdk
Save the Zephyr SDK environment variables for later use in new sessions.
- vi ~/.zephyrrc
- export ZEPHYR_GCC_VARIANT=zephyr
- export ZEPHYR_SDK_INSTALL=/home/nnle/zephyr-sdk
Git clone a repository to the Ubuntu.
- git clone https://gerrit.zephyrproject.org/r/zephyr && cd zephyr && git checkout tags/v1.5.0
Navigate to the Zephyr project directory and set the project environment variables.
- cd zephyr
- source zephyr-env.sh
Navigate to the example project and build the project for the Arduino 101 board.
- cd $ZEPHYR_BASE/samples/hello_world/microkernel
- make BOARD=arduino_101
Connecting FlySwatter2 to Arduino 101* (branded Genuino 101* outside the U.S.)
The first step is to connect the ARM micro JTAG connector to the FlySwatter2. Then, connect the FlySwatter2 to the Arduino 101 micro JRAG connector. The small white dot beside the micro JTAG header on the Arduinio 101 indicates the location of pin one. Insert the cable so it matches the dot. For more information on locating the micro JTAG connector on the Arduino 101, visit https://www.zephyrproject.org/doc/1.4.0/board/arduino_101.html.
Figure 1: Connect FlySwatter2 to Arduino 101 using ARM Micro JTAG Connector.
A Hardware Abstraction Layer (HAL) allows the computer operating system to interact with a hardware device. Add your username to HAL layer interaction permissions to control the FlySwatter2.
- sudo usermod –a –G plugdev $USERNAME
Grant members of the plugdev group permission to control the FlySwatter2.
- sudo vi /etc/udev/rules.d/99-openocd.rules
- # TinCanTools FlySwatter2
- ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="664", GROUP="plugdev"
Reload udev rules to apply the new udev rule without restarting the system.
- sudo udevadm control --reload-rules
Insert the standard A plug to B plug USB type B cable into the FlySwatter2 and the computer.
- dmesg | grep FTDI
In the Ubuntu window, FTDI USB Serial device should be displayed as below.
Figure 2: FlySwatter2 on Ubuntu.
The FlySwatter2 device should be connected to the Ubuntu as a removable device.
Figure 3: FlySwatter2 pop up message on virtual machine.
To backup the Arduino 101 factory settings, connect the FlySwatter2 to the Arduino 101 platform and the computer. Navigate to the Zephyr project directory, set the project environment variables, and then follow the prompt to backup the Arduino 101 factory settings. JTAG will back up the original flash into two files (A101_BOOT.bin and A101_OS.bin) in your Zephyr project directory.
- cd zephyr
- source zephyr-env.sh
- ./boards/arduino_101/support/arduino_101_backup.sh
Similarly, to restore the Arduino 101 factory settings, ensure the FlySwatter2 is properly connected to the Arduino 101 platform and the computer. The JTAG script will update the two files (A101_BOOT.bin and A101_OS.bin) in your Zephyr project directory.
- cd zephyr
- source zephyr-env.sh
- ./boards/arduino_101/support/arduino_101_load.sh
Navigate to the Zephyr project and build the binary image. The board type for ARC processor is arduino_101_sss_factory.
- cd zephyr
- source zephyr-env.sh
- cd $ZEPHYR_BASE/samples/hello_world/microkernel
- make pristine
- make BOARD=arduino_101_sss_factory
Ensure the FlySwatter2 is connected to the Arduino 101 platform and the computer, and then flash the image.