Missing ulICCIAR when linking C++ application

scwoods751 wrote on Monday, June 29, 2015:

I am new to freeRTOS. I went through tutorials to get c applications built and tested on a Xilinx ZC702 board (Cortex A9) and they work fine. I tried to create a very basic c++ application (hello world) but it will not link. Several objects are missing, including ulICCIAR, that are defined in port.c and referenced in portASM.s (this is where the linkage fails). I am using Xilinx SDK on Windows 7. I assume this is a name mangling problem or a toolchain setup problem but I have not been able to find help anywhere on the internet. I was hoping someone using freeRTOS might be able to assist me.

rtel wrote on Tuesday, June 30, 2015:

We don’t actually use C++ ourselves, but lot of people do use FreeRTOS in C++ applications, and even provide C++ frameworks.

What we do do is have extern “C” in the header files of the core code to ensure the core code can be built as C in an otherwise C++ application. I don’t think this is the issue in this case though.

ulICCIAR is declared in the relevant port.c source file, then used in portASM.S. I suspect the name is being mangled in the C file so the .S file cannot use the original name.

Are you building the FreeRTOS source files as C code? It should then link in a C++ application.


scwoods751 wrote on Tuesday, June 30, 2015:

I created the application as c++ and included the FreeRTOS code as-is in the application. The toolchain is set to g++ and the build log indicates the g++ compiler is used on port.c module. I thought the g++ compiler would treat c modules as c code and cc/cpp modules as c++ code. Is there a way to build the FreeRTOS modules separately and then just link them in as a module (like a lib)?

scwoods751 wrote on Tuesday, June 30, 2015:

I changed the toolchain to use the gcc compiler (override g++) for every c module in the project and then added in the include paths for every c module as well. It then built with no linkage problems. There must be a way to change to gcc compiler and include paths for c modules only once at the top level of the project instead of having to override every c file independently but I could not find it in the Xilinx SDK.
Anyhow the project finally builds… now I need to figure out why initializing basic hardware doesn’t work.
Thanks for your help. Any other pointers would be appreciated.

scwoods751 wrote on Tuesday, June 30, 2015:

Figured out why the basic hardware was not initializing… script.ld was generic and was missing the FreeRTOS vector table stuff. All good now.