cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575ZIT6 and xcube-Freertos

IN short, it's not working.

I normally use the standard (not x-cube) and L5 processors.  I'm going to the U5 processors for a larger project.  I've gone to Cube MX 6.17.0 and CubeMXIDE 2.1.1.

Starting with a blank project, I configure the pins as usual and enable xcube-FreeRTOS.  Go to CubeIDE, and without FreeRTOS, everything compiles properly.  With FreeRTOS, I get 237 errors, some understandable, and some of the following:

./Middlewares/Third_Party/FreeRTOS/Source/include/task.h:34:6: error: #error "include FreeRTOS.h must appear in source files before include task.h"
   34 |     #error "include FreeRTOS.h must appear in source files before include task.h"
      |      ^~~~~
In file included from ../Middlewares/Third_Party/FreeRTOS/Source/include/task.h:37:
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h:62:6: error: #error "FreeRTOS.h must be included before list.h"
   62 |     #error "FreeRTOS.h must be included before list.h"
      |      ^~~~~
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h:147:25: error: unknown type name 'TickType_t'; did you mean 'osTimerType_t'?
  147 |     configLIST_VOLATILE TickType_t xItemValue;          /**< The value being listed.  In most cases this is used to sort the list in ascending order. */
      |                         ^~~~~~~~~~
      |                         osTimerType_t
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h:175:25: error: unknown type name 'UBaseType_t'
  175 |     configLIST_VOLATILE UBaseType_t uxNumberOfItems;
 

Which indicates to me that something fundamental is wrong somewhere.

Any ideas?

Harvey

 

1 REPLY 1

Well, I have A solution.

To reproduce the error:  generate code under cubemx, go to cubeIDE and build.  Get 237 errors most of which are the result of FreeRTOS not finding stuff.  For example, task.h fails because FreeRTOS.h is not defined yet.

rebuilding and cleaning the project does not help.

 

The first error is the clue.  Going through IDE 1.19 and comparing to 2.1.1 I get the following.

Both projects use CMSIS-V2, so I'd expect a somewhat similar structure.  Obviously, someone has been improving a few things.  (hence the problem).  

under middlewares/third party there's only a  single directory /freertos/source/CMSIS_RTOS_V2 under 

1.19.

under 2.1.1, under third party, there are two directories one is CMSIS, the other is FreeRTOS.

the main program includes cmsis_os2.h.  cmsis_os2.c includes FreeRTOS.h and task.h in the proper order.  Apparently, though, this is not good enough.

 

To fix the problem, add a line of code to #include "FreeRTOS.h" in cmsis_os.h.  It can be either before or after the include for cmsis_os2.h.

For some reason, I get

* Definitions for defaultTask */
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
  .name = "defaultTask",
  .priority = (osPriority_t) osPriorityNormal,
  .stack_size = 128 * 4
};
  defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
void StartDefaultTask(void *argument)
{
  /* USER CODE BEGIN defaultTask */
  /* Infinite loop */
  for(;;)
  {
    osDelay(1);
  }
  /* USER CODE END defaultTask */
}

duplicated in app_freertos.c.

 

Still puzzled.  

but it compiles properly