ARM under C & C++

nobody wrote on Saturday, February 18, 2006:

I’m trying to compile a program under FreeRTOS with IAR compiler and if I use C as language all compile without problems, but if I use embedded C++ or extended embedded C++ I obtain always the following errors:
Error[e46]: Undefined external “AT91F_LowLevelInit” referred in ?RESET ( C:\Empresa\
Inicio\Debug\Obj\Cstartup.r79 )
Error[e46]: Undefined external “vTaskSwitchContext” referred in portasm ( C:\Empresa\Inicio\
Debug\Obj\portasm.r79 )
Error[e46]: Undefined external “vTaskIncrementTick” referred in portasm ( C:\Empresa\
Inicio\Debug\Obj\portasm.r79 )

I tought that FreeRTOS supports C++ programming but I’m not sure.

If FreeRTOS supports C++ someone have an example of IAR compiler settings??

I’m developing with ARM7 AT91SAM7A3.

Thanks.

nobody wrote on Saturday, February 18, 2006:

I suspect it cannot find the functions because of C++ mangling the names.  Try using extern "C" on the functions that are called from asm code.

nobody wrote on Saturday, February 18, 2006:

Thanks, but I think that you didn`t understand the question.
I don’t use asm code. I have problems with C++ code.
For example, I have depeloped a class for encapsulate the task funcionality, I can compile the project with this class without problems, but when I write code for instance this class in my main function I have errors linking the project.
The errors are the following:
Linking
Error[e46]: Undefined external “xTaskCreate(pdTASK_CODE, signed char const *, unsigned 
short, void *, unsigned long, void * *)” referred in ITask ( C:\Empresa\Inicio\Debug\Obj\
ITask.r79 )
Error[e46]: Undefined external “xTaskGetTickCount()” referred in ITask ( C:\Empresa\Inicio\
Debug\Obj\ITask.r79 )
Error[e46]: Undefined external “vTaskDelayUntil(portTickType *, portTickType)” referred in 
ITask ( C:\Empresa\Inicio\Debug\Obj\ITask.r79 )
Error[e46]: Undefined external “vTaskDelete(void *)” referred in ITask ( C:\Empresa\Inicio\
Debug\Obj\ITask.r79 )
Error[e46]: Undefined external “vTaskStartScheduler()” referred in main ( C:\Empresa\Inicio\
Debug\Obj\main.r79 )

Someone have any idea???
Thanks

nobody wrote on Sunday, February 19, 2006:

While it may not be asm related it still sounds like the same problem.  Are you compiling some files as c++ and some as c?  If so they will not link.  You need to compile it all as c++ (in which case I’m not sure it will work) or declare the c code as extern “c” (in which case it may work depending on what you are doing with the c++ code).

If you are not sure what this answer means then I suggest reading up a bit on mixing c and c++.

jra01 wrote on Monday, February 20, 2006:

Maybe the problem is that the compiler doesn’t see the extern “C” when compiling the OS, but when it compiles the c++ code. Therefore the C++ expects unmangled names, but the OS functions are mangled. Look in your link listing if you can find mangled versions of the OS functions (in case you get a listing even with failed links).

Jokke

jra01 wrote on Monday, February 20, 2006:

I also experienced in one environment, that when I set it up for c++ all the *.c files were omitted, and not included in the make.

Jokke again