SlideShare a Scribd company logo
1 of 34
Download to read offline
Heterogeneous Multiprocessing
with Android on NXP i.MX 7
Laura Nao, Nicola La Gloria
Kynetics, Santa Clara, CA
About us.
● Kynetics is full software stack engineering firm
○ Embedded Unit
○ Application Unit
● We support NXP embedded application processors
● Custom Android OS for different industries.
○ Kernel development
○ API Device Integration (HAL)
○ Custom system services (native, Java)
● Continuous building and delivery of artifacts
Outline (1/2)
1. Introduction to AMP
○ SMP vs AMP
○ i.MX7 overview
○ OpenAMP framework
2. RPMsg in Android kernel
○ RPMsg character driver overview
○ Implementation in the Linux kernel
3. Android porting on Colibri i.MX7
○ Kynetics’ Cohesys BSP for Colibri i.MX 7
SMP vs AMP
SMP on homogeneous architectures:
● Single OS controlling two or
more identical cores sharing
system resources
● Dynamic scheduling and load
balancing
. . .
App App
OS
Coren
Core1
...
Kernel SMP
Outline (2/2)
4. Cohesys AMP demo - Headless mode
○ Cohesys Android/FreeRTOS demo - Goal
○ Cohesys Android/FreeRTOS demo - HW Setup
○ IMU data sampling (FreeRTOS)
○ Android native IPC client
5. Android AMP demo - Headful mode
○ Android App overview
○ Java bridge to native IPC library (JNI)
○ GUI
6. Hands-on videos
7. Q&A
SMP vs AMP
AMP on heterogeneous
architectures:
● Different OS on each core -->
full-featured OS alongside a
real-time kernel
● Inter processor communication
protocol
● Efficient when the application
can be statically partitioned
across cores - high performance
is achieved locally
. . .
App App Task Task
OS OS/RTOS
Coren
Core1
...
MCAPI
Why Heterogeneous Systems?
A growing number of embedded systems require concurrent execution in
segregated environments:
● Real time performances to access certain devices/peripherals
● Power consumption (MCU + MPU systems were used in the past)
○ Data aggregation from sensors
● System integrity: segregation (Rich OS + critical subsystem)
○ Multi-chip approach
○ Virtualization
○ HMP (Heterogeneous multiprocessing) ←
● Cortex-A7 core + Cortex-M4 core
● Master - Slave architecture
○ A7 is the master
○ M4 is the slave
● Inter processor communication
○ MU - Messaging Unit
○ RPMsg component (OpenAMP framework)
● Safe sharing of I/O resources
○ RDC - Resource Domain Controller
NXP i.MX7 overview
i.MX7 Reference Manual: https://www.nxp.com/docs/en/reference-manual/IMX7DRM.pdf
Why Embedded Android
● Very application oriented: abstraction between low level hardware and
application layers
● Rich UI SDK
○ Native (NDK)
○ Java (SDK)
● Great debugging tools
● Productive development environment
○ Android Studio
○ Gradle based build system
● Almost any java developer can be an “embedded application developer”
OpenAMP framework: Inter-processor communication
RPMsg
VirtIO/Virtqueue
Shared memory
Inter-core interrupts
RPMsg Lite,
OpenAMP Rpmsg,
...
VirtIO, Virtqueue, Vring
Shmem, MU, Mailbox
Transport Layer
MAC Layer
Physical Layer
OpenAMP framework: MAC (VirtIO)
virtqueue
struct vring
short used_idx
short avail_idx
Int (*add_buff)(..)
void*(*get_buff)(..)
void(*kick)(..)
vring_desc
vring_desc
vring_desc
vring_desc
vring_desc
vring_avail
vring_used
...
VRING Buffer list
Buffer
Buffer
Buffer
Shared Memory
VirtIO Communication
Master (A7) transmit to Remote (M4)
● Master get_buff() from virtqueue1
○ get idx from USED ring
● Master fills the buffer
● Master add_buff() to the virtqueue1
○ write buffer idx in AVAIL ring and increment idx
● Remote get_buff() from AVAIL ring
○ Remote add_buff() to USED ring (freed)
● Master writes buffer idx to USED ring and increment idx
Master (A7) receives from Remote (M4)
● Master get_buff() from virtqueue2
○ get idx from USED ring tail
● Master add_buff() to the virtqueue2
○ write buffer idx AVAIL in ring and
increment
● Remote get_buff() from AVAIL ring
and fills the buffer
○ Remote add_ buff() to USED
ring and increment
● Master get_buff() from USED ring
OpenAMP framework - RPMsg channels and endpoints
RPMsg character driver
The Linux RPMsg char driver exposes RPMsg endpoints to user-space processes.
● Supports the creation of multiple endpoints for each RPMsg device
● Each created endpoint device shows up as a single character device in /dev
● Provides multiple interfaces:
○ Control interface: allows creation/destruction of endpoint interfaces
○ Endpoint interface (one for each exposed endpoint): allows creation, destruction
and interaction with endpoints
The driver was first introduced in the Linux 4.11 version (sources can be found in the drivers
folder of mainline kernel). More info are available in our technical note.
RPMsg character driver
Implementation in Linux Kernel
Cohesys BSP
Board Support Package for Toradex Colibri-iMX7 SoM:
● Android 7.1.2
● U-Boot 2017.03 (from NXP) + support for .ELF files
● Linux Kernel 4.9 + RPMsg character driver backported from Kernel 4.11
This build is compatible with:
● Colibri i.MX7 eMMC SOM 1GB RAM
● Toradex Iris carrier board
● 7” capacitive parallel display from Toradex
Hybrid Android/FreeRTOS Demo - Goal
● FreeRTOS binary running on Cortex-M4
○ Sample IMU sensor
○ Send data upon configuration:
➢ VECTOR mode - raw acc, mag, gyro data
➢ NORM mode - norm of acc, mag, gyro vectors
● Android executable running on Cortex-A7 [i.e. “headless” mode]
○ Check inter-core communication and log received data on a text file
● Android app running on Cortex-A7 [i.e. “headful” mode]
○ Sensor data plotting
Hybrid Android/FreeRTOS Demo - HW Setup
● Toradex Iris Carrier Board w/
Colibri i.MX7 SOM
● Adafruit Precision NXP 9-DOF
Breakout Board (via I2C)
○ FXOS8700 3-Axis
accelerometer and
magnetometer
○ FXAS21002 3-axis
gyroscope
Architecture Overview
TXT
IMU data sampling (FreeRTOS app)
TXT
IMU data sampling (FreeRTOS app)
TXT
Android native IPC client
TXT
https://youtu.be/LjGJndErk8g
Headless Demo Video
Android app overview
JNI - native to Java code
Java: impossibility of interacting directly with the hardware
JNI: Glue layer between Java and the lower layers of the OS
● Provides support for interacting with native code like C/C++
● Map native methods which interact directly with the hardware
● Java code declares static native methods in whatever class in the code
● Main Activity loads the native libraries (.so or .dll) where native methods are
implemented (in C) and bind them to the class where they have been
declared (native).
Android OS and JNI
Picture by Karim Yaghmour
Native IPC library (JNI)
Motivation: The Android app needs to
interact with the control interface exposed
by the RPMsg char driver:
● Endpoint creation requires ioctl
operation on the control interface
● Ioctl operations cannot be done
from Java code
Activity
JNI wrapper
Native library
Android kernel
Rpmsg char driver
UI app
Linux process
● Low level operation on RPMsg devices
(e.g. creating/destroying endpoints) are
handled by native C methods.
JNI endpoint creation
#define RPMSG_CREATE_EPT_IOCTL _IOW(0xb5, 0x1, struct rpmsg_endpoint_info)
/* Open controller device */
fd_ctrldev = open(/dev/rpmsg_ctrl0, O_RDONLY);
/* Create endpoint device */
ret = ioctl(fd_ctrldev, RPMSG_CREATE_EPT_IOCTL, &ep);
if (ret < 0) {
__android_log_print(ANDROID_LOG_INFO, "openDeviceNative", "Error creating endpoint device: %s
n",strerror(errno));
close(fd_ctrldev);
return NULL;
}
GUI
Plotting libraries used: https://github.com/PhilJay/MPAndroidChart
● VECTOR mode: plots raw values of
the three components (i.e. x, y, z) of
respectively the acc, mag and gyro
vectors.
● NORM mode : plots the norm values
of the acc, mag and gyro vectors.
There is one plot for each sensor.
● NORM mode is selected by default
during application startup.
I/O Data Rate
Remote core:
● Sample IMUs every 10ms - 100 Hz
● Buffer of 300 elements = 3Kb (TCM Memory is only 32 Kb - bigger buffer is possible if
application is moved to DDR)
○ In NORM mode each element is 12 byte (3 float * 4 bytes each float)
○ In VECTOR mode each element is 36 byte
● Items are dequeued and sent to master 10 at a time every 100 ms
○ In NORM mode sending speed is 1.32KB/s (with RPMSG header)
○ In VECTOR mode sending speed is 3.67KB/s (with RPMSG header)
Master core:
● At the driver layer
○ In NORM mode receiving speed is ~0.93KB/s (without RPMSG header)
○ In VECTOR mode receiving speed is ~3.51KB/s (without RPMSG header)
Headfull Demo Video
https://youtu.be/2u6bOJbrFW0
https://youtu.be/D5Dh9G9JB18
Setup Demo Video
References
● Kynetics Technical Notes: http://kynetics.com/docs
○ Android Asymmetric Multiprocessing on Toradex Colibri i.MX7D
○ RPMsg device and driver on Linux and Android
○ Android Asymmetric Multiprocessing on i.MX7: Remote Core Sensors Data
Streaming in Java
● Kynetics GitHub: https://github.com/kynetics
● OpenAMP project page
● An Introduction to Asymmetric Multiprocessing: When this Architecture can be a Game
Changer (ELC 2018)
Q&A

More Related Content

What's hot

“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...
“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...
“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...
Edge AI and Vision Alliance
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
ShapeBlue
 
X / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural OverviewX / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural Overview
Moriyoshi Koizumi
 

What's hot (20)

Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
 
Introduction to Optee (26 may 2016)
Introduction to Optee (26 may 2016)Introduction to Optee (26 may 2016)
Introduction to Optee (26 may 2016)
 
Basic of virtual memory of Linux
Basic of virtual memory of LinuxBasic of virtual memory of Linux
Basic of virtual memory of Linux
 
AMP Kynetics - ELC 2018 Portland
AMP  Kynetics - ELC 2018 PortlandAMP  Kynetics - ELC 2018 Portland
AMP Kynetics - ELC 2018 Portland
 
“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...
“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...
“Making Edge AI Inference Programming Easier and Flexible,” a Presentation fr...
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
 
강좌 개요
강좌 개요강좌 개요
강좌 개요
 
강좌 01 ARM 프로세서 개요
강좌 01 ARM 프로세서 개요강좌 01 ARM 프로세서 개요
강좌 01 ARM 프로세서 개요
 
20111015 勉強会 (PCIe / SR-IOV)
20111015 勉強会 (PCIe / SR-IOV)20111015 勉強会 (PCIe / SR-IOV)
20111015 勉強会 (PCIe / SR-IOV)
 
Fun with Network Interfaces
Fun with Network InterfacesFun with Network Interfaces
Fun with Network Interfaces
 
Review of QNX
Review of QNXReview of QNX
Review of QNX
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
 
An Introduction to OpenCL™ Programming with AMD GPUs - AMD & Acceleware Webinar
An Introduction to OpenCL™ Programming with AMD GPUs - AMD & Acceleware WebinarAn Introduction to OpenCL™ Programming with AMD GPUs - AMD & Acceleware Webinar
An Introduction to OpenCL™ Programming with AMD GPUs - AMD & Acceleware Webinar
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Simultaneously Leveraging Linux and Android in a GENIVI compliant IVI System
Simultaneously Leveraging Linux and Android in a GENIVI compliant IVI System Simultaneously Leveraging Linux and Android in a GENIVI compliant IVI System
Simultaneously Leveraging Linux and Android in a GENIVI compliant IVI System
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
X / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural OverviewX / DRM (Direct Rendering Manager) Architectural Overview
X / DRM (Direct Rendering Manager) Architectural Overview
 

Similar to Heterogeneous multiprocessing on androd and i.mx7

Multi-Processor computing with OpenMP
Multi-Processor computing with OpenMPMulti-Processor computing with OpenMP
Multi-Processor computing with OpenMP
Stefan Coetzee
 
Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...
Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...
Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...
Pradeep Singh
 
0xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp020xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp02
chon2010
 

Similar to Heterogeneous multiprocessing on androd and i.mx7 (20)

Asymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandAsymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
 
Deep Learning on ARM Platforms - SFO17-509
Deep Learning on ARM Platforms - SFO17-509Deep Learning on ARM Platforms - SFO17-509
Deep Learning on ARM Platforms - SFO17-509
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3
 
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese..."Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
 
BPF Hardware Offload Deep Dive
BPF Hardware Offload Deep DiveBPF Hardware Offload Deep Dive
BPF Hardware Offload Deep Dive
 
Embedded platform choices
Embedded platform choicesEmbedded platform choices
Embedded platform choices
 
Webinar: OpenEBS - Still Free and now FASTEST Kubernetes storage
Webinar: OpenEBS - Still Free and now FASTEST Kubernetes storageWebinar: OpenEBS - Still Free and now FASTEST Kubernetes storage
Webinar: OpenEBS - Still Free and now FASTEST Kubernetes storage
 
A Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm BasebandsA Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm Basebands
 
LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205
 
Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
 
Rlite software-architecture (1)
Rlite software-architecture (1)Rlite software-architecture (1)
Rlite software-architecture (1)
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The Beginning
 
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
 
Multi-Processor computing with OpenMP
Multi-Processor computing with OpenMPMulti-Processor computing with OpenMP
Multi-Processor computing with OpenMP
 
Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...
Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...
Development of Signal Processing Algorithms using OpenCL for FPGA based Archi...
 
0xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp020xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp02
 
Leveraging Android's Linux Heritage
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux Heritage
 
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
BPF  & Cilium - Turning Linux into a Microservices-aware Operating SystemBPF  & Cilium - Turning Linux into a Microservices-aware Operating System
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
 
Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102
 

More from Kynetics

More from Kynetics (10)

Eclipse Hara, Updating Embedded Devices with hawkBit Made Easy
Eclipse Hara, Updating Embedded Devices with hawkBit Made EasyEclipse Hara, Updating Embedded Devices with hawkBit Made Easy
Eclipse Hara, Updating Embedded Devices with hawkBit Made Easy
 
Deploy Eclipse hawBit in Production
Deploy Eclipse hawBit in ProductionDeploy Eclipse hawBit in Production
Deploy Eclipse hawBit in Production
 
Orchestrated Android-Style System Upgrades for Embedded Linux
Orchestrated Android-Style System Upgrades for Embedded LinuxOrchestrated Android-Style System Upgrades for Embedded Linux
Orchestrated Android-Style System Upgrades for Embedded Linux
 
ELC2019 - Poster - Update Anything
ELC2019 - Poster - Update Anything ELC2019 - Poster - Update Anything
ELC2019 - Poster - Update Anything
 
Eclipse Iot Day 2018 Presentation
Eclipse Iot Day 2018 PresentationEclipse Iot Day 2018 Presentation
Eclipse Iot Day 2018 Presentation
 
Eclipsecon 2017 presentation
Eclipsecon 2017 presentationEclipsecon 2017 presentation
Eclipsecon 2017 presentation
 
Using Java on Wearable Devices featuring an Hybrid Architecture.
Using Java on Wearable Devices featuring an Hybrid Architecture.Using Java on Wearable Devices featuring an Hybrid Architecture.
Using Java on Wearable Devices featuring an Hybrid Architecture.
 
Deploy Small IoT Embedded SOC Devices and a Back-End Platform with Java, usin...
Deploy Small IoT Embedded SOC Devices and a Back-End Platform with Java, usin...Deploy Small IoT Embedded SOC Devices and a Back-End Platform with Java, usin...
Deploy Small IoT Embedded SOC Devices and a Back-End Platform with Java, usin...
 
Reactive IoT, Java One 2016
Reactive IoT, Java One 2016Reactive IoT, Java One 2016
Reactive IoT, Java One 2016
 
Linaro Connect 2017 - Presentation - Kynetics
Linaro Connect 2017 - Presentation - KyneticsLinaro Connect 2017 - Presentation - Kynetics
Linaro Connect 2017 - Presentation - Kynetics
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

Heterogeneous multiprocessing on androd and i.mx7

  • 1. Heterogeneous Multiprocessing with Android on NXP i.MX 7 Laura Nao, Nicola La Gloria Kynetics, Santa Clara, CA
  • 2. About us. ● Kynetics is full software stack engineering firm ○ Embedded Unit ○ Application Unit ● We support NXP embedded application processors ● Custom Android OS for different industries. ○ Kernel development ○ API Device Integration (HAL) ○ Custom system services (native, Java) ● Continuous building and delivery of artifacts
  • 3. Outline (1/2) 1. Introduction to AMP ○ SMP vs AMP ○ i.MX7 overview ○ OpenAMP framework 2. RPMsg in Android kernel ○ RPMsg character driver overview ○ Implementation in the Linux kernel 3. Android porting on Colibri i.MX7 ○ Kynetics’ Cohesys BSP for Colibri i.MX 7
  • 4. SMP vs AMP SMP on homogeneous architectures: ● Single OS controlling two or more identical cores sharing system resources ● Dynamic scheduling and load balancing . . . App App OS Coren Core1 ... Kernel SMP
  • 5. Outline (2/2) 4. Cohesys AMP demo - Headless mode ○ Cohesys Android/FreeRTOS demo - Goal ○ Cohesys Android/FreeRTOS demo - HW Setup ○ IMU data sampling (FreeRTOS) ○ Android native IPC client 5. Android AMP demo - Headful mode ○ Android App overview ○ Java bridge to native IPC library (JNI) ○ GUI 6. Hands-on videos 7. Q&A
  • 6. SMP vs AMP AMP on heterogeneous architectures: ● Different OS on each core --> full-featured OS alongside a real-time kernel ● Inter processor communication protocol ● Efficient when the application can be statically partitioned across cores - high performance is achieved locally . . . App App Task Task OS OS/RTOS Coren Core1 ... MCAPI
  • 7. Why Heterogeneous Systems? A growing number of embedded systems require concurrent execution in segregated environments: ● Real time performances to access certain devices/peripherals ● Power consumption (MCU + MPU systems were used in the past) ○ Data aggregation from sensors ● System integrity: segregation (Rich OS + critical subsystem) ○ Multi-chip approach ○ Virtualization ○ HMP (Heterogeneous multiprocessing) ←
  • 8. ● Cortex-A7 core + Cortex-M4 core ● Master - Slave architecture ○ A7 is the master ○ M4 is the slave ● Inter processor communication ○ MU - Messaging Unit ○ RPMsg component (OpenAMP framework) ● Safe sharing of I/O resources ○ RDC - Resource Domain Controller NXP i.MX7 overview i.MX7 Reference Manual: https://www.nxp.com/docs/en/reference-manual/IMX7DRM.pdf
  • 9. Why Embedded Android ● Very application oriented: abstraction between low level hardware and application layers ● Rich UI SDK ○ Native (NDK) ○ Java (SDK) ● Great debugging tools ● Productive development environment ○ Android Studio ○ Gradle based build system ● Almost any java developer can be an “embedded application developer”
  • 10. OpenAMP framework: Inter-processor communication RPMsg VirtIO/Virtqueue Shared memory Inter-core interrupts RPMsg Lite, OpenAMP Rpmsg, ... VirtIO, Virtqueue, Vring Shmem, MU, Mailbox Transport Layer MAC Layer Physical Layer
  • 11. OpenAMP framework: MAC (VirtIO) virtqueue struct vring short used_idx short avail_idx Int (*add_buff)(..) void*(*get_buff)(..) void(*kick)(..) vring_desc vring_desc vring_desc vring_desc vring_desc vring_avail vring_used ... VRING Buffer list Buffer Buffer Buffer Shared Memory
  • 12. VirtIO Communication Master (A7) transmit to Remote (M4) ● Master get_buff() from virtqueue1 ○ get idx from USED ring ● Master fills the buffer ● Master add_buff() to the virtqueue1 ○ write buffer idx in AVAIL ring and increment idx ● Remote get_buff() from AVAIL ring ○ Remote add_buff() to USED ring (freed) ● Master writes buffer idx to USED ring and increment idx Master (A7) receives from Remote (M4) ● Master get_buff() from virtqueue2 ○ get idx from USED ring tail ● Master add_buff() to the virtqueue2 ○ write buffer idx AVAIL in ring and increment ● Remote get_buff() from AVAIL ring and fills the buffer ○ Remote add_ buff() to USED ring and increment ● Master get_buff() from USED ring
  • 13. OpenAMP framework - RPMsg channels and endpoints
  • 14. RPMsg character driver The Linux RPMsg char driver exposes RPMsg endpoints to user-space processes. ● Supports the creation of multiple endpoints for each RPMsg device ● Each created endpoint device shows up as a single character device in /dev ● Provides multiple interfaces: ○ Control interface: allows creation/destruction of endpoint interfaces ○ Endpoint interface (one for each exposed endpoint): allows creation, destruction and interaction with endpoints The driver was first introduced in the Linux 4.11 version (sources can be found in the drivers folder of mainline kernel). More info are available in our technical note.
  • 16. Cohesys BSP Board Support Package for Toradex Colibri-iMX7 SoM: ● Android 7.1.2 ● U-Boot 2017.03 (from NXP) + support for .ELF files ● Linux Kernel 4.9 + RPMsg character driver backported from Kernel 4.11 This build is compatible with: ● Colibri i.MX7 eMMC SOM 1GB RAM ● Toradex Iris carrier board ● 7” capacitive parallel display from Toradex
  • 17. Hybrid Android/FreeRTOS Demo - Goal ● FreeRTOS binary running on Cortex-M4 ○ Sample IMU sensor ○ Send data upon configuration: ➢ VECTOR mode - raw acc, mag, gyro data ➢ NORM mode - norm of acc, mag, gyro vectors ● Android executable running on Cortex-A7 [i.e. “headless” mode] ○ Check inter-core communication and log received data on a text file ● Android app running on Cortex-A7 [i.e. “headful” mode] ○ Sensor data plotting
  • 18. Hybrid Android/FreeRTOS Demo - HW Setup ● Toradex Iris Carrier Board w/ Colibri i.MX7 SOM ● Adafruit Precision NXP 9-DOF Breakout Board (via I2C) ○ FXOS8700 3-Axis accelerometer and magnetometer ○ FXAS21002 3-axis gyroscope
  • 20. IMU data sampling (FreeRTOS app) TXT
  • 21. IMU data sampling (FreeRTOS app) TXT
  • 22. Android native IPC client TXT
  • 25. JNI - native to Java code Java: impossibility of interacting directly with the hardware JNI: Glue layer between Java and the lower layers of the OS ● Provides support for interacting with native code like C/C++ ● Map native methods which interact directly with the hardware ● Java code declares static native methods in whatever class in the code ● Main Activity loads the native libraries (.so or .dll) where native methods are implemented (in C) and bind them to the class where they have been declared (native).
  • 26. Android OS and JNI Picture by Karim Yaghmour
  • 27. Native IPC library (JNI) Motivation: The Android app needs to interact with the control interface exposed by the RPMsg char driver: ● Endpoint creation requires ioctl operation on the control interface ● Ioctl operations cannot be done from Java code Activity JNI wrapper Native library Android kernel Rpmsg char driver UI app Linux process ● Low level operation on RPMsg devices (e.g. creating/destroying endpoints) are handled by native C methods.
  • 28. JNI endpoint creation #define RPMSG_CREATE_EPT_IOCTL _IOW(0xb5, 0x1, struct rpmsg_endpoint_info) /* Open controller device */ fd_ctrldev = open(/dev/rpmsg_ctrl0, O_RDONLY); /* Create endpoint device */ ret = ioctl(fd_ctrldev, RPMSG_CREATE_EPT_IOCTL, &ep); if (ret < 0) { __android_log_print(ANDROID_LOG_INFO, "openDeviceNative", "Error creating endpoint device: %s n",strerror(errno)); close(fd_ctrldev); return NULL; }
  • 29. GUI Plotting libraries used: https://github.com/PhilJay/MPAndroidChart ● VECTOR mode: plots raw values of the three components (i.e. x, y, z) of respectively the acc, mag and gyro vectors. ● NORM mode : plots the norm values of the acc, mag and gyro vectors. There is one plot for each sensor. ● NORM mode is selected by default during application startup.
  • 30. I/O Data Rate Remote core: ● Sample IMUs every 10ms - 100 Hz ● Buffer of 300 elements = 3Kb (TCM Memory is only 32 Kb - bigger buffer is possible if application is moved to DDR) ○ In NORM mode each element is 12 byte (3 float * 4 bytes each float) ○ In VECTOR mode each element is 36 byte ● Items are dequeued and sent to master 10 at a time every 100 ms ○ In NORM mode sending speed is 1.32KB/s (with RPMSG header) ○ In VECTOR mode sending speed is 3.67KB/s (with RPMSG header) Master core: ● At the driver layer ○ In NORM mode receiving speed is ~0.93KB/s (without RPMSG header) ○ In VECTOR mode receiving speed is ~3.51KB/s (without RPMSG header)
  • 33. References ● Kynetics Technical Notes: http://kynetics.com/docs ○ Android Asymmetric Multiprocessing on Toradex Colibri i.MX7D ○ RPMsg device and driver on Linux and Android ○ Android Asymmetric Multiprocessing on i.MX7: Remote Core Sensors Data Streaming in Java ● Kynetics GitHub: https://github.com/kynetics ● OpenAMP project page ● An Introduction to Asymmetric Multiprocessing: When this Architecture can be a Game Changer (ELC 2018)
  • 34. Q&A