cancel
Showing results for 
Search instead for 
Did you mean: 

Error when using FreeRTOS

Kai_Satone
Associate III

This Error occures when compling code

 

13:39:46 **** Incremental Build of configuration Debug for project 15_04_24_RTOS_TEST ****
make -j4 all 
arm-none-eabi-gcc -o "15_04_24_RTOS_TEST.elf" @"objects.list"   -mcpu=cortex-m4 -T"D:\STM32 RTOS\15_04_24_RTOS_TEST\STM32F411CEUX_FLASH.ld" --specs=nosys.specs -Wl,-Map="15_04_24_RTOS_TEST.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -u _printf_float -u _scanf_float -Wl,--start-group -lc -lm -Wl,--end-group
C:/ST/STM32CubeIDE_1.14.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: ./Core/Src/main.o: in function `vApplicationGetIdleTaskMemory':
D:/STM32 RTOS/15_04_24_RTOS_TEST/Debug/../Core/Src/freertos.c:123: multiple definition of `vApplicationGetIdleTaskMemory'; ./Core/Src/freertos.o:D:/STM32 RTOS/15_04_24_RTOS_TEST/Debug/../Core/Src/freertos.c:123: first defined here
C:/ST/STM32CubeIDE_1.14.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: ./Middlewares/Third_Party/FreeRTOS/Source/timers.o: in function `xTimerCreateTimerTask':
D:/STM32 RTOS/15_04_24_RTOS_TEST/Debug/../Middlewares/Third_Party/FreeRTOS/Source/timers.c:245: undefined reference to `vApplicationGetTimerTaskMemory'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:68: 15_04_24_RTOS_TEST.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.

13:39:47 Build Failed. 3 errors, 0 warnings. (took 709ms)

 

 

Kai_Satone_0-1714811676256.png

Kai_Satone_1-1714811691299.png

freertos.c

 

void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
{
  *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
  *ppxIdleTaskStackBuffer = &xIdleStack[0];
  *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
  /* place for user code */
}

 

 timers.c

 

if( xTimerQueue != NULL )
	{
		#if( configSUPPORT_STATIC_ALLOCATION == 1 )
		{
			StaticTask_t *pxTimerTaskTCBBuffer = NULL;
			StackType_t *pxTimerTaskStackBuffer = NULL;
			uint32_t ulTimerTaskStackSize;

		vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize );

			xTimerTaskHandle = xTaskCreateStatic(	prvTimerTask,
													configTIMER_SERVICE_TASK_NAME,
													ulTimerTaskStackSize,
													NULL,
													( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
													pxTimerTaskStackBuffer,
													pxTimerTaskTCBBuffer );

			if( xTimerTaskHandle != NULL )
			{
				xReturn = pdPASS;
			}
		}

 

3 REPLIES 3
SofLit
ST Employee

Hello,

How did you generate the code? With CubeMx?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Complaining you have two instances of the function, or source for it, check your project trees.

Where it lacks for a definition/prototype, make sure you're including a .H that does so in the source file that's USING it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Haithem Rahmani
ST Employee

Hi @Kai_Satone 

it seems that you are setting the configKERNEL_PROVIDED_STATIC_MEMORY to 1 in your FreeRTOSConfig.h file

if it is the case then please unset it. It is clearly stated in FreeRTOS comments below.

https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/30afc1a2c05157fcac1a46dc773b0125bd680b82/tasks.c#L8578

 

regards
Haithem.