.. toctree:: :glob: Introduction =============== ******************** Scope ******************** This application manual is dedicated to explaining how to set up applications on A4MCAR. For more detailed documentation towards the research goals and tool support, it is advised to check our research documentation. .. note:: If you are looking to **download the project** or **see the comprehensive information** please jump to :ref:`AccessingTheProject`. ********************* What is A4MCAR? ********************* A4MCAR is a distributed and multi-core demonstrator RC-Car that is used in the demonstration of parallel applications on real embedded systems. It is originally developed to test and evaluate APP4MC tool. A4MCAR is a project that is developed in FH Dortmund IDiAL and is supported under Project AMALTHEA4public. The project is also granted by The Eclipse Foundation and Google Inc. during the participation to Google Summer of Code 2017 event. During the event, the developed applications have been distributed in open-source manner under Eclipse Public License (EPL). Thus, we hope to help those in the open-source community who are willing to address concurrency in their multi-core embedded applications with the help of the GSoC event. .. figure:: ../a4mcarstatic/img/a4mcar.png :width: 80% :alt: A4MCAR :figclass: align-center :align: center A4MCAR The demonstrator system features not only low level functionalities such as sensor and motor driving but also high level features such as image processing, camera streaming, server-based wireless driving via Web, bluetooth connectivity via Android application, system core monitoring and analysis features and touchscreen UI. Our experiments along the multi-task heterogeneous demonstrator A4MCAR show that using APP4MC results instead of OS-based or sequential implementations on a distributed heterogeneous system significantly improves its responsiveness in order to potentially reduce energy consumption and replaces error prone manual constraint considerations for mixed-critical applications. ********************* What is APP4MC? ********************* While there exist some commercial tools that provide easement in the parallel software development, recent study done in Germany, namely `AMALTHEA4public `_, aims to provide planning and tracing tools especially for multi-core developments in automotive domain with several open source development tools. `The APP4MC project `_ provides an Eclipse-based tool chain environment and a de-facto model standard to integrate tools for all major design steps in the multi- and many-core development phase. A basic set of tools are available to demonstrate all the steps needed in the development process. The APP4MC project aims at providing according to [App4mcProposalEclipse]_: * A basis for the integration of various tools into a consistent and comprehensive tool chain. * Extensive models for timing behaviour, software, hardware, and constraints descriptions (used for simulation / analysis and for data exchange). * Editors and domain specific languages for the models. * Tools for scheduling, partitioning, and optimizing of multi- and many-core architectures. APP4MC targets multi-core and many-core platforms, while the main focus is the optimization of embedded multi-core systems . Due to its focus, APP4MC is partnered with many automotive OEMs and part suppliers that deal with embedded software engineering. Furthermore, it supports interoperability and extensibility and unifies data exchange in cross-organizational projects. Additionaly, since APP4MC uses Eclipse platform to its purposes, the development environment has a complete open-source nature under `Eclipse Public License (EPL) `_. Eclipse APP4MC platform editor window can be seen in the following figure: .. figure:: ../a4mcarstatic/img/app4mcenv.png :width: 80% :alt: Eclipse APP4MC platform Editor Window :figclass: align-center :align: center Eclipse APP4MC platform Editor Window In the figure, Explorer window is used for finding models, performing operations such as partitioning, task generation, mapping, and model migration. The tree editor shows the hierarchical structure of the selected AMALTHEA model, whereas the Element Properties window is used for editing the properties of AMALTHEA model elements selected in the Tree Editor. APP4MC is a project that has a lot of synergies with its predecessor AMALTHEA4public project. APP4MC uses AMALTHEA models, which are XML models that describe software components and hardware platforms. Main operation of APP4MC involves modeling the system by creating AMALTHEA models and performing partitioning, mapping, optimization on parallel programs. APP4MC also has the ability to trace simulate parallel programs. Basic ingredients for an AMALTHEA model is illustrated in the following figure: .. figure:: ../a4mcarstatic/img/app4mcmodel.png :width: 80% :alt: AMALTHEA Model for APP4MC :figclass: align-center :align: center AMALTHEA Model for APP4MC It is seen that AMALTHEA model can contain software decisions, costs, constraints, as well it can contain hardware platform information. Constraint models are used to define process groups to make sure some processes belong together. Furthermore, a target platform dependency of a process group is also modeled using constraints model. An illustration of how parallel software can be designed for embedded multi-core platforms are given in the :ref:`app4mcdesign`. The following remarks can be made regarding the design procedure with APP4MC platform: * **Modeling**: Design of a parallel software starts with modeling in APP4MC. An AMALTHEA model is constructed that involves three seperate models: (1)- hardware model, (2)-software model, (3)-constraints model. In the hardware model, each distributed ECU is modeled in a hierarchical manner. Hardware model involves information such as number of processor cores, system clock frequency for processors, and memory details. In the software model, runnables are modeled. Runnables are found with the help of binary analysis tools and by using the decomposition technique mentioned in the Section \ref{designtech}. Each runnable are modeled by making use of information such as granularity (number of instructions) and label accesses (memory read-write). In the early development stages, model contains a rough model of the software, but the model is constantly improved by using the Tracing functionality of the APP4MC as well it can be improved by using several other tracing software. * **Partitioning**: Partitioning stage in APP4MC-aided parallel design corresponds to identification of initial tasks. After an initial AMALTHEA model is constructed, the one can perform partitioning in APP4MC by simply selecting the model and pressing the "Perform Partitioning" button. At this stage, APP4MC will analyze the runnables and runnable label accesses in order to suggest how tasks should look like for a balanced parallel distribution. APP4MC uses two partitioning algorithms that are ESSP (Earliest Start Schedule Partitioning) (performed by default) and CPP (Critical Path Partitioning) in order to find the partitions of the system. ESSP and CPP algorithms are based on the Graph Theory which is commonly used in hardware and software co-design. Partitioning algorithms are used for analysis of the granularity and communication costs of individual runnables and create best possible parallelized partitions. * **Task Generation**: Initial tasks (partitions) are finalized by pressing "Generate Tasks" button. By making use of the dependencies between partitions and by grouping them, APP4MC generates a model that contains the desired amount of tasks with the help of "Task Generation" phase. * **Mapping (with Simulation and Optimization)**: As known, mapping is the stage of placing the software distributions (tasks, processes, threads) into the processors. By making use of the hardware capabilities and using optimization strategies (such as Integer Linear Programming), APP4MC is able to find a mapping model of the system. The utilization details of the simulations will be seen at the end of the mapping stage. * **Code Generation**: Since APP4MC provides model-based development, code generation features for C language are available. If desired, APP4MC generates tasks that are written in C language by using the AMALTHEA system model. * **Tracing**: By making use of binary tracing, AMALTHEA trace model can be observed and can be re-used to update the system model. .. _app4mcdesign: .. figure:: ../a4mcarstatic/img/app4mcdesign.png :width: 80% :alt: Illustration of how parallel software are designed using APP4MC platform :figclass: align-center :align: center Illustration of how parallel software are designed using APP4MC platform APP4MC promises beneficial set of tools for embedded parallel software development. However, the demonstration of its features is needed for further improvement. Therefore, in this work APP4MC is used for system parallelization for A4MCAR, a demonstrator RC-Car. **************************** Objectives of A4MCAR Project **************************** With A4MCAR project, we aim to investigate and evaluate APP4MC's performance with a real-world distributed multi-core system in several aspects. The objectives of this project are as follows: * Development of a distributed multi-core demonstrator for the APP4MC platform that involves typical automotive application features. * Investigation of new trends in parallel software development (such as Real-time Linux parallel programming, POSIX threads, RTOS, evaluation methods etc.) * Researching techniques to retrieve information (number of instructions, communication costs) and system trace from platforms such as xCORE and Linux to achieve precise modelling with APP4MC. * In order to achieve optimization goals such as reduced energy consumption and reduced resource usage, different affinity constrained software distributions will be evaluated and energy features will be invoked to see if the goals can be achieved. * Developing a basic online parallelization evaluation software that will retrieve scheduling properties such as slack times, execution times, and deadlines from all the processes and that will tell which deadlines were met and which not. Also, the software distribution assessment is in focus as well as investigating methods to develop schedulable and traceable threads and processes. * Recording detailed system traces in order to provide offline software evaluation and consequently figuring out means to balance the load on cores. * Comparing the conventional schedulers of non-constrained affinity distribution (such as a Linux OS scheduler) to the affinity constrained distribution from APP4MC to see if performance can be improved. With the help of the A4MCAR project, it is intended that the Real-time Linux community will benefit from the published libraries and documentation that involve code snippets and information instructions on how to develop more optimized distributed and parallel software. Furthermore, the Eclipse APP4MC community will benefit from the A4MCAR via advanced tool support for RPI developments, open source example applications, and validations of APP4MC parallelization results in order to create a better tooling available to the public. Those results can be used to assess and compare different parallelization scenarios and consequently identify optimal solutions regarding timing efficiency for the A4MCAR. Thereby, a point of reference can be given as well as an easy starting point for developers approaching parallelism with their developments. ******************************* A4MCAR Methodology and Features ******************************* As A4MCAR targets automotive industry and parallelization studies done by APP4MC, it features not only sensing and actuation related features but also applications that would help with task to core distributions and parallelization performance evaluation. One could see the featured applications for the A4MCAR in :ref:`tasksoverall`. .. _tasksoverall: .. figure:: ../a4mcarstatic/img/tasksoverall.png :width: 100% :alt: Applications developed and/or maintained for A4MCAR :figclass: align-center :align: center Applications developed and/or maintained for A4MCAR In the figure, it is seen that the low level module of A4MCAR, built using xCore-200 eXplorerKIT targets mostly actuation and sensing related applications. The full list of tasks developed for the low-level module includes: * Core monitoring applications for each tile (two exist) that calculates the average core usages. * Bluetooth task to configure bluetooth module in slave mode and receive data over UART interface. * Proximity measurement task that obtaines the distance sensor information from four SR-04 sensors over an I2C sensor network. * Speed control task in order to use PWM to drive speed controlling motor. * Steering task that controls a servo motor using PWM signaling in order to steer the A4MCAR using external inputs. * Light system task in order to control a light module for certain conditions. * Ethernet server task to maintain a TCP server for data reception and transmission from high level module. * TCP task and several other ethernet configuration related tasks to configure ethernet module (PHY) drivers and establish proper TCP connection. In order to investigate parallelization outcomes on Real-time Linux and make use of high level features such as web server, image processing and touchscreen interface high-level module is introduced to the system. High-level module is designed so that it can communicate with low-level module over TCP in order to send driving information and retrieve core information from low-level module. It is important to mention that high-level module uses Raspberry Pi 3 in order to achieve high level tasks using a robust Debian-based OS, namely Raspbian. Although the features of the high-level module is illustrated in the following figure, full feature list can be given as follows: * Core monitoring application that calculates the average core usages on each core. * Image processing application that helps to find a traffic cone. * Apache Web Server that is used to host a web page which shows average core usage, show Raspberry Pi 3 camera (Raspicam) stream and helps to drive the A4MCAR via web page controls. * Ethernet client application that writes handles data transmission and reception to and from server using file operations and data parsing. * Camera and streaming application that starts the Raspicam and maintains the stream using configuration parameters such as resolution, quality, frame rate, port and etc. * A webpage which is used for driving the A4MCAR as well as display core usages on each core and Raspicam stream. * A touchscreen display application which is used for displaying all cores and their utilization, starting and killing all applications on high-level module, allocation of processes on high-level module to cores dynamically, visualization of timing related performance indicators such as average slack time and deadline misses percentage, selecting different distributions, and configuration of the IP addresses on high-level module. * Dummy load processes that perform random matrix multiplication in order to find performance indicators in full utilization. * Several Linux processes that run Linux OS kernel and VNC server process that provides PC connection via SSH connection. ******************************* Future Developments ******************************* Future developments involve: * AGL (Automotive Grade Linux) or Apertis Linux distro integration of the applications. * Developing more applications in the direction of IoT. * Developing Eclipse Hono interaction library and involving Cloud interactions in parallel with APPSTACLE project. .. [App4mcProposalEclipse] https://projects.eclipse.org/proposals/app4mc