cancel
Showing results for 
Search instead for 
Did you mean: 

Cube Hal cmsis_os bug, missing #define __CORTEX_M

Posted on November 28, 2015 at 03:42

Using STM32Cube_FW_F4_V1.9.0 and setup a project with CubeMX 4.11 and using Freertos.

I usually build with -Wundef. When compiling cmsis_os.c, I earn a:

core_cmFunc.h:501:12: warning: ''__CORTEX_M'' is not defined

http://www.openstm32.org/-Wundef

This is, because `#include ''core_cmFunc.h''` obvouisly needs a e.g. `#include …` before so that the preprocessor symbol `__CORTEX_M` became defined. This appears for every source which tries to include cmsis_os.h (e.g. the cubemx generated freertos.c).

5 REPLIES 5
stm23
Associate
Posted on January 01, 2016 at 18:40

The Problem still exisits in new Version 1.10.0, please fix it!

Posted on January 02, 2016 at 16:52

I'd checked the suggestion of thomas.004 ''changing the #include order'', but in my project this approach won't fix the warning because my FreeRTOSConfig.h has no `#include ''stm32...h''`.

I further confirm, that this issue still exist in F4 V1.10.0.

Could this please fixed by ST Cube Hal developers in future releases?

thomfischer
Senior
Posted on November 30, 2015 at 10:33

__CORTEX_M

is defined in core_cm4.h

maybe a solution is to swap the following includes in cmsis_os.h

//#include ''core_cmFunc.h''

#include

''FreeRTOS.h''

#include

''core_cmFunc.h''

FreeRTOS.h includes

FreeRTOSConfig.h << stm32f4xx_hal_conf.h << stm32f4xx_hal_XXX.h

<< stm32f4xx_hal_def.h << stm32f4xx.h << stm32f4??xx

<< core_cm4.h

Posted on December 13, 2015 at 19:57

Could this checked / confirmed / fixed by ST please?

caco3
Associate II
Posted on January 18, 2016 at 10:13

For me, I had to add the following include in cmsis_os.h:

#include ''stm32f4xx.h''

before

#include ''core_cmFunc.h''

How ever it gets overwritten on every re-generation from ST32CubeMX. To solve this temporarily, you can edit the template used by STM32CubeMX in cmsis_os.h in <PATH TO YOUR STM32CUBEMX-REPOSITORY>\STM32Cube_FW_F4_V1.0\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\