From e3a57dcb2ae1cd4e6a81e1ca65ac235c8e3dd500 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Tue, 20 Oct 2020 16:37:05 -0400 Subject: Initial check-in Initial check-in of the contents of the meta-refhw directory from the AGL_Refhw_sample_software_20200512.tar.gz archive provided by Panasonic as the initial BSP for the AGL reference hardware. The only change from the files as provided is that unneeded execute file permissions have been removed. Bug-AGL: SPEC-3658 Signed-off-by: Scott Murray --- COPYING.MIT | 17 + README | 71 + meta-agl-refhw-gen3/conf/layer.conf | 16 + meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md | 161 ++ .../arm-trusted-firmware_%.bbappend | 26 + .../files/0001-add-st_asm330lhh-driver.patch | 2112 ++++++++++++++++++++ ...-Introduce-dts-file-for-refhw-r-car-board.patch | 90 + .../0002-agl-reference-hardware-sample-bsp.patch | 846 ++++++++ .../recipes-kernel/files/refhw-rcar.cfg | 35 + .../recipes-kernel/linux-renesas_%.bbappend | 12 + 10 files changed, 3386 insertions(+) create mode 100644 COPYING.MIT create mode 100644 README create mode 100644 meta-agl-refhw-gen3/conf/layer.conf create mode 100644 meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md create mode 100644 meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend create mode 100644 meta-agl-refhw-gen3/recipes-kernel/files/0001-add-st_asm330lhh-driver.patch create mode 100644 meta-agl-refhw-gen3/recipes-kernel/files/0002-Introduce-dts-file-for-refhw-r-car-board.patch create mode 100644 meta-agl-refhw-gen3/recipes-kernel/files/0002-agl-reference-hardware-sample-bsp.patch create mode 100644 meta-agl-refhw-gen3/recipes-kernel/files/refhw-rcar.cfg create mode 100644 meta-agl-refhw-gen3/recipes-kernel/linux-renesas_%.bbappend diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..89de354 --- /dev/null +++ b/COPYING.MIT @@ -0,0 +1,17 @@ +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. diff --git a/README b/README new file mode 100644 index 0000000..e806db8 --- /dev/null +++ b/README @@ -0,0 +1,71 @@ +This README file contains information on the contents of the meta-agl-refhw-gen3 +layer which provides the reference hardware support for AGL environment. + +Dependency +========== + +- Yocto layers of AGL Happy Halibut. + Especially depends on meta-renesas-rcar-gen3. + + +Build Instructions +================== + + I. Adding the meta-agl-refhw-gen3 layer to your AGL environment + II. Build agl-demo-platform by using meta-agl-refhw-gen3 +III. Update firmware. + IV. Notes + + +I. Adding the meta-agl-refhw-gen3 layer to your AGL environment +============================================================== + +You can add this layer to your AGL HH environemnt as following: + +1. Put meta-refhw folder into the "$AGL_TOP/bsp" directory where AGL BSP layers + like meta-renesas-rcar-gen3/ are placed. + # See "Downloading AGL Software" in AGL developper site. + +2. Put refhw-h3 folder into the meta-agl/templates/machine where other machine + configuration files are placed. + +II. Build for Reference Hardware +================================ +You should follow the instructions in "Building for Supported Renesas Boards" +section in AGL developper site to build images for reference hardware. + +The modification needed is to set machine to "refhw-h3" when execute +aglsetup.sh (parameter of "-m" option). + + $ cd $AGL_TOP + $ source meta-agl/scripts/aglsetup.sh -m refhw-h3 -b build \ + agl-devel agl-demo agl-netboot agl-appfw-smack agl-localdev + +The "real" MACHINE in the internal building is set to "salvator-x" so that we +can divert the configurations defined for salvator-x. While, the DTB file used +by reference hardware is "r8a7795-refhw.dtb". so the settings in u-boot is +expected as following (in case of booting from the Micro SD card in SD#0): + + => setenv bootargs 'console=ttySC0,115200 root=/dev/mmcblk1p1 rootwait ro rootfstype=ext4' + => setenv bootcmd 'run load_ker; run load_dtb; booti 0x48080000 - 0x48000000' + => setenv load_dtb 'ext4load mmc 0:1 0x48000000 /boot/r8a7795-refhw.dtb' + => setenv load_ker 'ext4load mmc 0:1 0x48080000 /boot/Image' + => saveenv + + => printenv + ... + bootargs=console=ttySC0,115200 root=/dev/mmcblk1p1 rootwait ro rootfstype=ext4 + bootcmd=run load_ker; run load_dtb; booti 0x48080000 - 0x48000000 + load_dtb=ext4load mmc 0:1 0x48000000 /boot/r8a7795-refhw.dtb + load_ker=ext4load mmc 0:1 0x48080000 /boot/Image + .. + +III. Update firmware. +===================== +Please refer to meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md for detail. + +IV. Notes +========== +1. SD#1 is not supported. +2. There are suspicious HDMI0/1 interrupts detected and disabled forcely by + the kernel during boot. The reason is under investigation. diff --git a/meta-agl-refhw-gen3/conf/layer.conf b/meta-agl-refhw-gen3/conf/layer.conf new file mode 100644 index 0000000..645235d --- /dev/null +++ b/meta-agl-refhw-gen3/conf/layer.conf @@ -0,0 +1,16 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += " \ + ${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend \ + ${LAYERDIR}/recipes-*/*.bb \ + ${LAYERDIR}/recipes-*/*.bbappend \ +" + +BBFILE_COLLECTIONS += "agl-refhw-gen3" +BBFILE_PATTERN_agl-refhw-gen3 = "^${LAYERDIR}" +BBFILE_PRIORITY_agl-refhw-gen3 = "11" + +LAYERSERIES_COMPAT_agl-refhw-gen3 = "thud" diff --git a/meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md b/meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md new file mode 100644 index 0000000..9e826dc --- /dev/null +++ b/meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md @@ -0,0 +1,161 @@ +# Reference Hardware Board + +- [About](#about) +- [Difference to Salvator-XS When Flashing Firmware](#difference-to-salvator-xs-when-flashing-firmware) +- [How to build the Flash Writer](#how-to-build-the-flash-writer) +- [How to Flash Firmware](#how-to-flash-firmware) + + +## About +Reference hardware board with R-Car H3 SoC is made by Panasonic for AGL community. + +## Difference to Salvator-XS When Flashing Firmware + +The HyperFlash/QSPI flash switch function is not implemented on reference +hardware board at present, HyperFlash and QSPI flash are not used. +Firmwares (arm-trusted-firmware, U-boot...) are stored into eMMC and updated by +using serial download. + +## How to build the Flash Writer + +1. Gets cross compiler. +``` + $ cd ~/ + $ wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-elf/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-elf.tar.xz + $ tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-elf.tar.xz +``` + +2. Prepare the source code +``` + $ cd ~/ + $ git clone https://github.com/renesas-rcar/flash_writer.git + $ cd flash_writer + $ git checkout rcar_gen3 +``` + +3. Build the Flash Writer +``` + $ make AArch=64 clean + $ CROSS_COMPILE=~/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-elf/bin/aarch64-elf- make AArch=64 +``` + +Output the following image. +./AArch64_output/AArch64_Flash_writer_SCIF_DUMMY_CERT_E6300400_salvator-x.mot + +## How to Flash Firmware + +1. Connect reference hardware board to the development PC by using USB serial + cable. +2. Open a serial console (like Teraterm in Windows, or gtkterm in Ubuntu that + can easily send files) with a baudrate of 115200n8. +3. Set bit2 of SW2221 (on the top of SoC board) to "off"which turns SW2221 to be + off,off,off,off. +4. Power on the reference board, you will find fillowing message outputed on the + serial console: + +``` + SCIF Download mode (w/o verification) + (C) Renesas Electronics Corp. + + -- Load Program to SystemRAM --------------- + please send ! + +``` +5. Use console application menu to send the flash writer binary provided: + +``` + AArch64_Flash_writer_SCIF_DUMMY_CERT_E6300400_salvator-x.mot +``` +6. After file is transferred correctly, following message will be outputed: + +``` + Flash writer for R-Car H3/M3/M3N Series V1.11 Feb.12,2020 + > +``` +7. Set reference board to boot from eMMC. + + \> **EM_SECSD** + Please Input EXT_CSD Index(H'00 - H'1FF) :**b1** + EXT_CSD[B1] = 0x00 + Please Input Value(H'00 - H'FF) :**a** + EXT_CSD[B1] = 0x0A + + \> **EM_SECSD** + Please Input EXT_CSD Index(H'00 - H'1FF) :**b3** + EXT_CSD[B3] = 0x00 + Please Input Value(H'00 - H'FF) :**8** + EXT_CSD[B3] = 0x08 + + \>**EM_DCSD** + [CSD Field Data] + [127:126] CSD_STRUCTURE 0x03 + [125:122] SPEC_VERS 0x04 + [119:112] TAAC 0x27 + [111:104] NSAC 0x01 + [103: 96] TRAN_SPEED 0x32 + [ 95: 84] CCC 0x00F5 + [ 83: 80] READ_BL_LEN 0x09 + [ 79: 79] READ_BL_PARTIAL 0x00 + [ 78: 78] WRITE_BLK_MISALIGN 0x00 + [ 77: 77] READ_BLK_MISALIGN 0x00 + [ 76: 76] DSR_IMP 0x00 + [ 73: 62] C_SIZE 0x0FFF + [ 61: 59] VDD_R_CURR_MIN 0x06 + [ 58: 56] VDD_R_CURR_MAX 0x06 + [ 55: 53] VDD_W_CURR_MIN 0x06 + [ 52: 50] VDD_W_CURR_MAX 0x06 + [ 49: 47] C_SIZE_MULT 0x07 + [ 46: 42] ERASE_GRP_SIZE 0x1F + [ 41: 37] ERASE_GRP_MULT 0x1F + [ 36: 32] WP_GRP_SIZE 0x0F + [ 31: 31] WP_GRP_ENABLE 0x01 + [ 30: 29] DEFAULT_ECC 0x00 + [ 28: 26] R2W_FACTOR 0x03 + [ 25: 22] WRITE_BL_LEN 0x09 + [ 21: 21] WRITE_BL_PARTIAL 0x00 + [ 16: 16] CONTENT_PROT_APP 0x00 + [ 15: 15] FILE_FORMAT_GRP 0x00 + [ 14: 14] COPY 0x01 + [ 13: 13] PERM_WRITE_PROTECT 0x00 + [ 12: 12] TMP_WRITE_PROTECT 0x00 + [ 11: 10] FILE_FORMAT 0x00 + [ 9: 8] ECC 0x00 + [ 7: 1] CRC 0x00 + + +8. Flash firmware + The firmware are supposed to be stored on eMMC as following: + + Name | Load address | eMMC partition | Flash address | Description + --------------------------------------|-----------------------|-----------------------|-----------------------|----------------------------- + bootparam_sa0-4x2g.srec | H'E6320000 | 1 | H'000000 | Boot parameter + bl2-salvator-x-4x2g.srec | H'E6304000 | 1 | H'00001E | bl2 loader + cert_header_sa6-4x2g.srec | H'E6320000 | 1 | H'000180 | Certification + bl31-salvator-x-4x2g.srec | H'44000000 | 1 | H'000200 | bl3 loader + tee-salvator-x.srec | H'44100000 | 1 | H'001000 | OP-Tee + u-boot-elf-salvator-xs-4x2g.srec | H'50000000 | 2 | H'000000 | U-boot + + You can find these firmwares in the AGL build directory $AGL_TOP/build/tmp/deploy/images/salvator-x + and you can flash them by using **EM_W** command as following: + + \> **EM_W** + \--------------------------------------------------------- + Please select,eMMC Partition Area. + 0:User Partition Area : 62496768 KBytes + eMMC Sector Cnt : H'0 - H'07733FFF + 1:Boot Partition 1 : 32640 KBytes + eMMC Sector Cnt : H'0 - H'0000FEFF + 2:Boot Partition 2 : 32640 KBytes + eMMC Sector Cnt : H'0 - H'0000FEFF + \--------------------------------------------------------- + Select area(0-2)> **\** + -- Boot Partition X Program ----------------------------- + Please Input Start Address in sector : **\** + Please Input Program Start Address : **\** + Work RAM(H'50000000-H'50FFFFFF) Clear.... + please send ! ('.' & CR stop load) + **\** + +9. Power off the board. +10. Reset bit2 of SW2221 (on the top of SoC board) to "on", which turns SW2221 to be + off,on,off,off diff --git a/meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend b/meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend new file mode 100644 index 0000000..1fccf80 --- /dev/null +++ b/meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend @@ -0,0 +1,26 @@ +#FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/:" + +# There are hardware issues in using hyperflash. arm-trusted-firmware, optee and +# u-boot have to be stored into eMMC by using serial donwload. +EMMC_BOOT_OPTION = "RCAR_SA6_TYPE=1" + +DDR_8G_OPTION= "RCAR_DRAM_LPDDR4_MEMCONF=1" + +ATFW_OPT_append_refhw = " ${EMMC_BOOT_OPTION} " + +# In arm-trusted-firmware-control.inc, a "extra_ipl_opt" task is appended to +# create firmware for 4x2g or 2x2g variation. it is supposed to use +# EXTRA_ATFW_OPT to customize the compiler opton. +# +#EXTRA_ATFW_OPT_append_refhw = " ${EMMC_BOOT_OPTION} ${DDR_8G_OPTION} " +# +# Unfortunately in do_extra_ipl_opt() it use d.setVar() instead of d.appendVar() +# to setup EXTRA_ATFW_OPT variable which makes it impossible to customize it properly +# by others... Override it. +# +# +do_ipl_opt_compile_refhw () { + oe_runmake distclean + oe_runmake bl2 bl31 dummytool PLAT=${PLATFORM} ${EXTRA_ATFW_OPT} ${ATFW_OPT_LOSSY} ${EMMC_BOOT_OPTION} ${DDR_8G_OPTION} +} + diff --git a/meta-agl-refhw-gen3/recipes-kernel/files/0001-add-st_asm330lhh-driver.patch b/meta-agl-refhw-gen3/recipes-kernel/files/0001-add-st_asm330lhh-driver.patch new file mode 100644 index 0000000..c779b39 --- /dev/null +++ b/meta-agl-refhw-gen3/recipes-kernel/files/0001-add-st_asm330lhh-driver.patch @@ -0,0 +1,2112 @@ +--- + drivers/iio/imu/st_asm330lhh/Kconfig | 22 + + drivers/iio/imu/st_asm330lhh/Makefile | 5 + + drivers/iio/imu/st_asm330lhh/README.md | 201 +++++ + drivers/iio/imu/st_asm330lhh/st_asm330lhh.h | 247 ++++++ + drivers/iio/imu/st_asm330lhh/st_asm330lhh_buffer.c | 540 ++++++++++++++ + drivers/iio/imu/st_asm330lhh/st_asm330lhh_core.c | 824 +++++++++++++++++++++ + drivers/iio/imu/st_asm330lhh/st_asm330lhh_i2c.c | 94 +++ + drivers/iio/imu/st_asm330lhh/st_asm330lhh_spi.c | 109 +++ + 8 files changed, 2042 insertions(+) + create mode 100644 drivers/iio/imu/st_asm330lhh/Kconfig + create mode 100644 drivers/iio/imu/st_asm330lhh/Makefile + create mode 100644 drivers/iio/imu/st_asm330lhh/README.md + create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh.h + create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_buffer.c + create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_core.c + create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_i2c.c + create mode 100644 drivers/iio/imu/st_asm330lhh/st_asm330lhh_spi.c + +diff --git a/drivers/iio/imu/st_asm330lhh/Kconfig b/drivers/iio/imu/st_asm330lhh/Kconfig +new file mode 100644 +index 0000000..0e8920e +--- /dev/null ++++ b/drivers/iio/imu/st_asm330lhh/Kconfig +@@ -0,0 +1,22 @@ ++config IIO_ST_ASM330LHH ++ tristate "STMicroelectronics ASM330LHH sensor" ++ depends on (I2C || SPI) ++ select IIO_BUFFER ++ select IIO_KFIFO_BUF ++ select IIO_ST_ASM330LHH_I2C if (I2C) ++ select IIO_ST_ASM330LHH_SPI if (SPI_MASTER) ++ help ++ Say yes here to build support for STMicroelectronics ASM330LHH imu ++ sensor. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called st_asm330lhh. ++ ++config IIO_ST_ASM330LHH_I2C ++ tristate ++ depends on IIO_ST_ASM330LHH ++ ++config IIO_ST_ASM330LHH_SPI ++ tristate ++ depends on IIO_ST_ASM330LHH ++ +diff --git a/drivers/iio/imu/st_asm330lhh/Makefile b/drivers/iio/imu/st_asm330lhh/Makefile +new file mode 100644 +index 0000000..7af80de +--- /dev/null ++++ b/drivers/iio/imu/st_asm330lhh/Makefile +@@ -0,0 +1,5 @@ ++st_asm330lhh-y := st_asm330lhh_core.o st_asm330lhh_buffer.o ++ ++obj-$(CONFIG_IIO_ST_ASM330LHH) += st_asm330lhh.o ++obj-$(CONFIG_IIO_ST_ASM330LHH_I2C) += st_asm330lhh_i2c.o ++obj-$(CONFIG_IIO_ST_ASM330LHH_SPI) += st_asm330lhh_spi.o +diff --git a/drivers/iio/imu/st_asm330lhh/README.md b/drivers/iio/imu/st_asm330lhh/README.md +new file mode 100644 +index 0000000..d471530 +--- /dev/null ++++ b/drivers/iio/imu/st_asm330lhh/README.md +@@ -0,0 +1,201 @@ ++Index ++======= ++ * Introduction ++ * Driver Integration details ++ * Android SensorHAL integration ++ * Linux SensorHAL integration ++ * More information ++ * Copyright ++ ++ ++Introduction ++============== ++This repository contains asm330lhh IMU STMicroelectronics MEMS sensor linux driver support for kernel version 4.14. ++ ++Data collected by asm330lhh STM sensor are pushed to userland through the kernel buffers of Linux IIO framework. User space applications can get sensor events by reading the related IIO devices created in the /dev directory (*/dev/iio{x}*). Please see [IIO][1] for more information. ++ ++Asm330lhh IMU STM MEMS sensor support *I2C/SPI* digital interface. Please refer to [I2C][2] and [SPI][3] for detailed documentation. ++ ++The STM Hardware Abstraction Layer (*HAL*) defines a standard interface for STM sensors allowing Android to be agnostic about low level driver implementation. The HAL library is packaged into modules (.so) file and loaded by the Android or Linux system at the appropriate time. For more information see [AOSP HAL Interface](https://source.android.com/devices/sensors/hal-interface.html) ++ ++STM Sensor HAL is leaning on [Linux IIO framework](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/iio) to gather data from sensor device drivers and to forward samples to the Android Framework ++ ++Driver Integration details ++===================== ++ ++In order to explain how to integrate Asm330lhh IMU STM sensor into the kernel, please consider the following example ++ ++### Source code integration ++ ++> * Copy driver source code into your linux kernel target directory (e.g. *drivers/iio/imu*) ++> * Edit related Kconfig (e.g. *drivers/iio/imu/Kconfig*) adding *ASM330LHH* support: ++ ++> source "drivers/iio/imu/st_asm330lhh/Kconfig" ++ ++> * Edit related Makefile (e.g. *drivers/iio/imu/Makefile*) adding the following line: ++ ++> obj-y += st_asm330lhh/ ++ ++### Device Tree configuration ++ ++> To enable driver probing, add the asm330lhh node to the platform device tree as described below. ++ ++> **Required properties:** ++ ++> *- compatible*: "st,asm330lhh" ++ ++> *- reg*: the I2C address or SPI chip select the device will respond to ++ ++> *- interrupt-parent*: phandle to the parent interrupt controller as documented in [interrupts][4] ++ ++> *- interrupts*: interrupt mapping for IRQ as documented in [interrupts][4] ++> ++>**Recommended properties for SPI bus usage:** ++ ++> *- spi-max-frequency*: maximum SPI bus frequency as documented in [SPI][3] ++> ++> **Optional properties:** ++ ++> *- st,drdy-int-pin*: MEMS sensor interrupt line to use (default 1) ++ ++> I2C example (based on Raspberry PI 3): ++ ++> &i2c0 { ++> status = "ok"; ++> #address-cells = <0x1>; ++> #size-cells = <0x0>; ++> asm330lhh@6b { ++> compatible = "st,asm330lhh"; ++> reg = <0x6b>; ++> interrupt-parent = <&gpio>; ++> interrupts = <26 IRQ_TYPE_EDGE_RISING>; ++> }; ++ ++> SPI example (based on Raspberry PI 3): ++ ++> &spi0 { ++> status = "ok"; ++> #address-cells = <0x1>; ++> #size-cells = <0x0>; ++> asm330lhh@0 { ++> spi-max-frequency = <500000>; ++> compatible = "st,asm330lhh"; ++> reg = <0>; ++> interrupt-parent = <&gpio>; ++> interrupts = <26 IRQ_TYPE_EDGE_RISING>; ++> }; ++ ++### Kernel configuration ++ ++Configure kernel with *make menuconfig* (alternatively use *make xconfig* or *make qconfig*) ++ ++> Device Drivers ---> ++> Industrial I/O support ---> ++> Inertial measurement units ---> ++> STMicroelectronics ASM330LHH sensor ---> ++ ++ ++Android SensorHAL integration ++============== ++ ++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 */hardware/STMicroelectronics/SensorHAL_IIO* folder. During building process Android will include automatically the SensorHAL Android.mk. ++In */device///device.mk* add package build information: ++ ++ PRODUCT_PACKAGES += sensors.{TARGET_BOARD_PLATFORM} ++ ++ Note: device.mk can not read $(TARGET_BOARD_PLATFORM) variable, read and replace the value from your BoardConfig.mk (e.g. PRODUCT_PACKAGES += sensors.msm8974 for Nexus 5) ++ ++To compile the SensorHAL_IIO just build AOSP source code from *$TOP* folder ++ ++ $ cd ++ $ source build/envsetup.sh ++ $ lunch