using qt asymmetric systems solutions on developing embedded · 2019-12-24 · linux and freertos...
TRANSCRIPT
![Page 3: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/3.jpg)
Understand AMP and SMP architecture1
Applications and solution where AMP is a good fit2
Overview I.MX7 Processor3
RPMSG and Inter Processor Communication4
Agenda / Objectives
Bottom-up example application with Qt / Linux / FreeRTOS
5
![Page 4: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/4.jpg)
Introduction AMP vs SMP
![Page 5: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/5.jpg)
Symmetric Multi-Processing
Kernel SMP
Cor
e 1
Cor
e 2
OS
APP APP APP◆ Single OS controlling two or more cores
of the same architecture
◆ CPU shares memory space
◆ Dynamic Scheduling e load balancing
Chip
![Page 6: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/6.jpg)
Asymmetric Multi-Processing
Multi Core API
Cor
e 1
Cor
e 2
OS
APP
Chip
APP
OS / RTOS / Other
Task Task
◆ Different OS on each core
◆ Different core architectures
◆ Each core may run full-feature OS, Real-time OS or baremetal code
◆ Inter process communication protocol
◆ Efficient when the application can be statically partitioned across cores
![Page 7: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/7.jpg)
Example
Multi-Chip System
CPU
1
MPU
Linux
Non Critical Task Critical Task
Same SoC AMP
FreeRTOS
CPU
MPU
Linux
Non Critical Task Critical Task
FreeRTOS
Chip 1 Chip 2
Dedicated Channel Internal Communication
External Communication
UART / I2C
![Page 8: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/8.jpg)
Applications Examples
Robotics / Real-Time
![Page 9: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/9.jpg)
Applications Examples
Mobile / Sensor Acquisition
![Page 10: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/10.jpg)
Applications Examples
Wearable / Low-Power
![Page 11: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/11.jpg)
Overview I.MX7 Architecture
![Page 12: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/12.jpg)
NXP I.MX7 Overview
◆ Dual Cortex A7 core + Cortex M4 core
◆ Master/Slave architecture◆ A7 is the master◆ M4 is the Slave
◆ Inter processor communication
◆ MU – Message Unit◆ RDC – Resource Domain Controller
![Page 13: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/13.jpg)
NXP I.MX7 Overview
RDC – Resource Domain Controller
![Page 14: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/14.jpg)
NXP I.MX7 Overview
◆ Enables two processors within the SoC to communicate and coordinate by passing messages( ex: data, status and control)
◆ Signal the other processor using interrupts
MU – Message Unit
![Page 15: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/15.jpg)
Inter Processor Communication
Transport Layer
MAC Layer
OpenAMP RPMSG
VirtIO, Virtqueue, Vring
MU, Mailbox, shared memory Shared Memory Inter-Core Interrupts
Physical Layer
VirtIO / Virtqueu
RPMSG
![Page 16: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/16.jpg)
RPMSG on LinuxUser space Kernel space
M4
/dev/ttyRPMSG
endpoint
Platform driverdrivers/rpmsg/imx_rpmsg.c
VirtIO RPMsg driverdrivers/rpmsg/virtio_rpmsg_bus.c
RPMsg char driverdrivers/rpmsg/rpmsg_char.c
Platform bus
VirtIO bus
RPMsg bus
1 – Register Platform Driver
2 – Register VirtIO Device
3 – Register VirtIO Driver
4 – Register RPMsg device
5 – Register RPMsg driver
Remote Core
![Page 17: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/17.jpg)
Linux and FreeRTOS talking
Linux - Master Domain FreeRTOS – Remote Domain
U-boot load and starts M4 Core and Linux Kernel
RPMSG driver creates virtqueues and endpoints
Notifies remote processor
RPMSG driver waits for name service announcement
Send/Receive messages
RPMSG app creates virtqueues
Waits for link being up
App creates endpoints and sends name service announcement
Send/Receive messages
![Page 18: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/18.jpg)
Application Development with Qt
![Page 19: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/19.jpg)
Hybrid Linux Qt / FreeRTOS Demo
● IMU sensor (I2C) read by MCU
● Qt App read data from MCU using RPMSG
● Plot data on Linux using QtCharts
![Page 20: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/20.jpg)
Hardware Setup
● Colibri iMX7D 512MB
● Iris Carrier Board
● 7” display
● MPU6050
![Page 21: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/21.jpg)
Hardware Setup
Master / Linux(A7)
Remote / FreeRTOS(M4)
MU SharedMemory
RPMSG
Iris Board + I.MX7
MPU6050
Host PC
Uart 1
Uart 2
I2C
![Page 22: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/22.jpg)
Qt Development
● Toolchain(cross-compile, rootfs, libraries) generated by Yocto-Project
● Configure Qt Kit for I.MX7 using toolchain generated by Yocto
● QtQuick and QML on i.MX7(no-GPU) Qt 2D Software Rendering
● qputenv("QMLSCENE_DEVICE", QbyteArray("softwarecontext"));
● Chart Visualization via QtCharts
− Add to your .pro: QT += charts
● QtCharts is GPLv3!
![Page 23: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/23.jpg)
Architecture Overview
Kernel space
User space
/dev/RPMSG
rpmsg_char
readI2CData
Read Data Task
Qt AppIMU Sensor
Rpmsgchannel
Rpmsgchannel
Linux FreeRTOS
![Page 24: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/24.jpg)
Realtime Class
Realtime { id: realtime }
class Realtime : public QObject{ Q_OBJECT Q_PROPERTY(int accX READ XAcc NOTIFY accChanged) Q_PROPERTY(int accY READ YAcc NOTIFY accChanged) Q_PROPERTY(int accZ READ ZAcc NOTIFY accChanged))
public: Realtime(QObject *parent = nullptr); virtual ~Realtime();private: QFile rpmsgDevice;signals: void accChanged();public slots: void update();};
Realtime.h
Main.qml
![Page 25: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/25.jpg)
Realtime ClassrpmsDevice.setFileName(“/dev/ttyRPMSG”);rpmsgDevice.open(QIODevice::ReadWrite);
qDebug() << "Get Sensor Realtime Data"; if(!rpmsgDevice.isOpen()){ qDebug() << "RPMSG Device not open"; } else { int accx, accy, accz; QByteArray query("acc"); rpmsgDevice.write(query); rpmsgDevice.flush(); QbyteArray response = rpmsgDevice.readLine(64); sscanf(response.constData(), "x:%d,y:%d,z:%d", &accx, &accy, &accz);}
Realtime.cpp
![Page 26: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/26.jpg)
QMLTimer { id: timer property int index: 0 running: true repeat: true interval: 1000 onTriggered: {
realtime.update(); accx.append(index,realtime.accX); accy.append(index,realtime.accY); accz.append(index,realtime.accZ);
index++; axisX.min++; axisX.max++; } }
Main.qml
![Page 27: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/27.jpg)
QML
Main.qml
ChartView { id: chartview animationOptions: ChartView.NoAnimation theme: ChartView.ChartThemeDark antialiasing: true anchors.fill: parent
ValueAxis { id: axisX min: -5 max: 5 }
ValueAxis { id: axisY min: -10 max: 10 } }
LineSeries { id: accx name: "accx" axisY: axisY axisX: axisX }
LineSeries { id: accy name: "accy" axisY: axisY axisX: axisX }
LineSeries { id: accz name: "accz" axisY: axisY axisX: axisX }
![Page 28: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/28.jpg)
Demo Communication between coreshttps://www.youtube.com/watch?v=SnLAySJPCBU
![Page 29: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/29.jpg)
Demo QT charts
![Page 30: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/30.jpg)
References
● M4 Firmware - https://github.com/ferlzc/Asymmetric_QT_demo_firmware
● QT Application - https://github.com/ferlzc/Asymmetric_QT_demo
![Page 31: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/31.jpg)
References● Linux and Zephry “talking” to each other in the same SoC
● https://events.linuxfoundation.org/wp-content/uploads/2017/12/Linux-and-Zephyr-%E2%80%9CTalking%E2%80%9D-to-Each-Other-in-the-Same-SoC-Diego-Sueiro-Sepura-Embarcados.pdf
● OpenAMP Project Page - https://github.com/OpenAMP/
● An Introduction to Asymmetric Multiprocessing: When this Architecture can be a Game Changer and How to Survive It (ELC 2018) https://elinux.org/images/6/6e/AMP_-_Kynetics_ELC_2018_Portland.pdf
● Asymetric Multiprocessing and Embedded Linux (ELC 2017) https://elinux.org/images/3/3b/NOVAK_CERVENKA.pdf
● Toradex FreeRTOS on Cortex-M4 of Colibri IMX7 https://developer.toradex.com/knowledge-base/freertos-on-the-cortex-m4-of-a-colibri-imx7
![Page 32: using QT Asymmetric Systems Solutions on Developing Embedded · 2019-12-24 · Linux and FreeRTOS talking Linux - Master Domain FreeRTOS – Remote Domain U-boot load and starts M4](https://reader033.vdocument.in/reader033/viewer/2022053004/5f08abac7e708231d423279c/html5/thumbnails/32.jpg)
Fernando Luiz [email protected]
Obrigado!
https://www.linkedin.com/in/ferlzc/
https://www.emc-logic.com/