Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Flashing the Zephyr* Application Using a JTAG Adapter on the Arduino 101* (branded Genuino 101* outside the U.S.) on Ubuntu* under VMware*

$
0
0

Introduction

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.

Hardware Components

The hardware components used in this project are listed below:

Setting up VMware Workstation on Ubuntu*

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.

Setting up Development Environment for Zephyr* on Ubuntu* under VMware*

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.

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

Building the Application for Arduino 101* (branded Genuino 101* outside the U.S.)

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.

 FlySwatter2 on Ubuntu.

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.

Backup and Restore Factory Reset

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

Flashing the Zephyr* Image into the ARC Processor

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.

  • make BOARD=arduino_101_sss_factory flash

Flashing the Zephyr* Image onto the Intel® Quark™ SE SoC

Navigate to the Zephyr project and build the binary image. The board type for X86 processor is arduino_101_factory.

  • cd zephyr
  • source zephyr-env.sh
  • cd $ZEPHYR_BASE/samples/hello_world/microkernel
  • make pristine
  • make BOARD=arduino_101_factory

Ensure the FlySwatter2 is connected to the Arduino 101 platform and the computer, and then flash the image.

  • make BOARD=arduino_101_factory flash

The hello_world image should be successfully flashed onto the X86 processor.

Figure 5: Flash image successfully.

Summary

We have described how to build and flash the Zephyr hello_world image onto the ARC or X86 processor of the Arduino 101 platform on Ubuntu in VMware for experimentation and testing purposes. To experiment with different Zephyr projects on Arduino 101, such as heart rate monitor, go to https://gerrit.zephyrproject.org/r/#/admin/projects. To receive more information about the Intel Curie module and Zephyr project, sign up at https://software.intel.com/en-us/iot/hardware/curie.

Helpful References

About the Author

Nancy Le is a software engineer at Intel Corporation in the Software and Services Group working on Intel® Atom™ processor scale-enabling and IoT projects.

 

 


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>