Zephyr on tinyTILE – Part 1

INTRODUCING ZEPHYR:

 
The Zephyr OS is based on a small-footprint kernel designed for use on resource-constrained systems: from simple embedded environmental sensors and LED wearables to sophisticated smart watches and IoT wireless gateways.You can build your innovative projects for smart cities, smart home, and even more cool use cases – simpler and easier with software tools for the tinyTILE board.

The Zephyr kernel supports multiple architectures, including ARM Cortex-M, Intel x86, ARC, NIOS II and RISC V,and offers a number of features that distinguish it from other small-footprint OS’s:

  • Highly configurable: Allows an application to incorporate only the capabilities it needs as it needs them, and to specify their quantity and size.
  • Compile-time resource definition: Allows system resources to be defined at compile-time, which reduces code size and increases performance.
  • Minimal error checking: Provides minimal run-time error checking to reduce code size and increase performance. An optional error-checking infrastructure is provided to assist in debugging during application development.
  • Extensive suite of services. Offers a number of familiar services for development, including – Multi-threading Services, Memory Allocation Services, Inter-thread Data Passing Services and, Power Management Services

SETTING UP THE DEVELOPMENT ENVIRONMENT:

 
To install the software components required to build Zephyr applications on Windows, you will need to build or install a toolchain.

  1. Install Python
  2. Install Git
  3. Install MinGW – MinGW is the minimalist GNU development environment for native Windows applications. The Zephyr build system will execute on top of this tool set.
  4. Install the following packages for MinGW from their installer mingw-get-setup.exe:

    • Under Basic Setup
      • mingw-developer-toolkit
      • mingw32-base
    • Under All Packages -> MSYS
      • msys-base
      • msys-binutils
      • msys-w32api

  5. Launch the MSYS console. he installer does not create shortcuts for you so you’ll need to run this script in file explorer’s Address Bar – C:\MinGW\msys\1.0\msys.bat.
  6.  

  7. The Zephyr build process has a dependency on the Pthread and GNU regex libraries. Msys provides its own GNU library implementation that can be downloaded from the MinGW and Msys official repository: MinGW Repository with the following commands:

      mingw-get update
      mingw-get install libpthread msys-libregex-dev --all-related

    When done, move libregex files (libregex.a, libregex.dll.a, libregex.la) from C:\MinGW\msys\1.0\lib to C:\MinGW\mingw32\lib.

  8. We need to edit C:\MinGW\msys\1.0\etc\fstab to create an entry mapping from the Win32 path c:/mingw to the mount point /mingw The easiest way to do this is just copy the contents of file fstab.sample into fstab’s using:

      cp /etc/fstab.sample /etc/fstab

     
    Run this line to confirm that the mapping was added

      cat /etc/fstab
  9.  
    fstab

  10. Install ISSM (Intel® System Studio for Microcontrollers) We’d be covering more on this in a later post, for now under Options click on Customize and make sure Additionl Board Support (Arduino/Genuino 101) is installed as well.
  11.  
    ISMS

  12. From within the MSYS console, clone a copy of the Zephyr source into your home directory using Git:

      git clone https://gerrit.zephyrproject.org/r/zephyr

  13. Also within the MSYS console, set up environment variables for installed tools and for the Zephyr environment (using the provided shell script):

      export PATH=$PATH:/c/python27/

      export MINGW_DIR=/c/mingw

      export ZEPHYR_GCC_VARIANT=issm

      export ISSM_INSTALLATION_PATH=C:/IntelSWTools/ISSM_2016.1.067

      unset ZEPHYR_SDK_INSTALL_DIR

      source ~/zephyr/zephyr-env.sh

  14. Finally, you can try building the Hello World sample to check things out. In this example, we’ll build the hello_world sample for the Arduino 101 board:

      cd $ZEPHYR_BASE/samples/hello_world

      make board=arduino_101

  15. This will verify that all the tools and toolchain are setup correctly for your own Zephyr development. In the next blog post I’d be writing about how to setup and use ISSM to run the Hello World Example.

Rishabh is an Intel Software Innovator and Software Developer at Ericsson. While not at work, he loves to review restaurants, get acquainted with new technology, and visit new places.

Leave a Reply