Difference between revisions of "FreeRTOS"
From uGFX Wiki
(Created page with "The FreeRTOS port works out of the box without any modifications. Simply enable the port by setting <code>GFX_USE_OS_FREERTOS</code> to <code>TRUE</code> in your Configurati...") |
|||
Line 1: | Line 1: | ||
The FreeRTOS port works out of the box without any modifications. Simply enable the port by setting <code>GFX_USE_OS_FREERTOS</code> to <code>TRUE</code> in your [[Configuration|configuration file]]. | The FreeRTOS port works out of the box without any modifications. Simply enable the port by setting <code>GFX_USE_OS_FREERTOS</code> to <code>TRUE</code> in your [[Configuration|configuration file]]. | ||
+ | |||
+ | == Initialization == | ||
+ | As with all ports it's important that the underlying system is initialized prior to calling <code>gfxInit()</code>. In case of FreeRTOS this means that <code>vTaskStartScheduler()</code> needs to be executed prior to <code>gfxInit()</code>. However, due to the fact that <code>vTaskStartScheduler()</code> never returns the µGFX library can't be initialized inside the main thread. To illustrate the problem: | ||
+ | <source lang="c"> | ||
+ | // Initialize uGFX. This requires FreeRTOS to be initialized already. As that's not | ||
+ | // the case this function call will lead to a crash. | ||
+ | gfxInit(); | ||
+ | |||
+ | // Initialize FreeRTOS. This function never returns. | ||
+ | vTaskStartScheduler(); | ||
+ | </source> | ||
+ | |||
+ | The solution to this problem is creating a thread that initializes the entire system. It's a one-time task that doesn't contain a loop: | ||
+ | <source lang="c"> | ||
+ | // ToDo | ||
+ | </source> |
Revision as of 13:56, 22 March 2017
The FreeRTOS port works out of the box without any modifications. Simply enable the port by setting GFX_USE_OS_FREERTOS
to TRUE
in your configuration file.
Initialization
As with all ports it's important that the underlying system is initialized prior to calling gfxInit()
. In case of FreeRTOS this means that vTaskStartScheduler()
needs to be executed prior to gfxInit()
. However, due to the fact that vTaskStartScheduler()
never returns the µGFX library can't be initialized inside the main thread. To illustrate the problem:
// Initialize uGFX. This requires FreeRTOS to be initialized already. As that's not // the case this function call will lead to a crash. gfxInit(); // Initialize FreeRTOS. This function never returns. vTaskStartScheduler();
The solution to this problem is creating a thread that initializes the entire system. It's a one-time task that doesn't contain a loop:
// ToDo