aboutsummaryrefslogtreecommitdiff
This is a prototype of "integration repository" for Linaro LITE team
(embedded device side, aka "Project Aeolus"). Its idea is to bring
known-good versions of various projects together, to allow reproducible
builds for multiple boards and to serve as a seed for CI efforts.

Prerequisites
=============

Zephyr SDK 0.9 should be installed in ~/opt/zephyr-sdk-0.9/ . If
you have it in different place, the easiest solution is to make a
symlink. Yet another solution is to make an "in-tree" SDK install from
scratch (may be helpful for CI and VMs/containers):

    make sdk

All components are includes in this repository as git submodules, so
this repository should be cloned with --recursive flag. If cloned
without it, just run:

    git submodule update --init --recursive --rebase

or

    make update

You'll need to re-run "make update" after each git pull, to pick up any
changes to submodules.

Before using this repository, you'll need to run following to setup
Zephyr build environment:

    source zephyr-environ.sh

This will allow to build JerryScript and MicroPython, but for Zephyr.js,
its own environment setup scripts should be sourced after that.

To streamline build environment handling for different projects and
avoid confusion and mistakes, `make` wrapper scripts are provided,
and that's recommended way to make builds. Note that if you use
wrapper scripts, you *do not* need to execute `source` command above.

With wrapper scripts, you would run commands like (see below for
explanations of what targets are available):

    ./zmake jerryscript BOARD=<board>
    ./zmake micropython BOARD=<board>
    ./zmake-z.js zephyr.js BOARD=<board>

(You need to use `zmake-z.js` wrapper to build Zephyr.js, and `zmake`
for the other targets).

Projects
========

You can build any of the projects below for a particular board with:

    make <project> BOARD=<board>

Or all projects with:

    make all BOARD=<board>

Note that to build a particular project, its build environment should
be already set up. The recommended alternative to that is to use
`zmake` and `zmake-z.js` wrapper scripts described above.

JerryScript
-----------

Build with e.g.:

    make jerryscript BOARD=frdm_k64f

The result is in the top-level directory, file

    jerryscript-<board>-<jrs_git_describe>-z<zephyr_git_describe>.bin

Note that JerryScript implements raw ECMAScript5 standard and doesn't
support any hardware access. No LED blinking. You can print something
with:

    print("Someting:", 2 + 2)


MicroPython
-----------

Build with e.g.:

    make micropython BOARD=frdm_k64f

The result is in the top-level directory, file

    micropython-<board>-<upy_git_describe>-z<zephyr_git_describe>.bin

MicroPython port includes support for accessing arbitrary Zephyr-defined
GPIO and timing, i.e. all needed to blink an LED. For example code and
instructions on blinking, follow
https://github.com/micropython/micropython/tree/master/zephyr#quick-example
(the code there needs to be updated for LED GPIO as used by your board!)


Zephyr.js
---------

Zephyr.js upstream currently officially supports only 2 boards: arduino_101
(x86) and frdm_k64f. In various places, it so far hardcodes support for
these 2 boards and bundles its own Zephyr snapshot, so building for other
boards is somewhat complicated. There's ongoing work to alleviate this, and
this repository includes pfalcon's Zephyr.js fork repository with some
patches applied to make building for other ports possible while the
upstream catches up.

Build with:

    ./zmake-z.js micropython BOARD=frdm_k64f

Note that you must use "zmake-z.js" wrapper script due to complicated
build environment setup (because Zephyr.js bundles its own Zephyr copy).

Known issue: you will receive interactive Kconfig question:

    System clock's h/w timer frequency (SYS_CLOCK_HW_CYCLES_PER_SEC) [] (NEW) 1000000

You should type some big number there. 1000000 shown above isn't really
a correct response, but it doesn't appear to be relevant for simple
tests like blinking an LED. Appearance of this query is mis-integartion
between build system of Zephyr.js and build system of the recent versions
of JerryScript and needs to be further investigated.

The result is in the top-level directory, file

    zephyr.js-<board>-<z.js_git_describe>-z<zephyr_git_describe>.bin

Default Zephyr.js mode of operation is no interactive mode, automatically
run a JavaScript application which is bundled into the firmware binary.
Steps above use the default "hello world" application, which prints a
message to the console.