What is MRAA/UPM

Eclipse MRAA/UPM is a C/C++ library with bindings to Java, Python and JavaScript to interface with the IO, with a structured and sensors API where port names/numbering matches the board that you are on. Use of libmraa does not tie you to specific hardware with board detection done at runtime you can create portable code that will work across the supported platforms.

The intent is to make it easier for developers and sensor manufacturers to map their sensors & actuators on top of supported hardware and to allow control of low level communication protocol by high level languages & constructs. Also. please refer to Introduction to MRAA & Introduction to UPM for more details.

image-20201013143405250

Note:

  1. By default, MRAA/UPM library is already on PX30 Yocto/Ubuntu/Debian images.

  2. ADLINK MRAA libraries has been contributed to Eclipse MRAA GitHub which is supported on LEC-PX30 & LEC-AL-AI with industrial I-Pi SMARC


how to build & install MRAA/UPM on Yocto/Ubutnu/Debian:


Debian

Building & Installing MRAA

  1. Install required dependencies.
sudo apt install git build-essential swig3.0 python-dev libnode-dev cmake libjson-c-dev
  1. Before compiling MRAA/UPM source, need to downgrade the already installed cmake utility. Please download cmake.zip form here.
$ sudo apt purge --autoremove cmake
$ unzip cmake.zip
$ cd cmake
$ sudo dpkg -i *.deb
$ cd ..
  1. Download MRAA source from github and compile.
$ git clone https://github.com/eclipse/mraa.git
$ cd mraa
$ cmake /home/adlink/mraa
$ make -j4
$ sudo make install
$ cd ..

Note: If user requires adlink test applications apply patch and build. please download git patch from here.

$ git clone https://github.com/eclipse/mraa.git
$ cd mraa
$ git apply mraa.patch
$ cmake /home/adlink/mraa
$ make -j4
$ sudo make install
$ cd ..
  1. After install user can remove mraa source.
rm -rf mraa

Note Example applications get installed into /usr/local/share/mraa/examples/c

Building & Installing UPM

  1. Install required dependencies
$ sudo apt install automake libpcre3-dev bison pkg-config libnode-dev  python3-distutils python3-dev libjpeg-dev
  1. Download SWIG source and compile.
$ git clone https://github.com/swig/swig.git
$ cd swig
$ ./autogen.sh
$ ./configure
$ make -j4
$ sudo make install
$ cd ..
  1. Download UPM source and compile.
$ git clone https://github.com/eclipse/upm.git
$ cd upm
$ mkdir build
$ cd build
$ cmake .. "-DBUILDEXAMPLES=on"
$ make -j4
$ sudo make install
$ cd ..
  1. After installing, user can remove swig and upm sources.
$ rm -rf swig 
$ rm -rf upm
  1. Update LD_LIBRARY_PATH.
$ sudo ldconfig

Ubuntu

Building & Installing MRAA

  1. Install required dependencies.
sudo apt install git build-essential swig3.0 python-dev nodejs-dev cmake libjson-c-dev
  1. Download MRAA source from github and compile.
$ git clone https://github.com/eclipse/mraa.git
$ cd mraa
$ cmake /home/adlink/mraa
$ make -j4
$ sudo make install
$ cd ..

Note: If user requires adlink test applications apply patch and build. Please download git patch from here.

$ git clone https://github.com/eclipse/mraa.git
$ cd mraa
$ git apply mraa.patch
$ cmake /home/adlink/mraa
$ make -j4
$ sudo make install
$ cd ..

After install user can remove mraa source.

rm -rf mraa

Note: Example applications get installed into /usr/local/share/mraa/examples/c

Building & Installing UPM

Install required dependencies on ubuntu.

$ sudo apt install automake libpcre3-dev bison pkg-config nodejs-dev python3-distutils python3-dev libjpeg-dev

Download SWIG source and compile.

$ git clone https://github.com/swig/swig.git
$ cd swig
$ ./autogen.sh
$ ./configure
$ make -j4
$ sudo make install
$ cd ..

Download UPM source and compile.

$ git clone https://github.com/eclipse/upm.git
$ cd upm
$ mkdir build
$ cd build
$ cmake .. "-DBUILDEXAMPLES=on"
$ make -j4
$ sudo make install
$ cd ..

After installing, user can remove swig and upm sources.

$ rm -rf swig 
$ rm -rf upm

Update LD_LIBRARY_PATH.

$ sudo ldconfig

Yocto

Intel mraa recipe is here and please add it to your building Yocto.