Code Monkey home page Code Monkey logo

gbsim's Introduction

Greybus Simulator (gbsim)

A tool which simulates an AP Bridge, SVC, and an arbitrary set of Ara modules plugged into Greybus.

Provided under BSD license. See LICENSE for details.

Install

The easiest path to get started is to run the kernel greybus support and gbsim on the same machine. This is accomplished using the dummy_hcd USB host+gadget driver in conjuction with the gadget configfs/functionfs features.

Build the kernel greybus subsystem and ES1 USB driver:

cd /path/to/greybus
make -C /usr/src/linux-headers-foo M=$PWD
make -C /usr/src/linux-headers-foo M=$PWD modules_install

Modify the gsim Makefile GBDIR to point at the kernel greybus (https://github.com/gregkh/greybus) directory as the simulator shares headers with the kernel code.

GBDIR = /path/to/greybus

Optionally uncomment CROSS_COMPILE and set the variable appropriately if you are cross compiling the simulator.

CROSS_COMPILE = arm-linux-gnueabi-

Build it:

gbsim has the following dependencies:

cd /path/to/gbsim
make
make install

Run

Load up the greybus framework and ES1 USB driver:

modprobe greybus
modprobe gb-es1
modprobe gb-phy

Now start the simulator:

modprobe configfs
mount -t configfs none /sys/kernel/config
modprobe libcomposite
modprobe dummy_hcd
gbsim -h /path/to -v

Where /path/to is the base directory containing the directory *hotplug-modules

gbsim supports the following option flags:

  • -b: enable the BeagleBone Black hardware backend
  • -h: hotplug base directory
  • -i: i2c adapter (if BBB hardware backend is enabled)
  • -v: enable verbose output

Using the simulator

After running output should appear as follows:

[I] GBSIM: gbsim gadget created
[D] GBSIM: event BIND,0
[D] GBSIM: event ENABLE,2
[D] GBSIM: Start SVC/CPort endpoints
[D] GBSIM: SVC->AP handshake sent
[D] GBSIM: event SETUP,4
[D] GBSIM: AP->AP Bridge setup message:
[D] GBSIM:   bRequestType = 41
[D] GBSIM:   bRequest     = 01
[D] GBSIM:   wValue       = 0000
[D] GBSIM:   wIndex       = 0000
[D] GBSIM:   wLength      = 000b
[D] GBSIM: AP->SVC message:
  00 00 03 00 00 01 01 00 00 00 00 
[I] GBSIM: AP handshake complete

This indicates that the simulated AP Bridge device was enumerated by the host, a handshake message was sent to the AP, and another handshake message received from the AP indicating that the handshake process has completed.

At this point, it's possible to hot plug/unplug modules by simply copying or removing a conformant manifest blob file in the /path/to/hotplug-module directory. Manifest blob files can be created using the Manifesto tool found at https://github.com/ohporter/manifesto. Using the Simple I2C Module as an example, a module can be inserted as follows:

cp /foo/bar/simple-i2c-module.mnfb /path/to/hotplug-module/MID1-simple-i2c-module.mnfb

The MIDn prefix is required to specify the Module ID that the module occupies, indicating its location in the endoskeleton where n is a decimal integer greater than 0 indicating the Module ID.

After module insertion, gbsim will report:

[I] GBSIM: MID1-simple-i2c-module.mnfb module inserted
[D] GBSIM: SVC->AP hotplug event (plug) sent

gbsim's People

Contributors

alexelder avatar gregkh avatar johnstultz-work avatar ohporter avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gregkh msgpo

gbsim's Issues

GBSIM examples not working properly

Hi, Thank you for the wonderful project, I have been trying out the gbsim project on a Beaglebone Black Running the latest Beagleboard image and was able to build and install it successfully(the steps I followed and logs are available here: https://vaishnav98.github.io/GSoC19/installgbsim.html ), then copying a manifest blob gives me device inserted messages both in gbsim and dmesg logs, however I am not able to reproduce the results given here(or other examples): https://github.com/projectara/gbsim/tree/master/test/sdio

When I copy the manifest blob to the hotplug-module directory I get a device inserted event, but there is no new mmc device entry in sysfs as described in the example.

It would be really helpful if you could provide me steps to debug this issue, I am working on a project to add support for MikroElektronika Clickboards on Beaglebone under Greybus with the help of GBSIM, the details about the project can be found here : https://summerofcode.withgoogle.com/projects/#5996499987595264

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.