Graphics Component  Version 6.10.8
MDK Middleware for Graphical User Interfaces
 All Files Pages
Execution Models

The Graphics component supports in principle three execution models (for more information please refer to User and Reference Guide - 15. Execution Model: Single Task/Multitask):

Single Task System (Superloop)

The entire program runs in one superloop. Normally, all software components are periodically called. Interrupts must be used for real time parts of the software since no real time kernel is used.

Multitask system: One Task Calling Graphics Functions

A CMSIS-RTOS is used, but only one task calls Graphics functions. From the Graphics component point of view, it is the same as being used in a single task system.

An user code template is available for this execution model (GUI_SingleThread.c). You can add it to a project by right-clicking on the Source Group and selecting Add New Item to Group. Under the Graphics component, you will find the emWin GUI Thread for Single-Tasking Execution Model.

In this file, a GUIThread is defined with a stack size of 2048 bytes. This value is based on the stack requirements as described in the User and Reference Guide - 35.2.2 Stack Requirements. As stated there, you can reduce this stack size by 200 bytes if no memory devices are used and an additional 600 bytes if the Window Manager is not used.

In case RTX v5 is used no changes to RTX settings are necessary as all resources are allocated statically. In case RTX v4 is used you need to change following settings in file:

  • Increase the Number of concurrent running user threads by 1
  • Increase the Number of threads with user-provided stack size by 1
  • Increase Total stack size [bytes] for threads with user-provided stack size by 2048 (for reduction of this value check explanation above)

Multitask System: Multiple Tasks Calling Graphics Functions

A CMSIS-RTOS is used, and multiple tasks call Graphics functions. This works without a problem as long as the software is made thread-safe, which is done by enabling multitask support in the configuration and adapting the kernel interface routines. An user code template is available for this execution model (GUI_MultiThread.c). You can add it to a project by right-clicking on the Source Group and selecting Add New Item to Group. Under the Graphics component, you will find the emWin GUI Thread for Multi-Tasking Execution Model.

In this file, a GUIThread is defined with a stack size of 2048 bytes. This value is based on the stack requirements as described in the User and Reference Guide - 35.2.2 Stack Requirements. As stated there, you can reduce this stack size by 200 bytes if no memory devices are used and an additional 600 bytes if the Window Manager is not used. Additionally, two threads are defined with a stack size of 600 bytes that will call this GUIThread.

In case RTX v5 is used no changes to RTX settings are necessary as all resources are allocated statically. In case RTX v4 is used you need to change following settings in file:

  • Increase the Number of concurrent running user threads by 3
  • Increase the Number of threads with user-provided stack size by 3
  • Increase Total stack size [bytes] for threads with user-provided stack size by 3248 (for reduction of this value check explanation above)