 Hi everybody, and welcome to this introduction to TouchFX abstraction layer development. My name is Romain Dielman, I am part of the STM32 graphics team which is responsible for TouchFX, and I will be guiding you today through this presentation. The agenda for this video is a short introduction to the aims of this presentation, to what the TouchFX abstraction layer is, to its architecture, and finally, an introduction to the TouchFX generator. What to expect of this presentation? It is aimed to TouchFX beginners and people interested in developing the abstraction layer for their project. After this presentation, you will have a general overview and basic understanding of the abstraction layer between TouchFX and the hardware it runs on. The abstraction layer may be abbreviated to AL in the slides and documentation. You will be introduced to the TouchFX AL development process, to the key responsibilities of the abstraction layer, and how to work with the TouchFX generator. You will find the slides of this presentation in the TouchFX online documentation. You can go through the other presentations, workshops, and tutorials to understand how TouchFX works and how to get started on your graphical user interface project. In a TouchFX application, the TouchFX abstraction layer is a software component that sits between the board initialization code and the TouchFX engine. The board bring up phase is explained in the corresponding presentation. The TouchFX engine is not an output of any main activity, but is the starting point of your TouchFX project. The main task of the TouchFX abstraction layer is to tie together the engine with the hardware and the operating system. An abstraction layer consists of two different parts, the hardware abstraction layer and the operating system abstraction layer. The TouchFX engine's main responsibility is to update the frame buffer to reflect the current state of the application. It has a main loop that performs three basic steps forever. It first collects the inputs, like the coordinates of a user's Touch, or if a button has been pressed. It then updates the application UI model and then renders the updated model to the frame buffer. The transfer of the frame buffer data to the display and the collection of external input tasks are not directly handled by the engine. They are delegated from the engine to the TouchFX abstraction layer. The main loop of the TouchFX engine will continuously update the frame buffer. This process must be synchronized with the actual update frequency of the display to ensure that all frames will be transferred and displayed correctly. This synchronization is the responsibility of the abstraction layer. If the process is not properly synchronized, the main loop might override the frame buffers before they have been transferred and disturbing glitches will appear on the display. The TouchFX abstraction layer also has the responsibility of controlling the frame buffer memory area and its access, which means that all accesses to the frame buffer will go through the abstraction layer. The responsibilities of the abstraction layer are further detailed in the documentation in the TouchFX abstraction layer development introduction article. The TouchFX abstraction layer is a passive software module. It does not have its own thread, so it must perform its action through certain hooks. Those hooks are called from the TouchFX engine's main loop or through interrupts. It is up to the abstraction layer developer to implement those hooks to ensure that the responsibilities of the abstraction layer are respected. If the abstraction layer developer needs other means to support the responsibilities, the developer can set up interrupts to activate at certain points. The role and timing of the hooks and interrupts can be seen in this example. The L1 display ready interrupt is an example of a vertical synchronization interrupt. This describes the overall design of the abstraction layer for this setup. As described in the previous section, the TouchFX abstraction layer has a particular set of responsibilities. The following table summarizes the responsibilities and in which area they intervene. They are either implemented in the hardware abstraction layer or the operating system abstraction layer, which synchronizes with TouchFX engine through a real-time operating system like Friartos. Note that not all of those steps are required to work with TouchFX like collecting data from physical events or performing additional rendering operations like with the DMA2D. The hardware abstraction layer is accessed by the TouchFX engine through subclasses of the hardware abstraction layer, which are generated by the TouchFX generator. TouchFX generator is the main tool for the creation and development of the abstraction layer. It generates the part of the hardware abstraction layer configured in Cubamex and also generates the operating system abstraction layer. The RTOS available are Friartos, CMC's V1 and V2, but you can also work with other OS. For other RTOS, it is the task of the developers to implement this operating system abstraction layer by themselves. The common architecture of the hardware abstraction layer is shown in this figure. Changes through user code can be made in the file called TouchFXHAL for this example, like the number of frame buffers used and their addresses. The abstraction layer classes are further explained in the related articles in the documentation. As the abstraction layer development and the steps to follow can be quite complicated, we recommend developers to go through the related articles. Their responsibilities are further explained, but also sample code from the generated files. For concrete examples, some specific scenarios are gone through in the documentation, like how to support various display interfaces. Workshops are also available on the official ST YouTube channel and the resources section in the documentation. Most TouchFX development workshops will go through the TouchFX abstraction layer and the TouchFX engine configuration in Cubamex. This section is an introduction to TouchFX Generator. It is not a user guide. TouchFX Generator is an STM32 Cubamex additional software component that helps developers configure TouchFX to run on their hardware platform. Based on the user settings in Cubamex, the TouchFX Generator will generate the files required to configure a working TouchFX project. This includes files for the TouchFX hardware abstraction layer, TouchFX operating system abstraction layer, and TouchFX configuration. Once code is generated through Cubamex, the TouchFX project can be opened with the TouchFX Designer tool, where the UI will be developed. TouchFX Designer automatically adds any additional generated code files to the target IDE project that was configured for the project in Cubamex. The user interface of TouchFX Generator can be seen in this screenshot of Cubamex. It consists of three groups, the dependencies, the display, and the driver groups. The dependencies group contains notifications to the developer about dependencies, warnings, or concrete errors in the configuration. This group is hidden if no errors exist. The display group contains settings related to displays, such as interface, frame buffer bit depth, width, and height. These settings directly impact the size of the canvas of the TouchFX project, as well as the code generated for assets. The driver group allows the users to opt in for a number of ready-made drivers related to the tick source of the application, graphics acceleration, and RTOS. Cubamex will create a TouchFX folder for a project as seen in this screenshot. The folder always contains the same files, regardless of configuration, while the content of those files changes according to Cubamex and user configuration. The listing below shows an overview of the content of a Cubamex project with TouchFX Generator enabled. Thanks to the YAR key of the hardware abstraction layer, the files that are not listed under the generated folder can be modified with user code in the dedicated zones for further configuration. You can, for example, allocate space for a third frame buffer called animation storage to enable complex animations in your project. After successfully setting the TouchFX abstraction layer, the next step is now to start the graphical user interface application with TouchFX Designer. The settings and changes made in the Generator will be shown in Designer, like the size of the display. For custom hardware platforms, the TouchFX Generator can generate most of the abstraction layer. The remaining parts to be developed are pointed out through code comments in the generated files and notifications through the TouchFX Generator. Have a look at the TouchFX abstraction layer workshops and TouchFX Generator documentation to further understand how to work with it. The application templates for specific SD development kits available in TouchFX Designer can be used as source of configuration. This is a reminder that the slides and additional knowledge can be found in the official documentation. The slides have links to the relevant articles, and you can ask any questions on the official SD forum. Thank you for listening to this introduction to the TouchFX abstraction layer and to the TouchFX Generator.