cancel
Showing results for 
Search instead for 
Did you mean: 

Bug report Cube+FreeRTOS

Osto
Senior
Posted on September 07, 2014 at 15:43

There is a bug in STM32Cube (newest version). When I use FreeRTOS then the eTaskGetState() is not available. In FreeRTOS.h which is generated by Cube, the variable INCLUDE_eTaskGetState is set to 0 which means dont include it,

There is no value I can enable in Cube which results in setting INCLUDE_eTaskGetState to 1.

In addition to that when I set this variable to 1 by myself then the value is overwritten next time I generate the project.

4 REPLIES 4
FCR
Associate III
Posted on September 08, 2014 at 18:38

Hi,

Thank you for the feedback.

The FreeRTOS.h file is not generated by CubeMx but is the original one from Real Time Engineers Ltd (and available in the firmware package for your favorite STM32).

The FreeRTOSConfig.h is generated by CubeMx from the parameters selected in the GUI, and the generated define values may override the ones in FreeRTOS.h.

You're right, that parameter is not there (== cannot be selected) and therefore not generated. But, we have a mechanism called ''user code sections'' allowing to add some user code in files generated by CubeMx afterwards.

Looking at yourFreeRTOSConfig.h file,the user section probably looks like:

/* USER CODE BEGIN 1 */  

#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}

/* USER CODE END 1 */

Adding inside the definition for that parameter should solve your problem:

/* USER CODE BEGIN 1 */  

#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}

#define INCLUDE_eTaskGetState 1

/* USER CODE END 1 */

Code added like that in such ''user code sections'' is not lost when re-generating the project.

I agree that the solution may not be easy to find (even if described in the user manual).

Just hope that it will help you.

Regards,

Fred

Osto
Senior
Posted on September 09, 2014 at 20:50

Dear Fred,

I found the place to change. I dont knew that this will overwrite the freertos.h values.

The next question which I have is why ST dont add all values in the STMCube to be able to manage them without problems? For me it makes no sense to adjust some values and not adjust others through the same tool. Specially if the tool is so powerfull like STMCube.

I found also the template file of STMCube and tried to modify the value there but STMCube ignore values which I add to the template.
FCR
Associate III
Posted on September 10, 2014 at 14:22

Hi,

Not sure that, for the moment, you can find another ''backdoor'' than the ''user sections'' to solve your problem .

Few words to explain the current situation:

1) The parameters you can select right now are the mandatory ones: if they are not generated in the FreeRTOSConfig.h file (the file you can use to configure your system), as they are not in the FREERTOS.h one (original one, should not be changed), the compiler will complain, due to the ''#error ...'' lines you may find in it.

For instance:

#ifndef configMINIMAL_STACK_SIZE

#error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value.

#endif

2) Others are optional, taking a compilation point of view: no definition in FREERTOS.h will not lead to an error when compiling. They have to be added ''manually'' in FreeRTOSConfig.h.

And then, we are back to your original issue.

A more elegant solution would be to do as in LWIP: play with different tabs to show ''main'' parameters and ''optional'' ones.

''Just'' one hundred parameters to define and add to our XML files 😉

Such a feedback shows that a solution ''LWIP-like'' would be helpful for our users.

As the enhancement is already logged in our database, I will check when it could be done, depending on the priorities already put in place.

Fred

Osto
Senior
Posted on September 26, 2014 at 19:54

Dear Fred,

The STMCube is the most powerfull tool which I know for the Embedded develompent (after Compiler) but I hate it sometimes. The Cube has some unneeded limitations ans some funtions are outside of the scope of real ussers (seems to be defined by not programmer). I suggest to open a new Forum speciall for improvements and bug Report of Cube.

For example, I enter in the deffinition of a pin the Name of the pin (my usage of the pin) but nothing is happened in the Software with this pin Name (ist only used in reports). Why you dont use in the generated file my label instead of the the default pin name?

This is only one of my hunderts of suggestions which would help all users to develop faster, easier to read and safer code.

Best regards,

Mehrdad