Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Using FreeRTOS on Win7 using VC++ , managed to create a simple project but getting errors?

Posted by embeddedlab on January 28, 2015

Hello!! I had just started using FreeRTOS as i had read a lot about it. I open the Microsoft Visual Studio Demo and compile, it works perfectly but the problem is that the project is very complex for me to understand as i don't have any idea about traces. I just want to start with basics.

I read anatomy of FreeRTOS available on website and started in the same way as described there. I added all source files, header files portable files properly. Added all directories in project properties but when i compile my code i am getting numerous errors.

Here is my program in main file

~~~~~~

include
include
include

/* FreeRTOS kernel includes. */

include "FreeRTOS.h"
include "task.h"

void vTask1( void pvParameters ) { const char *pcTaskName = "Task 1 is runningrn"; volatile unsigned long ul; / As per most tasks, this task is implemented in an infinite loop. / for( ;; ) { / Print out the name of this task. / vPrintString( pcTaskName ); / Delay for a period. */ for( ul = 0; ul < mainDELAYLOOPCOUNT; ul++ ) { } } }

void vTask2( void pvParameters ) { const char *pcTaskName = "Task 2 is runningrn"; volatile unsigned long ul; / As per most tasks, this task is implemented in an infinite loop. / for( ;; ) { / Print out the name of this task. / vPrintString( pcTaskName ); / Delay for a period. */ for( ul = 0; ul < mainDELAYLOOPCOUNT; ul++ ) { } } } int main() { // Create Task 1 xTaskCreate( vTask1, "Task 1", 1000, NULL, 1, NULL); // Create Task 2 xTaskCreate( vTask2, "Task 2", 1000, NULL, 1, NULL ); // Start Scheduler vTaskStartScheduler(); while(1); return 0; }

~~~~~~

What i think is that vPrintString is not supported now and i replaced it with printf, but there are lots of other error also.

I am attaching my project on google site, please someone help me, and tell me what i am doing wrong. Please guys help me getting started with FreeRTOS.

Download Link is as follow, copy and paste it in browser and please help https://sites.google.com/site/coolembeddedlaboratory/home/softwares/TaskTest.zip?attredirects=0&d=1

Thanks in advance.


Using FreeRTOS on Win7 using VC++ , managed to create a simple project but getting errors?

Posted by rtel on January 28, 2015

the project is very complex for me to understand

I think the documentation page for that demo needs updating because the same project is used to build both a complex example and a simple blinky example. Although that is described at the top of the project's main() file I think:


/* This project provides two demo applications.  A simple blinky style project,
and a more comprehensive test and demo application.  The
mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.
The simply blinky demo is implemented and described in main_blinky.c.  The more
comprehensive test and demo application is implemented and described in
main_full.c. */
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY	0

If you set mainCREATESIMPLEBLINKYDEMOONLY to 1 then main_blinky.c is used. That creates one queue and two tasks - and nothing else.

vPrintString

I think that is a function that is used in the book examples, it is not a FreeRTOS nor a MSVC function.

i replaced it with printf

printf() makes Windows system calls, which can mess up the scheduling, but in your simple case it should not be too much of a problem.

However, you will need to protect it if both tasks are calling it simultaneously - something like:

vTaskSuspendAll(); printf(); fflush(); /* May not be required in MSVC, is required in MingW. */ xTaskResuleAll();

I think that is what vPrintString() did in the book examples.

or alternatively, protect it with a mutex.

I'm not sure what you have mainDELAYLOOPCOUNT set to, but on a modern PC it will have to be massive to make a noticeable delay. You are better off calling vTaskDelay().

Download Link is as follow, copy and paste it in browser and please help

I'm not going to do that (not without charging you a consultancy fee, anyway ;o), but if you post the errors to this thread we may be able to help.

Regards.


Using FreeRTOS on Win7 using VC++ , managed to create a simple project but getting errors?

Posted by embeddedlab on January 29, 2015

Thanks for your reply, i am a hobbyist and can't afford that fee and thanks a lot for your reply. And the example is simple for you but as i don't have any knowledge of semaphore, queues etc, the example in demo makes things complicated for me, thats why i want to start with creating two simple tasks and the proceed further.

I am using vTaskDelay() and printf in my program, and now i am getting these 12 Errors, please help me to solve these error, it will be of great help to me.

Error 1 error LNK2001: unresolved external symbol vAssertCalled -> tasks.obj Error 2 error LNK2001: unresolved external symbol _vAssertCalled timers.obj Error 3 error LNK2019: unresolved external symbol _vAssertCalled referenced in function _vEventGroupDelete eventgroups.obj Error 4 error LNK2001: unresolved external symbol vAssertCalled heap5.obj Error 5 error LNK2001: unresolved external symbol vAssertCalled port.obj Error 6 error LNK2001: unresolved external symbol _vAssertCalled queue.obj Error 7 error LNK2019: unresolved external symbol _vApplicationMallocFailedHook referenced in function _pvPortMalloc heap5.obj Error 8 error LNK2019: unresolved external symbol _ulGetRunTimeCounterValue referenced in function _uxTaskGetSystemState tasks.obj Error 9 error LNK2019: unresolved external symbol _vConfigureTimerForRunTimeStats referenced in function _vTaskStartScheduler tasks.obj Error 10 error LNK2019: unresolved external symbol _vApplicationTickHook referenced in function _xTaskIncrementTick tasks.obj Error 11 error LNK2019: unresolved external symbol _vApplicationIdleHook referenced in function _prvIdleTask tasks.obj Error 12 error LNK1120: 6 unresolved externals


Using FreeRTOS on Win7 using VC++ , managed to create a simple project but getting errors?

Posted by embeddedlab on January 29, 2015

I saw in demo example, this function is present in main file. vAssertCalled and its source code is as follow:-

~~~~~~ void vAssertCalled( unsigned long ulLine, const char * const pcFileName ) { static portBASETYPE xPrinted = pdFALSE; volatile uint32t ulSetToNonZeroInDebuggerToContinue = 0;

/* Parameters are not used. */
( void ) ulLine;
( void ) pcFileName;

taskENTER_CRITICAL(); { /* Stop the trace recording. */ if( xPrinted == pdFALSE ) { xPrinted = pdTRUE; if( xTraceRunning == pdTRUE ) { vTraceStop(); prvSaveTraceFile(); } }

	/* You can step out of this function to debug the assertion by using
	the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero
	value. */
	while( ulSetToNonZeroInDebuggerToContinue == 0 )
	{
		__asm{ NOP };
		__asm{ NOP };
	}
}
taskEXIT_CRITICAL();

} ~~~~~~


Using FreeRTOS on Win7 using VC++ , managed to create a simple project but getting errors?

Posted by rtel on January 29, 2015

error LNK2001: unresolved external symbol _vAssertCalled -> tasks.obj

Its difficult to add more than the linker is already telling you - your code is calling a function call vAssertCalled() but vAssertCalled() is not defined anywhere in your source file.

I guess the first thing you will have done is search the files using grep or whatever to see where vAssertCalled is used, found that it was in the definition of configASSERT() in FreeRTOSConfig.h, then either provided the function or changed configASSERT() so it did something else - so I won't suggest you do that now.

error LNK2019: unresolved external symbol _vApplicationMallocFailedHook

I guess here you would have googled vApplicationMallocFailedHook, found other people asking the same question, and found the following documentation page: http://www.freertos.org/a00016.html which tells you how to use and define it - so I won't suggest you do that now.

referenced in function pvPortMalloc heap5.obj Error 8 error LNK2019: unresolved external symbol _ulGetRunTimeCounterValue referenced in function _uxTaskGetSystemState

Again I guess you will already have done two things to help yourself here. First search the source files to see where this function is, and found the preprocessor definitions required to include the function, and Googled the function to find the following documentation page: http://www.freertos.org/uxTaskGetSystemState.html which will also give you information - so I won't suggest you do that now.

Error 10 error LNK2019: unresolved external symbol _vApplicationTickHook referenced in function _xTaskIncrementTick tasks.obj

As above.

So I guess, if you have done all these simple things yourself already, you won't have these build errors any more.

Regards.


Using FreeRTOS on Win7 using VC++ , managed to create a simple project but getting errors?

Posted by embeddedlab on January 29, 2015

I am still getting these new errors. :-(

Error 1 error LNK2019: unresolved external symbol "void __cdecl vMutexISRInteractionTest(void)" (?vMutexISRInteractionTest@@YAXXZ) referenced in function "void __cdecl vFullDemoTickHookFunction(void)" (?vFullDemoTickHookFunction@@YAXXZ) D:DropboxProjectsFreeRTOSTaskTestTaskTestmain.obj TaskTest Error 2 error LNK2019: unresolved external symbol "void __cdecl vTimerPeriodicISRTests(void)" (?vTimerPeriodicISRTests@@YAXXZ) referenced in function "void __cdecl vFullDemoTickHookFunction(void)" (?vFullDemoTickHookFunction@@YAXXZ) D:DropboxProjectsFreeRTOSTaskTestTaskTestmain.obj TaskTest Error 3 error LNK2019: unresolved external symbol "void __cdecl vQueueSetAccessQueueSetFromISR(void)" (?vQueueSetAccessQueueSetFromISR@@YAXXZ) referenced in function "void __cdecl vFullDemoTickHookFunction(void)" (?vFullDemoTickHookFunction@@YAXXZ) D:DropboxProjectsFreeRTOSTaskTestTaskTestmain.obj TaskTest Error 4 error LNK2019: unresolved external symbol "void __cdecl vQueueOverwritePeriodicISRDemo(void)" (?vQueueOverwritePeriodicISRDemo@@YAXXZ) referenced in function "void __cdecl vFullDemoTickHookFunction(void)" (?vFullDemoTickHookFunction@@YAXXZ) D:DropboxProjectsFreeRTOSTaskTestTaskTestmain.obj TaskTest Error 5 error LNK2019: unresolved external symbol "void __cdecl vPeriodicEventGroupsProcessing(void)" (?vPeriodicEventGroupsProcessing@@YAXXZ) referenced in function "void __cdecl vFullDemoTickHookFunction(void)" (?vFullDemoTickHookFunction@@YAXXZ) D:DropboxProjectsFreeRTOSTaskTestTaskTestmain.obj TaskTest Error 6 error LNK2019: unresolved external symbol _vApplicationTickHook referenced in function _xTaskIncrementTick D:DropboxProjectsFreeRTOSTaskTestTaskTesttasks.obj TaskTest Error 7 error LNK1120: 6 unresolved externals D:DropboxProjectsFreeRTOSTaskTestDebugTaskTest.exe TaskTest

Can you please suggest me, what can i do now.


Using FreeRTOS on Win7 using VC++ , managed to create a simple project but getting errors?

Posted by davedoors on January 29, 2015

They are all standard demo functions, I guess you copied the tick hook code from demo. If you are not building the standard demo files just remove them.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS