Raj Batra

Link order for ksdk

Discussion created by Raj Batra on Jan 12, 2016

I was doing a project file cleanup on KDS 3.0.0 where I moved the lib_mqx.a and other static libraries over to the libraries section of the build settings (turns out that environmental variables aren't obeyed in the miscellaneous section but are in the library section).


Normally the static libraries are linked first... E.g. -lmqx -lksdk_platform... then -lc -lgcc, etc.


When I moved them over to the libs section, I inadvertently changed the order -lc -lgcc ... -lmqx


This changed the binary output size and caused my application to crash with console error:


assertion "fd == 0" failed: file "../Firmware/K64F/BSP/init_bsp.c", line 144, function: _bsp_nio_stdio_install




By moving mqx to the front, everything worked fine. Likely, two functions have same name and linker grabbed first one.


Anyway, thought I'd share to save anyone else the headache if they run into this.