IAR tasks.c linker error

peisenhower wrote on Friday, June 04, 2010:

I am using IAR cortex M3 Kick Start to work with the energyMicro EFM32 G290F128.

I am using all the files from the freeRTOS website to start my project. I used the configuration files and source code from that demo and moved it into a project I have been working on.

When I go to build my project I get the following error:

Error: no definition for “vApplicationStackOverflowHook” 

I put a #error in the StackMacro.h file to make sure the function was being declared and it is.
What doesnt make sense to me is that a macro is defined in StackMacro.h taskFIRST_CHECK_FOR_STACK_OVERFLOW()  and that macro has a function definition and declartion in it (extern void vApplicationStackOverflowHook…). But that macro is then called within another function. I did not think that was even possible.

I can fix this error by pulling out the macro and making it a function in the task.c file but i dont thing that is the correct fix.

If someone undestands this error I would greatly appreciate the help.


richard_damon wrote on Friday, June 04, 2010:

the extern void vApplicationStackOverflowHook in the macro is a function DECLARATION not a DEFINITION. It tells the compiler how to call the function, but not what is in it. FreeRTOS does not include a definition of this function, because it doesn’t know what you want to be done once the error occurs. You program needs to provide the definition of this function, which could be as simple as just an infinite loop.

peisenhower wrote on Friday, June 04, 2010:

Fantastic thanks a bunch.

peisenhower wrote on Friday, June 04, 2010:

That fixed it. The only file I did not copy from the demo was main and thats where vApplicationStackOverflowHook was defined.

thanks again,

rtel wrote on Friday, June 04, 2010:

Thanks to Richard_Damon for his excellent support - as always.

Anything that starts vApplication is intended for definition by the application code.  These are always optional, with settings in FreeRTOSConfig.h being used to either enable or disable the option.