How do I add FreeRTOS threads without CubeMX deleting them?
I created a project for an STM32H753 MCU and have added FreeRTOS via CubeMX called from CubeIDE. CubeMX generates the following code in main.c:
/* Init scheduler */
osKernelInitialize(); /* Call init function for freertos objects (in freertos.c) */
MX_FREERTOS_Init();
/* Start scheduler */
osKernelStart();
Based on some research, I assume that my new thread declarations need to occur between those two sections like this:
/* Init scheduler */
osKernelInitialize(); /* Call init function for freertos objects (in freertos.c) */
MX_FREERTOS_Init();
osThreadNew( &thread_mainLoop, NULL, NULL );
osThreadNew( &thread_debugPort, NULL, &thread1_attr );
/* Start scheduler */
osKernelStart();
Unfortunately, every time I make a change via CubeMX, my declarations are deleted. I've tried wrapping my code with USER CODE BEGIN/END 2.5 and USER CODE BEGIN/END RTOS_THREADS (copied from a project created using TouchGFX Designer) comments, but that doesn't help.
How do I get around this annoyance?
Thanks