cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a error free code with FreeRTOS for STM32G030 with STM32CubeMX for MDK-ARM

kaushikbm
Associate II

I'm using the latest 6.7.0 version of STM32CubeMX for generating the code. I'm selecting just the serial wire and the a different timer for tick generation and nothing else. The code generation is completed without any errors.

But when I try to compile I get about a zillion errors regarding FreeRTOS. Did a lot of search and tried different solutions provided. Like this one here. But nothing worked so far. :weary_face:

Has anybody tried similar config ?

Thanks in advance for your help :smiling_face_with_smiling_eyes:

Here is the starting and ending lines of the build output. Had to snip off a bit as the post was getting too long. :grinning_face_with_sweat:

Build started: Project: Test
*** Using Compiler 'V6.19', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Test'
compiling stm32g0xx_ll_rcc.c...
compiling stm32g0xx_hal_timebase_tim.c...
compiling app_freertos.c...
compiling main.c...
assembling startup_stm32g030xx.s...
compiling stm32g0xx_it.c...
compiling stm32g0xx_hal_msp.c...
compiling gpio.c...
compiling stm32g0xx_hal_rcc_ex.c...
compiling stm32g0xx_hal_flash.c...
compiling stm32g0xx_hal_rcc.c...
compiling stm32g0xx_ll_dma.c...
compiling stm32g0xx_hal_dma_ex.c...
compiling stm32g0xx_hal_pwr.c...
compiling stm32g0xx_hal_dma.c...
compiling stm32g0xx_hal_gpio.c...
compiling stm32g0xx_hal_flash_ex.c...
compiling stm32g0xx_hal.c...
compiling stm32g0xx_hal_pwr_ex.c...
compiling stm32g0xx_hal_cortex.c...
compiling stm32g0xx_hal_exti.c...
compiling croutine.c...
../Middlewares/Third_Party/FreeRTOS/Source/event_groups.c(198): error: call to undeclared function '__disable_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
        ^
../Core/Inc\FreeRTOSConfig.h(97): note: expanded from macro 'configASSERT'
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
                                         ^
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(212): note: expanded from macro 'taskDISABLE_INTERRUPTS'
#define taskDISABLE_INTERRUPTS()        portDISABLE_INTERRUPTS()
                                        ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0\portmacro.h(96): note: expanded from macro 'portDISABLE_INTERRUPTS'
#define portDISABLE_INTERRUPTS()                                __disable_irq()
                                                                ^
../Middlewares/Third_Party/FreeRTOS/Source/event_groups.c(199): error: call to undeclared function '__disable_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        configASSERT( uxBitsToWaitFor != 0 );
        ^
../Core/Inc\FreeRTOSConfig.h(97): note: expanded from macro 'configASSERT'
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
                                         ^
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(212): note: expanded from macro 'taskDISABLE_INTERRUPTS'
#define taskDISABLE_INTERRUPTS()        portDISABLE_INTERRUPTS()
                                        ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0\portmacro.h(96): note: expanded from macro 'portDISABLE_INTERRUPTS'
#define portDISABLE_INTERRUPTS()                                __disable_irq()
                                                                ^
../Middlewares/Third_Party/FreeRTOS/Source/event_groups.c(202): error: call to undeclared function '__disable_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
                ^
.
.
.
.
.
.
.
.
.
.
.
 
#define portDISABLE_INTERRUPTS()                                __disable_irq()
                                                                ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c(254): error: call to undeclared function '__enable_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                portENABLE_INTERRUPTS();
                ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0\portmacro.h(97): note: expanded from macro 'portENABLE_INTERRUPTS'
#define portENABLE_INTERRUPTS()                                 __enable_irq()
                                                                ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c(259): error: expected '(' after 'asm'
__asm uint32_t ulSetInterruptMaskFromISR( void )
      ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c(259): error: expected ';' after top-level asm block
__asm uint32_t ulSetInterruptMaskFromISR( void )
     ^
     ;
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c(261): error: use of undeclared identifier 'mrs'
        mrs r0, PRIMASK
        ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c(267): error: expected '(' after 'asm'
__asm void vClearInterruptMaskFromISR( uint32_t ulMask )
      ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c(267): error: expected ';' after top-level asm block
__asm void vClearInterruptMaskFromISR( uint32_t ulMask )
     ^
     ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
compiling port.c...
compiling stm32g0xx_hal_tim.c...
"Test\Test.axf" - 93 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:06

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Pavel,

I found the solution up here. I had to let go of Keil and install STM32CubeIDE. Now everything is working fine. Thanks for your help :smiling_face_with_smiling_eyes::thumbs_up:

View solution in original post

3 REPLIES 3
Pavel A.
Evangelist III

It looks that the FreeRTOS is compiled with a wrong style of inline assembly, not intended for Keil V.6 compiler (Clang). It could work perhaps with Keil V.5 compiler (armcc).

Hey Pavel,

Thank you for the pointer. I tried changing to V5 compiler. Now I'm getting the following error :pensive_face:

It stops after generating 95 errors !

Build started: Project: Test
*** Using Compiler 'V5.03 [Build 76]', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'Test'
compiling main.c...
Fatal error: C3906U: Malformed via file 'Test\main.__i'.
Fatal error: C3906U: Malformed via file 'Test\main.__i'.
compiling spi.c...
Fatal error: C3906U: Malformed via file 'Test\spi.__i'.
Fatal error: C3906U: Malformed via file 'Test\spi.__i'.
assembling startup_stm32g030xx.s...
startup_stm32g030xx.s: error: A3906U: Malformed via file 'Test\startup_stm32g030xx._ia'.
compiling usart.c...
Fatal error: C3906U: Malformed via file 'Test\usart.__i'.
Fatal error: C3906U: Malformed via file 'Test\usart.__i'.
compiling app_freertos.c...
Fatal error: C3906U: Malformed via file 'Test\app_freertos.__i'.
Fatal error: C3906U: Malformed via file 'Test\app_freertos.__i'.
.
.
.
.
"Test\Test" - 95 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:01

Hi Pavel,

I found the solution up here. I had to let go of Keil and install STM32CubeIDE. Now everything is working fine. Thanks for your help :smiling_face_with_smiling_eyes::thumbs_up: