Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cfriedt/greybus-for-zephyr

Greybus Module for the Zephyr Real-Time Operating System
https://github.com/cfriedt/greybus-for-zephyr

Last synced: 3 months ago
JSON representation

Greybus Module for the Zephyr Real-Time Operating System

Awesome Lists containing this project

README

        

.. _greybus_for_zephyr:

******************
Greybus for Zephyr
******************

Build Status
############
.. image:: https://github.com/cfriedt/greybus-for-zephyr/workflows/CI/badge.svg

Overview
########
This repository contains a `Greybus `_
`module `_ for the
`Zephyr Real-Time Operating System `_.

Building and Running
####################

First, ensure that all required tools are installed by following Zephyr's
`Getting Started Guide `_.

Next, clone and synchronize repositories.

.. code-block:: bash

west init -m https://github.com/cfriedt/greybus-for-zephyr.git zephyrproject
cd zephyrproject
west update

While that is updating, choose a board from Zephyr's list of
`Supported Boards `_.

Next, update git submodules. Currently, there is a git submodule for the
``manifesto`` utility.

.. code-block:: bash

cd greybus
git submodule init
git submodule update
cd ..

Lastly, flash firmware for the chosen ``$BOARD`` using the commands below.

.. code-block:: bash

cd zephyr
source zephyr-env.sh
git apply ../greybus/zephyr-gpio-get-direction.patch
git apply ../greybus/zephyr-sys-byteorder-posix.patch
git apply ../greybus/zephyr-dynamic-pthread-stacks.patch
west build -b $BOARD -t flash ../greybus/samples/subsys/greybus/net

A number of patches are required until respective functionality is added upstream in
the Zephyr Project.

Note, there may be an overlay required for the connectivity options that a particular
board supports.

IEEE 802.15.4 Overlay
*********************

In that case, say for IEEE 802.15.4 support, the ``west build`` command
above should be modified as shown below.

.. code-block:: bash

west build -b $BOARD -t flash ../greybus/samples/subsys/greybus/net \
-- -DOVERLAY_CONFIG="overlay-802154.conf"

Bluetooth Low Energy Overlay
****************************

In that case, say for BLE support, the ``west build`` command
above should be modified as shown below.

.. code-block:: bash

west build -b $BOARD -t flash ../greybus/samples/subsys/greybus/net \
-- -DOVERLAY_CONFIG="overlay-ble.conf"

Network Configuration
#####################

While Greybus is capable of operating over any reliable transport, the focus
of this project is TCP/IP (although quite an assortment of physical and
data-link layers are `supported in Zephyr `_).

Depending on the board that was chosen and the available connectivity
options, some additional steps may be required for network connectivity.

* `Network Setup for Bluetooth Low Energy `_
* `Network Setup for IEEE 802.15.4 `_

Once network connectivity is established, it should be possible to use an
`mDNS `_ browser such as
`Avahi `_ to scan for `service discovery `_.

.. code-block:: bash

avahi-browse -t -r _greybus._tcp
+ lowpan0 IPv6 zephyr _greybus._tcp local
= lowpan0 IPv6 zephyr _greybus._tcp local
hostname = [zephyr.local]
address = [2001:db8::1]
port = [4242]
txt = []

Client-Side Software Requirements
#################################

A Linux machine is required in order to connect to and control our Zephyr
device via Greybus so be sure to follow
`Linux Software Requirements `_.

Using Greybus for I/O
#####################

At this point, we should be ready to perform some I/O on our remote devices
using Greybus. Currently, this module supports the protocols below.

* `GPIO `_
* `I2C `_
* `SPI `_

Contribute Back
***************

In case a board was chosen that does not yet support Greybus, consider
submitting a `DeviceTree `_ overlay file similar
to `cc1352r_sensortag.overlay `_
and a board-specific configuration file similar to
`cc1352r_sensortag.conf `_.

The contribution guidelines for this module follow the
`Zephyr Contribution Guidelines `_.

To summarize,

#. Create an `Issue `_
#. Code up your contribution
#. Code up any `tests `_ and `samples `_ as required
#. Ensure that tests pass and samples run as expected
#. Make a `Pull Request `_

Additional Information
**********************

Additional Information about Greybus including videos, slide presentations,
and deprecated demo instructions can be found `here `_.

A compiled version of the `Greybus Specification `_
is available `here `_.