Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c713ddfd authored by mario tesi's avatar mario tesi
Browse files

Split iio_utils to separate shared library

New HAL version v3.1.7
parent 9f96e72e
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
#
# Copyright (C) 2018 STMicroelectronics
# Motion MEMS Product Div.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/

IDIR = -I. -I../../linux/

CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)gcc
CFLAGS=$(IDIR) -DLOG_TAG=\"test_linux\"
LIB=-ldl -lpthread -lm -lrt
LIB=-ldl -lpthread

.PHONY: test_linux

+13 −11
Original line number Diff line number Diff line
@@ -20,14 +20,15 @@ LOCAL_PATH := ${CURDIR}
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
RM = rm -f
INCLUDES := -I$(LOCAL_PATH)/ -I$(LOCAL_PATH)/src -I$(LOCAL_PATH)/linux/
INCLUDES := -I$(LOCAL_PATH)/ -I$(LOCAL_PATH)/src -I$(LOCAL_PATH)/linux/ \
		-I$(LOCAL_PATH)/linux/tools/iio -I$(LOCAL_PATH)/linux/iio
CFLAGS += $(INCLUDES) -DLOG_TAG=\"SensorHAL\" -DPLTF_LINUX_ENABLED -Wall \
		-Wunused-parameter -Wunused-value -Wunused-function -Wunused-label -fPIC

CPPFLAGS = $(INCLUDES) -g -DPLTF_LINUX_ENABLED -Wunused-label -Wall -fPIC \
		-D_DEFAULT_SOURCE
LDFLAGS = -g
LDLIBS = -lpthread
LDFLAGS = -g -L$(OUT)
LDLIBS = -lpthread -lsensoriioutils

ifeq ($(DEBUG),y)
CFLAGS += -g -O0
@@ -47,22 +48,23 @@ LOCAL_SRC_FILES := \
		src/Accelerometer.cpp \
		src/Gyroscope.cpp

IIO_UTILS_SRC := linux/tools/iio/iio_utils.cpp

ifdef CONFIG_ST_HAL_HAS_SELFTEST_FUNCTIONS
LOCAL_SRC_FILES += src/SelfTest.cpp
endif # CONFIG_ST_HAL_HAS_SELFTEST_FUNCTIONS

OBJS=$(subst .cpp,.o,$(LOCAL_SRC_FILES)) src/iio_utils.o
OBJS=$(subst .cpp,.o,$(LOCAL_SRC_FILES))
IIO_UTILS=$(subst .cpp,.o,$(IIO_UTILS_SRC))

all: SensorHAL

SensorHAL: $(OBJS)
iio_utils: $(IIO_UTILS)
	$(CXX) $(LDFLAGS) -shared $(IIO_UTILS) -o $(OUT)/libsensoriioutils.so

SensorHAL: $(OBJS) iio_utils
	$(CXX) $(LDFLAGS) -shared $(OBJS) $(LDLIBS) -o $(OUT)/SensorHAL.so

clean:
	$(RM) $(OBJS)

distclean: clean
	$(RM) SensorHAL.so


	$(RM) $(OBJS) $(IIO_UTILS) $(OUT)/libsensoriioutils.so $(OUT)/SensorHAL.so
+0 −22
Original line number Diff line number Diff line
@@ -25,28 +25,6 @@ extracted from the Linux kernel source tree, which is covered by GPLv2 only.
    * tools/kconfig-language.txt


This product contains a modified version of `iio_utils` code extracted from
the Linux kernel source tree, which is covered by GPLv2 only.
Originally developed by Jonathan Cameron <jic23@kernel.org>.

  * LICENSE:
    * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html (GPLv2)
  * FILE:
    * src/iio_utils.h
    * src/iio_utils.c


This product contains a modified version of parts of iio framework, code
extracted from the Linux kernel source tree, which is covered by GPLv2 only.
Originally developed by Jonathan Cameron <jic23@kernel.org>.

  * LICENSE:
    * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html (GPLv2)
  * FILE:
    * src/types.h
    * src/events.h


This project may contains proprietary librares under lib/ folder. Different
LICENSES are applied on binary files.

+23 −6
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ Currently supported sensors are:

Software architecture and Integration details
=============

##### COMPILING THE SENSOR HAL CODE FOR ANDROID
STM Sensor HAL is written in *C++* language using object-oriented design. For each hw sensor there is a custom class file (*Accelerometer.cpp*, *Gyroscope.cpp*) which extends the common base class (*SensorBase.cpp*).

Copy the HAL source code into *<AOSP_DIR\>/hardware/STMicroelectronics/SensorHAL_IIO* folder. During building process Android will include automatically the SensorHAL Android.mk.
@@ -40,16 +40,33 @@ To compile the SensorHAL_IIO just build AOSP source code from *$TOP* folder

The compiled library will be placed in *<AOSP_DIR\>/out/target/product/<board\>/system/vendor/lib/hw/sensor.{TARGET_BOARD_PLATFORM}.so*

