How add additional FreeRTOS task (to control hardware) to TouchGFX project?
I am trying to add an additional task to my TouchGFX project. The purpose of the additional task is to control stepper motors. I am following the procedure given in the c_task_conderser_example from the TouchGFX website.
My problem is that whenever I add a task my display freezes. This occurs even if the task is a simple task that does nothing.
Here is my code:
void stepperTask(void const * argument). <---- most simple task I could create
{
for(;;)
{
// vTaskDelay(500);
osDelay(500);
}
}
int main(void)
{
HAL_Init();
[BUNCH OF INITIALIZATION CODE REMOVED FROM HERE TO IMPROVE CLARITY]
/* Initialise the graphical hardware */
GRAPHICS_HW_Init();
/* Initialise the graphical stack engine */
GRAPHICS_Init();
/* Create the thread(s) */
/* definition and creation of defaultTask */
osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 4096);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
osThreadDef(stepperTask1, stepperTask, osPriorityNormal, 0, 4096);
osThreadCreate(osThread(stepperTask1), NULL); <----- the display works if I comment this out. If not commented out, the display freezes.
osKernelStart();Also, when I add the 2nd task, I get the following warnings but I'm not sure what they mean:
Building file: /Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Src/main.cpp
Invoking: MCU G++ Compiler
/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/SW4STM32/StepperController/Debug
arm-none-eabi-g++ -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 '-D__weak=__attribute__((weak))' '-D__packed="__attribute__((__packed__))"' -DUSE_HAL_DRIVER -DSTM32F746xx -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/FATFS/Target" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/FATFS/App" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Inc" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/TouchGFX/target" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/USB_HOST/App" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/USB_HOST/Target" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/TouchGFX/generated/fonts/include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/TouchGFX/generated/texts/include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/TouchGFX/generated/images/include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/TouchGFX/generated/gui_generated/include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/TouchGFX/gui/include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/ST/TouchGFX/touchgfx/framework/include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Drivers/STM32F7xx_HAL_Driver/Inc" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Drivers/STM32F7xx_HAL_Driver/Inc/Legacy" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/Third_Party/FatFs/src" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/Third_Party/FreeRTOS/Source/include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/ST/STM32_USB_Host_Library/Core/Inc" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/ST/STM32_USB_Host_Library/Class/CDC/Inc" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Drivers/CMSIS/Device/ST/STM32F7xx/Include" -I"/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Drivers/CMSIS/Include" -Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fno-exceptions -fno-rtti -MMD -MP -MF"Application/User/Core/main.d" -MT"Application/User/Core/main.o" -o "Application/User/Core/main.o" "/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Src/main.cpp"
In file included from /Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Src/main.cpp:53:0:
/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Src/main.cpp: In function 'int main()':
/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:470:54: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
{ #name, (thread), (priority), (instances), (stacksz)}
^
/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Src/main.cpp:262:3: note: in expansion of macro 'osThreadDef'
osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 4096);
^~~~~~~~~~~
/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:470:54: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
{ #name, (thread), (priority), (instances), (stacksz)}
^
/Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Src/main.cpp:267:3: note: in expansion of macro 'osThreadDef'
osThreadDef(stepperTask1, stepperTask, osPriorityNormal, 0, 4096);
^~~~~~~~~~~
Finished building: /Users/clark/Documents/EclipseWorkspaces/STM32_Workspace/StepperController/Core/Src/main.cpp
