summaryrefslogtreecommitdiff
path: root/recipes-devtools
diff options
context:
space:
mode:
authorStefan Müller-Klieser <S.Mueller-Klieser@phytec.de>2017-03-20 16:46:40 +0100
committerStefan Müller-Klieser <s.mueller-klieser@phytec.de>2017-03-28 15:24:58 +0200
commit4833ba5800a88616421da2c0c0d2b041ba9aab4d (patch)
treee2b3eeb727dbb71fcfbc5c22a3e149f0b4416c84 /recipes-devtools
parent9e90b7399017da6e5149bf79eeba64d52bdf2259 (diff)
downloadmeta-yogurt-4833ba5800a88616421da2c0c0d2b041ba9aab4d.tar.bz2
meta-yogurt-4833ba5800a88616421da2c0c0d2b041ba9aab4d.zip
mraa: add recipe
Libmraa is used as a middleware for low speed hardware access in nodejs and python. phyBOARD-Wega support is already upstream. Support for Mira is added locally. Only the expansion connector is supported. Tested features on Mira are sysfs GPIOs, i2c and spi. Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Diffstat (limited to 'recipes-devtools')
-rw-r--r--recipes-devtools/mraa/mraa.inc93
-rw-r--r--recipes-devtools/mraa/mraa/0001-FindNodejs.cmake-parse-V8_MAJOR_VERSION-from-nodejs-.patch53
-rw-r--r--recipes-devtools/mraa/mraa/0002-phyboard-mira-add-platform-support.patch657
-rw-r--r--recipes-devtools/mraa/mraa_git.bb16
4 files changed, 819 insertions, 0 deletions
diff --git a/recipes-devtools/mraa/mraa.inc b/recipes-devtools/mraa/mraa.inc
new file mode 100644
index 0000000..7d24576
--- /dev/null
+++ b/recipes-devtools/mraa/mraa.inc
@@ -0,0 +1,93 @@
+SUMMARY = "Low Level Skeleton Library for Communication on Intel platforms"
+SECTION = "libs"
+AUTHOR = "Brendan Le Foll, Tom Ingleby"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=66493d54e65bfc12c7983ff2e884f37f"
+
+inherit distutils-base pkgconfig python-dir cmake
+
+EXTRA_OECMAKE_append = " -DINSTALLTOOLS:BOOL=ON -DFIRMATA=ON -DPYTHON2_PACKAGES_PATH:FILEPATH=../${PYTHON_SITEPACKAGES_DIR} -DBASE_LIB_INSTALL_DIR=${base_libdir} -DCMAKE_SKIP_RPATH=ON"
+
+FILES_${PN}-doc += "${datadir}/mraa/examples/"
+
+# Prepend mraa-utils to make sure bindir ends up in there
+PACKAGES =+ "${PN}-utils "
+
+DEPENDS += " json-c"
+
+FILES_${PN}-utils = "${bindir}/ \
+ "
+
+# override this in local.conf to get a subset of bindings.
+# BINDINGS_pn-mraa="python"
+# will result in only the python bindings being built/packaged.
+BINDINGS ?= "nodejs python"
+
+PACKAGECONFIG ??= "${@bb.utils.contains('PACKAGES', 'node-${PN}', 'nodejs', '', d)} \
+ ${@bb.utils.contains('PACKAGES', 'python-${PN}', 'python', '', d)} \
+ ${@bb.utils.contains('PACKAGES', '${PN}-java', 'java', '', d)}"
+
+PACKAGECONFIG[python] = "-DBUILDSWIGPYTHON=ON, -DBUILDSWIGPYTHON=OFF, swig-native python,"
+PACKAGECONFIG[nodejs] = "-DNODEJS_EXECUTABLE=NONE -DBUILDSWIGNODE=ON, -DBUILDSWIGNODE=OFF, swig-native nodejs,"
+PACKAGECONFIG[java] = "-DBUILDSWIGJAVA=ON, -DBUILDSWIGJAVA=OFF, swig-native openjdk-8-native,"
+PACKAGECONFIG[ft4222] = "-DUSBPLAT=ON -DFTDI4222=ON, -DUSBPLAT=OFF -DFTDI4222=OFF,, libft4222"
+
+do_compile_prepend () {
+ # when yocto builds in ${D} it does not have access to ../git/.git so git
+ # describe --tags fails. In order not to tag our version as dirty we use this
+ # trick
+ sed -i 's/-dirty//' src/version.c
+}
+
+### Python ###
+
+# python-mraa package containing Python bindings
+FILES_python-${PN} = "${PYTHON_SITEPACKAGES_DIR}/ \
+ ${datadir}/mraa/examples/python/ \
+ ${prefix}/src/debug/${BPN}/${PV}-${PR}/build/src/python/ \
+ "
+RDEPENDS_python-${PN} += "python"
+INSANE_SKIP_python-${PN} = "debug-files"
+
+
+### Node ###
+
+# node-mraa package containing Nodejs bindings
+FILES_node-${PN} = "${prefix}/lib/node_modules/ \
+ ${datadir}/mraa/examples/javascript/ \
+ "
+RDEPENDS_node-${PN} += "nodejs"
+INSANE_SKIP_node-${PN} = "debug-files"
+
+
+### Java ###
+
+# mraa-java package containing Java bindings
+FILES_${PN}-java = "${libdir}/libmraajava.so \
+ ${libdir}/java/ \
+ ${datadir}/mraa/examples/java/ \
+ ${libdir}/pkgconfig/mraajava.pc \
+ ${prefix}/src/debug/${BPN}/${PV}-${PR}/build/src/java/ \
+ ${libdir}/.debug/libmraajava.so \
+ "
+
+RDEPENDS_${PN}-java += "${@bb.utils.contains('PACKAGES', '${PN}-java', 'java2-runtime', '', d)}"
+INSANE_SKIP_${PN}-java = "debug-files"
+
+export JAVA_HOME="${STAGING_DIR}/${BUILD_SYS}/usr/lib/jvm/openjdk-8-native"
+
+cmake_do_generate_toolchain_file_append() {
+ echo "
+set (JAVA_AWT_INCLUDE_PATH ${JAVA_HOME}/include CACHE PATH \"AWT include path\" FORCE)
+set (JAVA_AWT_LIBRARY ${JAVA_HOME}/jre/lib/amd64/libjawt.so CACHE FILEPATH \"AWT Library\" FORCE)
+set (JAVA_INCLUDE_PATH ${JAVA_HOME}/include CACHE PATH \"java include path\" FORCE)
+set (JAVA_INCLUDE_PATH2 ${JAVA_HOME}/include/linux CACHE PATH \"java include path\" FORCE)
+set (JAVA_JVM_LIBRARY ${JAVA_HOME}/jre/lib/amd64/libjvm.so CACHE FILEPATH \"path to JVM\" FORCE)
+" >> ${WORKDIR}/toolchain.cmake
+}
+
+### Include desired language bindings ###
+PACKAGES =+ "${@bb.utils.contains('BINDINGS', 'java', '${PN}-java', '', d)}"
+PACKAGES =+ "${@bb.utils.contains('BINDINGS', 'nodejs', 'node-${PN}', '', d)}"
+PACKAGES =+ "${@bb.utils.contains('BINDINGS', 'python', 'python-${PN}', '', d)}"
diff --git a/recipes-devtools/mraa/mraa/0001-FindNodejs.cmake-parse-V8_MAJOR_VERSION-from-nodejs-.patch b/recipes-devtools/mraa/mraa/0001-FindNodejs.cmake-parse-V8_MAJOR_VERSION-from-nodejs-.patch
new file mode 100644
index 0000000..72641ab
--- /dev/null
+++ b/recipes-devtools/mraa/mraa/0001-FindNodejs.cmake-parse-V8_MAJOR_VERSION-from-nodejs-.patch
@@ -0,0 +1,53 @@
+From f55d2ec308fcf5115715985c4f9aa36fb16306c1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20M=C3=BCller-Klieser?= <s.mueller-klieser@phytec.de>
+Date: Mon, 13 Feb 2017 16:05:53 +0100
+Subject: [PATCH 1/2] FindNodejs.cmake: parse V8_MAJOR_VERSION from nodejs
+ header
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Current version fails to build with a cross compile toolchain. We can
+use the headers from nodejs to parse the version numbers instead of
+executing node, which will not work in a cross setup. As no other
+version gets used in the current src tree, only convert V8 major for a
+start.
+
+Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
+---
+ cmake/modules/FindNodejs.cmake | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/modules/FindNodejs.cmake b/cmake/modules/FindNodejs.cmake
+index f1fa1ca..304f5f5 100644
+--- a/cmake/modules/FindNodejs.cmake
++++ b/cmake/modules/FindNodejs.cmake
+@@ -43,6 +43,10 @@ find_path (V8_ROOT_DIR "v8.h" PATHS ${NODEJS_INCLUDE_DIRS})
+ if (NOT V8_ROOT_DIR)
+ unset(NODEJS_INCLUDE_DIRS)
+ message(ERROR " - v8.h not found")
++else()
++ message(STATUS "Parsing v8 version from header...")
++ file(STRINGS "${V8_ROOT_DIR}/v8-version.h" V8HEADER)
++ STRING(REGEX REPLACE ".*V8_MAJOR_VERSION ([0-9]+).*" "\\1" V8_VERSION_MAJOR "${V8HEADER}")
+ endif()
+
+ # Check that uv.h is in NODEJS_INCLUDE_DIRS
+@@ -82,10 +86,12 @@ if (NODEJS_EXECUTABLE)
+ set (NODE_VERSION_MAJOR "0")
+ set (NODE_VERSION_MINOR "10")
+ set (NODE_VERSION_PATCH "30")
+- set (V8_VERSION_MAJOR "3")
++ if ("${V8_VERSION_MAJOR}" STREQUAL "")
++ set (V8_VERSION_MAJOR "3")
++ endif()
+ set (V8_VERSION_MINOR"14")
+ set (V8_VERSION_PATCH "5")
+- set (V8_VERSION_STRING "3.28.72")
++ set (V8_VERSION_STRING "${V8_VERSION_MAJOR}.28.72")
+ message ("defaulted to node 0.10.30")
+ endif ()
+ string (REGEX REPLACE "\n" "" NODE_VERSION_STRING ${NODE_VERSION_STRING})
+--
+1.9.1
+
diff --git a/recipes-devtools/mraa/mraa/0002-phyboard-mira-add-platform-support.patch b/recipes-devtools/mraa/mraa/0002-phyboard-mira-add-platform-support.patch
new file mode 100644
index 0000000..ffde484
--- /dev/null
+++ b/recipes-devtools/mraa/mraa/0002-phyboard-mira-add-platform-support.patch
@@ -0,0 +1,657 @@
+From 0232fde91922de1b73b86a2b9328ecca6c76ca89 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20M=C3=BCller-Klieser?= <s.mueller-klieser@phytec.de>
+Date: Tue, 14 Feb 2017 15:16:56 +0100
+Subject: [PATCH 2/2] phyboard-mira: add platform support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
+---
+ README.md | 1 +
+ api/mraa/types.h | 1 +
+ api/mraa/types.hpp | 1 +
+ docs/index.java.md | 1 +
+ docs/index.md | 1 +
+ docs/phyboard-mira.md | 222 ++++++++++++++++++++++++++++++++++++++
+ include/arm/mira.h | 51 +++++++++
+ src/CMakeLists.txt | 1 +
+ src/arm/arm.c | 7 +-
+ src/arm/mira.c | 205 +++++++++++++++++++++++++++++++++++
+ src/arm/phyboard.c | 1 +
+ src/python/python2/docs/index.rst | 1 +
+ 12 files changed, 492 insertions(+), 1 deletion(-)
+ create mode 100644 docs/phyboard-mira.md
+ create mode 100644 include/arm/mira.h
+ create mode 100644 src/arm/mira.c
+
+diff --git a/README.md b/README.md
+index c50f081..ece8354 100644
+--- a/README.md
++++ b/README.md
+@@ -37,6 +37,7 @@ ARM
+ * [Banana Pi](../master/docs/banana_pi.md)
+ * [Beaglebone Black](../master/docs/beaglebone.md)
+ * [phyBOARD-Wega](../master/docs/phyboard-wega.md)
++* [phyBOARD-Mira](../master/docs/phyboard-mira.md)
+
+ USB
+ ---
+diff --git a/api/mraa/types.h b/api/mraa/types.h
+index 3fd519b..41b9146 100644
+--- a/api/mraa/types.h
++++ b/api/mraa/types.h
+@@ -55,6 +55,7 @@ typedef enum {
+ MRAA_INTEL_GT_TUCHUCK = MRAA_INTEL_JOULE_EXPANSION, // deprecated
+ #endif
+ MRAA_PHYBOARD_WEGA = 14, /**< The phyBOARD-Wega */
++ MRAA_PHYBOARD_MIRA = 15, /**< The phyBOARD-Mira */
+
+ // USB platform extenders start at 256
+ MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
+diff --git a/api/mraa/types.hpp b/api/mraa/types.hpp
+index dba427e..35c923e 100644
+--- a/api/mraa/types.hpp
++++ b/api/mraa/types.hpp
+@@ -53,6 +53,7 @@ typedef enum {
+ INTEL_UP = 12, /**< The UP Board */
+ INTEL_JOULE_EXPANSION = 13, /**< The Intel Joule Expansion Board */
+ PHYBOARD_WEGA = 14, /**< The phyBOARD-Wega */
++ PHYBOARD_MIRA = 15, /**< The phyBOARD-Mira */
+
+ FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
+
+diff --git a/docs/index.java.md b/docs/index.java.md
+index 2dfcc3e..a1cbb4e 100644
+--- a/docs/index.java.md
++++ b/docs/index.java.md
+@@ -46,6 +46,7 @@ Specific platform information for supported platforms is documented here:
+ - @ref bananapi
+ - @ref beaglebone
+ - @ref phyboard-wega
++- @ref phyboard-mira
+ - @ref nuc5
+ - @ref up
+ - @ref joule
+diff --git a/docs/index.md b/docs/index.md
+index ea9633a..8c86003 100644
+--- a/docs/index.md
++++ b/docs/index.md
+@@ -46,6 +46,7 @@ Specific platform information for supported platforms is documented here:
+ - @ref bananapi
+ - @ref beaglebone
+ - @ref phyboard-wega
++- @ref phyboard-mira
+ - @ref nuc5
+ - @ref up
+ - @ref joule
+diff --git a/docs/phyboard-mira.md b/docs/phyboard-mira.md
+new file mode 100644
+index 0000000..726760d
+--- /dev/null
++++ b/docs/phyboard-mira.md
+@@ -0,0 +1,222 @@
++phyBOARD-Mira {#phyboard-mira}
++=============
++
++The phyBOARD-Mira for phyCORE-i.MX6
++
++For further information and instruction please visit:
++http://www.phytec.de/produkt/single-board-computer/phyboard-mira/
++
++
++Interface notes
++---------------
++
++**SPI**
++Spi0 can be used over pins on X69 connector. There are no more spi-devices.
++Independent of the given index in mraa_phyboard_spi_init_pre() function,
++it will be always initialized spi0.
++
++**I2C**
++/* TODO */
++
++**UART**
++Uart0 can be used over pins on X69 connector or serial port on Evaluation Board.
++The other Uarts not have been tested yet. This is a small TODO for future.
++
++
++Pin Assignment of X69 Expansion Connector
++-----------------------------------------
++
++| Physical Pin | Signal Name | Type | SL | Description |
++|--------------|---------------------|------|-------|-------------------------|
++| 1 | VCC3V3 | OUT | 3.3 V | 3.3V power supply |
++| 2 | VCC5V | OUT | 5.0 V | 5V power supply |
++| 3 | VDIG1_1P8V | OUT | 1.8 V | 1.8V power supply |
++| | | | | (max. 300mA) |
++| 4 | GND | - | - | Ground |
++| 5 | X_SPIO_CS0 | OUT | 3.3 V | SPI 0 chip select 0 |
++| 6 | X_SPIO_MOSI | OUT | 3.3 V | SPI 0 master output / |
++| | | | | slave input |
++| 7 | X_SPIO_MISO | IN | 3.3 V | SPI 0 master input / |
++| | | | | slave output |
++| 8 | X_SPIO_CLK | OUT | 3.3 V | SPI 0 clock output |
++| 9 | GND | - | - | Ground |
++| 10 | X_UART0_RXD | IN | 3.3 V | UART 0 receive data |
++| | | | | (std. debug iface) |
++| 11 | X_I2C0_SDA | I/O | 3.3 V | I2C0 Data |
++| 12 | X_UART0_TXD | OUT | 3.3 V | UART 0 transmit data |
++| | | | | (std. debug iface) |
++| 13 | X_I2C0_SCL | I/O | 3.3 V | I2C0 Clock |
++| 14 | GND | - | - | Ground |
++| 15 | X_JTAG_TMS | IN | 3.3 V | JTAG Chain Test |
++| | | | | Mode Select signal |
++| 16 | X_nJTAG_TRST | IN | 3.3 V | JTAG Chain Test Reset |
++| 17 | X_JTAG_TDI | IN | 3.3 V | JTAG Chain Test |
++| | | | | Data Input |
++| 18 | X_JTAG_TDO | OUT | 3.3 V | JTAG Chain Test |
++| | | | | Data Output |
++| 19 | GND | - | - | Ground |
++| 20 | X_JTAG_TCK | IN | 3.3 V | JTAG Chain Test |
++| | | | | Clock signal |
++| 21 | X_USB_DP_EXP | I/O | 3.3 V | USB data plus |
++| | | | | (for USB0 or USB1) |
++| 22 | X_USB_DM_EXP | I/O | 3.3 V | USB data minus |
++| | | | | (for USB0 or USB1) |
++| 23 | nRESET_OUT | OUT | 3.3 V | Reset |
++| 24 | GND | - | - | Ground |
++| 25 | X_MMC2_CMD | I/O | 3.3 V | MMC command |
++| 26 | X_MMC2_DATO | I/O | 3.3 V | MMC data 0 |
++| 27 | X_MMC2_CLK | I/O | 3.3 V | MMC clock |
++| 28 | X_MMC2_DAT1 | I/O | 3.3 V | MMC data 1 |
++| 29 | GND | - | - | Ground |
++| 30 | X_MMC2_DAT2 | I/O | 3.3 V | MMC data 2 |
++| 31 | X_UART2_RX_GPIO3_9 | I/O | 3.3 V | UART 2 receive data |
++| | | | | or GPIO3_9 |
++| 32 | X_MMC2_DAT3 | I/O | 3.3 V | MMC data 3 |
++| 33 | X_UART2_TX_GPIO3_10 | I/O | 3.3 V | UART 2 transmit data |
++| | | | | or GPIO3_10 |
++| 34 | GND | - | - | Ground |
++| 35 | X_UART3_RX_GPIO2_18 | I/O | 3.3 V | UART 3 receive data |
++| | | | | or GPIO2_18 |
++| 36 | X_UART3_TX_GPIO2_19 | I/O | 3.3 V | UART 3 transmit data |
++| | | | | or GPIO2_19 |
++| 37 | X_INTR1_GPIO0_20 | I/O | 3.3 V | Interrupt 1 or GPIO0_20 |
++| 38 | X_GPIO0_7 | I/O | 3.3 V | GPIO0_7 |
++| 39 | X_AM335_EXT_WAKEUP | IN | 3.3 V | External wakeup |
++| 40 | X_INT_RTCn | OUT | 3.3 V | Interrupt from the RTC |
++| 41 | GND | - | - | Ground |
++| 42 | X_GPIO3_7_nPMOD_PW | I/O | 3.3 V | GPIO3_7; Caution! Also |
++| | RFAIL | | | connected to power fail |
++| | | | | signal through R415. |
++| 43 | nRESET_IN | IN | 3.3 V | Push-button reset |
++| 44 | X_GPIO1_31 | I/O | 3.3 V | GPIO1_31 |
++| 45 | X_AM335_NMIn | IN | 3.3 V | AM335x |
++| | | | | non-maskable interrupt |
++| 46 | GND | - | - | Ground |
++| 47 | X_AIN4 | IN | 1.8 V | Analog input 4 |
++| 48 | X_AIN5 | IN | 1.8 V | Analog input 5 |
++| 49 | X_AIN6 | IN | 1.8 V | Analog input 6 |
++| 50 | X_AIN7 | IN | 1.8 V | Analog input 7 |
++| 51 | GND | - | - | Ground |
++| 52 | X_GPIO_CKSYNC | I/O | 3.3 V | GPIO Clock |
++| | | | | Synchronization |
++| 53 | X_USB_ID_EXP | IN | 1.8 V | USB port identification |
++| | | | | (for USB0 or USB1) |
++| 54 | USB_VBUS_EXP | OUT | 5.0 V | USB bus voltage |
++| | | | | (for USB0 or USB1) |
++| 55 | X_USB1_CE | OUT | 3.3 V | USB 1 charger enable |
++| 56 | GND | - | - | Ground |
++| 57 | VCC_BL | OUT | NS | Backlight power supply |
++| 58 | X_BP_POWER | IN | 5.0 V | Power On for Power |
++| | | | | Management IC for AM335x|
++| 59 | GND | - | - | Ground |
++| 60 | VCC5V_IN | IN | 5.0 V | 5 V input supply voltage|
++
++
++Pin Assignment of X70 A/V Connector
++-----------------------------------
++
++| Physical Pin | Signal Name | Type | SL | Description |
++|--------------|---------------------|------|-------|-------------------------|
++| 1 | GND | - | - | Ground |
++| 2 | X_LCD_D21 | OUT | 3.3 V | LCD D21 |
++| 3 | X_LCD_D18 | OUT | 3.3 V | LCD D18 |
++| 4 | X_LCD_D16 | OUT | 3.3 V | LCD D16 |
++| 5 | X_LCD_D0 | OUT | 3.3 V | LCD D0 |
++| 6 | GND | - | - | Ground |
++| 7 | X_LCD_D1 | OUT | 3.3 V | LCD D1 |
++| 8 | X_LCD_D2 | OUT | 3.3 V | LCD D2 |
++| 9 | X_LCD_D3 | OUT | 3.3 V | LCD D3 |
++| 10 | X_LCD_D4 | OUT | 3.3 V | LCD D4 |
++| 11 | GND | - | - | Ground |
++| 12 | X_LCD_D22 | OUT | 3.3 V | LCD D22 |
++| 13 | X_LCD_D19 | OUT | 3.3 V | LCD D19 |
++| 14 | X_LCD_D5 | OUT | 3.3 V | LCD D5 |
++| 15 | X_LCD_D6 | OUT | 3.3 V | LCD D6 |
++| 16 | GND | - | - | Ground |
++| 17 | X_LCD_D7 | OUT | 3.3 V | LCD D7 |
++| 18 | X_LCD_D8 | OUT | 3.3 V | LCD D8 |
++| 19 | X_LCD_D9 | OUT | 3.3 V | LCD D9 |
++| 20 | X_LCD_D10 | OUT | 3.3 V | LCD D10 |
++| 21 | GND | - | - | Ground |
++| 22 | X_LCD_D23 | OUT | 3.3 V | LCD D23 |
++| 23 | X_LCD_D20 | OUT | 3.3 V | LCD D20 |
++| 24 | X_LCD_D17 | OUT | 3.3 V | LCD D17 |
++| 25 | X_LCD_D11 | OUT | 3.3 V | LCD D11 |
++| 26 | GND | - | - | Ground |
++| 27 | X_LCD_D12 | OUT | 3.3 V | LCD D12 |
++| 28 | X_LCD_D13 | OUT | 3.3 V | LCD D13 |
++| 29 | X_LCD_D14 | OUT | 3.3 V | LCD D14 |
++| 30 | X_LCD_D15 | OUT | 3.3 V | LCD D15 |
++| 31 | GND | - | - | Ground |
++| 32 | X_LCD_PCLK | OUT | 3.3 V | LCD Pixel Clock |
++| 33 | X_LCD_BIAS_EN | OUT | 3.3 V | LCD BIAS |
++| 34 | X_LCD_HSYNC | OUT | 3.3 V | LCD Horizontal |
++| | | | | Synchronization |
++| 35 | X_LCD_VSYNC | OUT | 3.3 V | LCD Vertical |
++| | | | | Synchronisation |
++| 36 | GND | - | - | Ground |
++| 37 | GND | - | - | Ground |
++| 38 | X_PWM1_OUT | OUT | 3.3 V | Pulse Width Modulation |
++| 39 | VCC_BL | OUT | NS | Backlight power supply |
++| 40 | VCC5V | OUT | 5.0 V | 5 V power supply |
++
++
++Pin Assignment of X71 A/V Connector
++-----------------------------------
++
++| Physical Pin | Signal Name | Type | SL | Description |
++|--------------|---------------------|------|-------|-------------------------|
++| 1 | X_I2S_CLK | I/O | 3.3 V | I2S Clock |
++| 2 | X_I2S_FRM | I/O | 3.3 V | I2S Frame |
++| 3 | X_I2S_ADC | I/O | 3.3 V | I2S Analog-Digital |
++| | | | | converter (microphone) |
++| 4 | X_I2S_DAC | I/O | 3.3 V | I2S Digital-Analog |
++| | | | | converter (speaker) |
++| 5 | X_AV_INT_GPIO1_30 | I/O | 3.3 V | A/V interrupt; GPIO1_30 |
++| 6 | nUSB1_OC_GPIO3_19 or| I/O | 3.3 V | GPIO3_19 or McASP0 |
++| | X_MCASP0_AHCLKX_GPIO3_21| | | high frequency clock |
++| 7 | GND | - | - | Ground |
++| 8 | nRESET_OUT | OUT | 3.3 V | Reset |
++| 9 | TS_X+ | IN | 1.8 V | Touch X+ |
++| 10 | TS_X- | IN | 1.8 V | Touch X- |
++| 11 | TS_Y+ | IN | 1.8 V | Touch Y+ |
++| 12 | TS_Y- | IN | 1.8 V | Touch Y- |
++| 13 | VCC3V3 | OUT | 3.3 V | 3.3 V power supply |
++| 14 | GND | - | - | Ground |
++| 15 | X_I2C0_SCL | I/O | 3.3 V | I2C Clock |
++| 16 | X_I2C0_SDA | I/O | 3.3 V | I2C Data |
++
++Jumper J77 connects either signal X_MCASP0_AHCLKX_GPIO3_21 or signal
++nUSB1_OC_GPIO3_19 to pin 6 of X71.
++The following table shows the available configurations:
++
++A/V Jumper configuration J77
++----------------------------
++
++| J77 | Description |
++|-----|--------------------------|
++| 1+2 | X_MCASP0_AHCLKX_GPIO3_21 |
++| 2+3 | nUSB1_OC_GPIO3_19 |
++
++Caution: If J77 is set to 2+3 , J78 also has to be set to 2+3 !
++
++
++GPIO - Pin-mapping (with installed expansion board)
++---------------------------------------------------
++
++| Physical Pin | Pin-Name | Pin-Map / Sysfs GPIO | Def. usage | Connector|
++|--------------|---------------|----------------------|------------|----------|
++| 31 | X_GPIO3_9 | 105 | OUT LED3 | X69 |
++| 33 | X_GPIO3_10 | 106 | IN S3 | X69 |
++| 35 | X_GPIO2_18 | 82 (busy) | OUT LED1 | X69 |
++| 36 | X_GPIO2_19 | 83 | OUT LED2 | X69 |
++| 37 | X_GPIO0_20 | 20 (busy) | IN S1 | X69 |
++| 38 | X_GPIO0_7 | 7 | IN S2 | X69 |
++| 42 | X_GPIO3_7 | 103 | IN | X69 |
++| 44 | X_GPIO1_31 | 63 | IN | X69 |
++|--------------|---------------|----------------------|------------|----------|
++| 5 (105) | X_GPIO1_30 | 62 | IN | X71 |
++| 6 (106) | X_GPIO3_19 or | 115 | IN | X71 |
++| | X_GPIO3_21 | 117 | IN | X71 |
++
++Info: (busy) means, that it is used by kernel driver!
+diff --git a/include/arm/mira.h b/include/arm/mira.h
+new file mode 100644
+index 0000000..554270f
+--- /dev/null
++++ b/include/arm/mira.h
+@@ -0,0 +1,51 @@
++/*
++ * Author: Stefan Müller-Klieser <S.Mueller-Klieser@phytec.de>
++ * Copyright (c) 2017 Phytec Messtechnik GmbH.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files (the
++ * "Software"), to deal in the Software without restriction, including
++ * without limitation the rights to use, copy, modify, merge, publish,
++ * distribute, sublicense, and/or sell copies of the Software, and to
++ * permit persons to whom the Software is furnished to do so, subject to
++ * the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
++ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
++ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ */
++
++#pragma once
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#include <stdlib.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <mraa/types.h>
++
++#include "common.h"
++#include "mraa_internal.h"
++
++#define SYSFS_CLASS_PWM "/sys/class/pwm/"
++#define SYSFS_CLASS_MMC "/sys/class/mmc_host/"
++
++#define MMAP_PATH "/dev/mem"
++#define MAX_SIZE 64
++
++#define MRAA_PHYBOARD_MIRA_PINCOUNT 117
++
++mraa_board_t * mraa_mira();
++
++#ifdef __cplusplus
++}
++#endif
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index a1ff292..b92f226 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -82,6 +82,7 @@ set (mraa_LIB_ARM_SRCS_NOAUTO
+ ${PROJECT_SOURCE_DIR}/src/arm/raspberry_pi.c
+ ${PROJECT_SOURCE_DIR}/src/arm/beaglebone.c
+ ${PROJECT_SOURCE_DIR}/src/arm/phyboard.c
++ ${PROJECT_SOURCE_DIR}/src/arm/mira.c
+ ${PROJECT_SOURCE_DIR}/src/arm/banana.c
+ )
+
+diff --git a/src/arm/arm.c b/src/arm/arm.c
+index acfc3e3..fbf80e1 100644
+--- a/src/arm/arm.c
++++ b/src/arm/arm.c
+@@ -30,10 +30,10 @@
+ #include "arm/banana.h"
+ #include "arm/beaglebone.h"
+ #include "arm/phyboard.h"
++#include "arm/mira.h"
+ #include "arm/raspberry_pi.h"
+ #include "mraa_internal.h"
+
+-
+ mraa_platform_t
+ mraa_arm_platform()
+ {
+@@ -89,6 +89,8 @@ mraa_arm_platform()
+ platform_type = MRAA_96BOARDS;
+ else if (mraa_file_contains("/proc/device-tree/compatible", "raspberrypi,"))
+ platform_type = MRAA_RASPBERRY_PI;
++ else if (mraa_file_contains("/sys/firmware/devicetree/base/model", "phyBOARD-MIRA"))
++ platform_type = MRAA_PHYBOARD_MIRA;
+ }
+
+ switch (platform_type) {
+@@ -100,6 +102,9 @@ mraa_arm_platform()
+ break;
+ case MRAA_PHYBOARD_WEGA:
+ plat = mraa_phyboard();
++ break;
++ case MRAA_PHYBOARD_MIRA:
++ plat = mraa_mira();
+ break;
+ case MRAA_BANANA:
+ plat = mraa_banana();
+diff --git a/src/arm/mira.c b/src/arm/mira.c
+new file mode 100644
+index 0000000..a9ce89e
+--- /dev/null
++++ b/src/arm/mira.c
+@@ -0,0 +1,205 @@
++/*
++ * Author: Stefan Müller-Klieser <S.Mueller-Klieser@phytec.de>
++ * Copyright (c) 2017 Phytec Messtechnik GmbH.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files (the
++ * "Software"), to deal in the Software without restriction, including
++ * without limitation the rights to use, copy, modify, merge, publish,
++ * distribute, sublicense, and/or sell copies of the Software, and to
++ * permit persons to whom the Software is furnished to do so, subject to
++ * the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
++ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
++ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++ */
++
++#include <stdlib.h>
++#include <stdarg.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <mraa/types.h>
++
++#include "common.h"
++#include "arm/mira.h"
++
++#define PLATFORM_NAME_PHYBOARD_MIRA "phyBOARD-Mira"
++
++//return the sysfs gpio number using the imx6 gpio bank numbering scheme
++#define IMX6_GPIO(x,y) (((x - 1) * 32 ) + y )
++
++void
++mraa_arm_pininfo(mraa_board_t* board, int index, int sysfs_pin, char* fmt, ...)
++{
++ va_list arg_ptr;
++ if (index > board->phy_pin_count)
++ return;
++
++ mraa_pininfo_t* pininfo = &board->pins[index];
++ va_start(arg_ptr, fmt);
++ vsnprintf(pininfo->name, MRAA_PIN_NAME_SIZE, fmt, arg_ptr);
++ va_end(arg_ptr);
++ if (sysfs_pin >= 0)
++ pininfo->capabilities = (mraa_pincapabilities_t){ 1, 1, 0, 0, 0, 0, 0, 0 };
++ else
++ pininfo->capabilities = (mraa_pincapabilities_t){ 0, 0, 0, 0, 0, 0, 0, 0 };
++ pininfo->gpio.pinmap = sysfs_pin;
++ pininfo->gpio.mux_total = 0;
++}
++
++mraa_board_t*
++mraa_mira()
++{
++ int i;
++
++ mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
++ if (b == NULL) {
++ return NULL;
++ }
++
++ b->platform_name = PLATFORM_NAME_PHYBOARD_MIRA;
++ b->no_bus_mux = 1;
++ b->phy_pin_count = MRAA_PHYBOARD_MIRA_PINCOUNT;
++
++ if (b->platform_name == NULL) {
++ goto error;
++ }
++
++ b->pins = (mraa_pininfo_t*) calloc(b->phy_pin_count,sizeof(mraa_pininfo_t));
++ if (b->pins == NULL) {
++ goto error;
++ }
++
++ b->adv_func = (mraa_adv_func_t*) calloc(1, sizeof(mraa_adv_func_t));
++ if (b->adv_func == NULL) {
++ free(b->pins);
++ goto error;
++ }
++
++ mraa_arm_pininfo(b, 0, -1, "INVALID");
++
++ // X17 connector
++ mraa_arm_pininfo(b, 1, -1, "VCC3V3");
++ mraa_arm_pininfo(b, 2, -1, "VCC5V");
++ mraa_arm_pininfo(b, 3, -1, "VCC1V5");
++ mraa_arm_pininfo(b, 4, -1, "GND");
++ mraa_arm_pininfo(b, 5, -1, "X_ECSPI1_SS0");
++ mraa_arm_pininfo(b, 6, -1, "X_ECSPI1_MOSI");
++ mraa_arm_pininfo(b, 7, -1, "X_ECSPI1_MISO");
++ mraa_arm_pininfo(b, 8, -1, "X_ECSPI1_SCLK");
++ mraa_arm_pininfo(b, 9, -1, "GND");
++ mraa_arm_pininfo(b, 10, -1, "X_UART2_RX_DATA");
++ mraa_arm_pininfo(b, 11, -1, "X_I2C1_SDA");
++ mraa_arm_pininfo(b, 12, -1, "X_UART2_TX_DATA");
++ mraa_arm_pininfo(b, 13, -1, "X_I2C1_SCL");
++ mraa_arm_pininfo(b, 14, -1, "GND");
++ mraa_arm_pininfo(b, 15, -1, "X_JTAG_TMS");
++ mraa_arm_pininfo(b, 16, -1, "X_JTAG_TRSTB");
++ mraa_arm_pininfo(b, 17, -1, "X_JTAG_TDI");
++ mraa_arm_pininfo(b, 18, -1, "X_JTAG_TDO");
++ mraa_arm_pininfo(b, 19, -1, "GND");
++ mraa_arm_pininfo(b, 20, -1, "X_JTAG_TCK");
++ /* Schematic: X_USB1_DP_EXP */
++ mraa_arm_pininfo(b, 21, -1, "X_USB1_DP");
++ /* Schematic: X_USB1_DM_EXP */
++ mraa_arm_pininfo(b, 22, -1, "X_USB1_DM");
++ mraa_arm_pininfo(b, 23, -1, "X_nRESET");
++ mraa_arm_pininfo(b, 24, -1, "GND");
++ /* Schematic: X_SD3_CMD */
++ mraa_arm_pininfo(b, 25, IMX6_GPIO(7,2), "GPIO7_IO02");
++ /* Schematic: X_SD3_DATAO */
++ mraa_arm_pininfo(b, 26, IMX6_GPIO(7,4), "GPIO7_IO04");
++ /* Schematic: X_SD3_CLK */
++ mraa_arm_pininfo(b, 27, IMX6_GPIO(7,3), "GPIO7_IO03");
++ /* Schematic: X_SD3_DATA1 */
++ mraa_arm_pininfo(b, 28, IMX6_GPIO(7,5), "GPIO7_IO05");
++ mraa_arm_pininfo(b, 29, -1, "GND");
++ /* Schematic: X_SD3_DATA2 */
++ mraa_arm_pininfo(b, 30, IMX6_GPIO(7,6), "GPIO7_IO06");
++ /* Schematic: X_CSI0_DAT11/ECSPI2_SS0 */
++ mraa_arm_pininfo(b, 31, IMX6_GPIO(5,29), "GPIO5_IO29");
++ /* Schematic: X_SD3_DATA3 */
++ mraa_arm_pininfo(b, 32, IMX6_GPIO(7,7), "GPIO7_IO07");
++ /* Schematic: X_CSI0_DAT10/ECSPI2_MISO */
++ mraa_arm_pininfo(b, 33, IMX6_GPIO(5,28), "GPIO5_IO28");
++ mraa_arm_pininfo(b, 34, -1, "GND");
++ /* Schematic: X_SD3_DATA4 */
++ mraa_arm_pininfo(b, 35, IMX6_GPIO(7,1), "GPIO7_IO01");
++ /* Schematic: X_SD3_DATA5 */
++ mraa_arm_pininfo(b, 36, IMX6_GPIO(7,0), "GPIO7_IO00");
++ mraa_arm_pininfo(b, 37, -1, "X_SATA_TXP");
++ /* Schematic: X_SD3_DATA6 */
++ mraa_arm_pininfo(b, 38, IMX6_GPIO(6,18), "GPIO6_IO18");
++ mraa_arm_pininfo(b, 39, -1, "X_SATA_TXN");
++ /* Schematic: X_SD3_DATA7 */
++ mraa_arm_pininfo(b, 40, IMX6_GPIO(6,17), "GPIO6_IO17");
++ mraa_arm_pininfo(b, 41, -1, "GND");
++ /* Schematic: X_ECSPI2_RDY */
++ mraa_arm_pininfo(b, 42, IMX6_GPIO(5,2), "GPIO5_IO02");
++ mraa_arm_pininfo(b, 43, -1, "X_SATA_RXP");
++ /* Schematic: X_CSIO_DAT8 */
++ mraa_arm_pininfo(b, 44, IMX6_GPIO(5,26), "GPIO5_IO26");
++ mraa_arm_pininfo(b, 45, -1, "X_SATA_RXN");
++ mraa_arm_pininfo(b, 46, -1, "GND");
++ mraa_arm_pininfo(b, 47, -1, "X_FLEXCAN1_TX_EXP");
++ mraa_arm_pininfo(b, 48, -1, "X_FLEXCAN1_RX_EXP");
++ /* Schematic: X_USB_OTG_OC/FLEXCAN2_TX */
++ mraa_arm_pininfo(b, 49, IMX6_GPIO(4,14), "GPIO4_IO14");
++ /* Schematic: X_USB_OTG_PWR/FLEXCAN2_RX */
++ mraa_arm_pininfo(b, 50, IMX6_GPIO(4,15), "GPIO4_IO15");
++ mraa_arm_pininfo(b, 51, -1, "GND");
++ /* Schematic: X_CSI0_DAT9 */
++ mraa_arm_pininfo(b, 52, IMX6_GPIO(5,27), "GPIO5_IO27");
++ mraa_arm_pininfo(b, 53, -1, "X_USB1_ID");
++ mraa_arm_pininfo(b, 54, -1, "X_USB1_VBUS");
++ mraa_arm_pininfo(b, 55, -1, "X_USB_OTG_CHD_B");
++ mraa_arm_pininfo(b, 56, -1, "GND");
++ mraa_arm_pininfo(b, 57, -1, "VCC_BL");
++ /* Schematic: X_ECSPI2_SS1 */
++ mraa_arm_pininfo(b, 58, IMX6_GPIO(2,27), "GPIO2_IO27");
++ mraa_arm_pininfo(b, 59, -1, "GND");
++ mraa_arm_pininfo(b, 60, -1, "VCC5V_IN");
++
++ //X13 X14 connector used for AV adapters
++ //X3 connector can
++ //X23 connector RS232 / 485
++
++ //BUS DEFINITIONS
++ b->aio_count = 0;
++ b->adc_raw = 0;
++ b->adc_supported = 0;
++
++ b->i2c_bus_count = 1;
++ b->def_i2c_bus = 0;
++ b->i2c_bus[0].bus_id = 0;
++
++ b->spi_bus_count = 1;
++ b->def_spi_bus = 0;
++ b->spi_bus[0].bus_id = 0;
++
++ b->uart_dev_count = 1;
++ b->def_uart_dev = 0;
++
++ b->gpio_count = 0;
++
++ for (i = 0; i < b->phy_pin_count; i++) {
++ if (b->pins[i].capabilities.gpio) {
++ b->gpio_count++;
++ }
++ }
++
++ return b;
++
++error:
++ syslog(LOG_CRIT, "mira: failed to initialize");
++ free(b);
++ return NULL;
++};
+diff --git a/src/arm/phyboard.c b/src/arm/phyboard.c
+index 7ead282..b7300ca 100644
+--- a/src/arm/phyboard.c
++++ b/src/arm/phyboard.c
+@@ -166,6 +166,7 @@ mraa_phyboard()
+ if (b == NULL) {
+ return NULL;
+ }
++
+ b->platform_name = PLATFORM_NAME_PHYBOARD_WEGA;
+ b->phy_pin_count = MRAA_PHYBOARD_WEGA_PINCOUNT;
+
+diff --git a/src/python/python2/docs/index.rst b/src/python/python2/docs/index.rst
+index a693f8c..2835dd8 100644
+--- a/src/python/python2/docs/index.rst
++++ b/src/python/python2/docs/index.rst
+@@ -28,6 +28,7 @@ Supported Platforms
+ * `Banana Pi/Pro <../bananapi.html>`_
+ * `Beaglebone Black <../beaglebone.html>`_
+ * `phyBOARD-Wega <../phyboard-wega.html>`_
++ * `phyBOARD-Mira <../phyboard-mira.html>`_
+ * `Intel NUC NUC5i5MYBE <../nuc5.html>`_
+ * `UP <../up.html>`_
+ * `FTDI FT4222H <../ft4222.html>`_
+--
+1.9.1
+
diff --git a/recipes-devtools/mraa/mraa_git.bb b/recipes-devtools/mraa/mraa_git.bb
new file mode 100644
index 0000000..a79fc84
--- /dev/null
+++ b/recipes-devtools/mraa/mraa_git.bb
@@ -0,0 +1,16 @@
+require mraa.inc
+
+#SRC_URI = "https://github.com/intel-iot-devkit/mraa/archive/v${PV}.tar.gz"
+SRC_URI = "git://github.com/intel-iot-devkit/mraa.git"
+SRC_URI += "\
+ file://0001-FindNodejs.cmake-parse-V8_MAJOR_VERSION-from-nodejs-.patch \
+ file://0002-phyboard-mira-add-platform-support.patch \
+"
+
+PV = "1.5.1+gitr${SRCPV}"
+SRCREV = "23fd11c4f73d368de4ece44d4735bde6c8db08eb"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_MACHINE = "phyboard-wega"
+COMPATIBLE_MACHINE .= "|phyboard-mira-imx6-13"