To configure sensor the Sensor HAL IIO use mm utility from HAL root folder
To configure sensor the Sensor HAL IIO

> *For Android Version < O use mm tools*
>	$mm sensors-defconfig (default configuration)
> or
>	$mm sensors-menuconfig

> *For Android Version >= O*
>	$PLATFORM_VERSION=x.y.z make -f Makefile_config sensors-defconfig (default configuration)
> or
>	$PLATFORM_VERSION=x.y.z make -f Makefile_config sensors-menuconfig

##### COMPILING THE SENSOR HAL FOR LINUX
From From SensorHAL_IIO root folder set CROSS_COMPILE and ARCH environment variables accordingly to your target
board, for example on HiKey board:
>     export ARCH=arm64
>     export CROSS_COMPILE=<binutils_path>/gcc-linaro-5.5.0-2017.10-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

   Then use Makefile to build:

	$mm sensors-defconfig (default configuration)
or
      make

	$mm sensors-menuconfig
   Linux library (.so) will be produced in HAL root directory, please copy SensorHAL and libsensoriioutils shared object to your standard /lib or LD_LIBRARY_PATH target filesystem.

Copyright
========
Copyright (C) 2017 STMicroelectronics
Copyright (C) 2018 STMicroelectronics

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
+37 −12
Original line number Diff line number Diff line
/* Android STMicroelectronics SensorHAL release 3.x
 *
 * Copyright (C) 2015-2016 STMicroelectronics
 * Author: Denis Ciocca - <denis.ciocca@st.com>
*/
*Android STMicroelectronics SensorHAL release 3.x*
*Copyright (C) 2015-2018 STMicroelectronics*
*Author: Denis Ciocca - <denis.ciocca@st.com>*

These are the release notes for STMicroelectronics SensorHAL version 3.
Read them carefully, as they tell you what this is all about, explain how
@@ -35,7 +33,8 @@ INSTALLING SOURCE CODE

CONFIGURING THE SENSOR HAL

--> From SensorHAL_IIO root folder (not for Android pre-release):
--> Android Version < O
   From SensorHAL_IIO root folder:

   "mm sensors-defconfig"	Generated default hal_config file.

@@ -43,7 +42,9 @@ CONFIGURING THE SENSOR HAL

   "mm sensors-cleanconf"	Delete hal_config, hal_config.old and configuration.h files.

--> From Android source code $TOP folder (Android L/M/N not for Android O preview):

--> Android Version >= O
   From SensorHAL_IIO root folder:

   "make -f Makefile_config sensors-defconfig"	Generated default hal_config file.

@@ -52,7 +53,19 @@ CONFIGURING THE SENSOR HAL
   "make -f Makefile_configsensors-cleanconf"	Delete hal_config, hal_config.old and configuration.h files.


COMPILING THE SENSOR HAL CODE
--> Android Version pre-release
   From SensorHAL_IIO root folder:

   "PLATFORM_VERSION=x.y.z make -f Makefile_config sensors-defconfig"	Generated default hal_config file.

   "PLATFORM_VERSION=x.y.z make -f Makefile_config sensors-menuconfig"	Text based color menus, radiolists & dialogs.

   "PLATFORM_VERSION=x.y.z make -f Makefile_configsensors-cleanconf"	Delete hal_config, hal_config.old and configuration.h files.

    where x.y.z are related to Android pre-release version (see version_defaults.mk in <AOSP_TOP_DIR>/build/make/core/ path)


COMPILING THE SENSOR HAL CODE FOR ANDROID

--> From From SensorHAL_IIO root folder:

@@ -66,10 +79,22 @@ COMPILING THE SENSOR HAL CODE
   Just build Android source code as described on source.android.com. The SensorHAL will
   be automatically build and installed into system.img

BUILD Linux SensorHAL

   Use Makefile to build SensorHAL.so, CROSS_COMPILE and ARCH environment variables must
   be set to build tools for cross compile to target board.
COMPILING THE SENSOR HAL FOR LINUX

   From From SensorHAL_IIO root folder set CROSS_COMPILE and ARCH environment
   variables accordingly to your target board, for example on HiKey board:

>     export ARCH=arm64
>     export CROSS_COMPILE=<binutils_path>/gcc-linaro-5.5.0-2017.10-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

   Then use Makefile to build:

      make

   Linux library (.so) will be produced in HAL root directory, please copy
   SensorHAL and libsensoriioutils shared object to your standard /lib or
   LD_LIBRARY_PATH target filesystem.

SENSORS SUPPORTED:
   - ST Test sensors		(Accel + Magn + Gyro);
@@ -84,4 +109,4 @@ CHANGELOG:
   v3.1.4: Added support for ASM330LHH
   v3.1.5: Added support for Android N. Added support for different kernel versions
   v3.1.6: Add support to Android O
   v3.1.7: Move iio_utils in separated shared library
Loading