ld fails with a simple KSDK project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ld fails with a simple KSDK project

Jump to solution
1,893 Views
lispybear
Contributor I

Hi all KSDK afficionados,

I am a newbie with embedded development & Freescale MCUs (now NXP).

I am using a FRDM KL46Z board with KSDK 1.3 on Linux (Debian unstable 64 bits) and a fresh Eclipse Mars IDE.

I used the tutorials found on mcuoneclipse.com & the article cited here : FRDM-K64F Hello World Demo Undefined Reference

I have the same strange error than Stephen Frears.

The linker is unable to find the libtemplatestatic library.

I can find references in the project settings to this library but Eclipsee warns that this library is not available.

My project was defined while referencing the KDS project containing the libksdk1.3. This project compiles fine and I have a libksdk.a about 1.3Mb ( is it correct?)

I started another project from scratch and the result is the same, I tried 2 buildchains (arm-non-eabi-gcc 4.9q3 coming with debian sid) and fetched the 4.8q4 on launchpad.net

 

I don't have any clues . So your help is important for me, I am strugggling for weeks with dummy projects and I am still unable to blink LEDs & test SPI & I2c communications required for my project.

All KDS projects run fine so no problem with KSDK samples .

I have got some remarks regarding the CMakeLists.txt in the projects but it's not important (but most of the common CMake anti patterns can be found in the samples) and does not have any consequences regarding my problems.

 

Thanks for your help

Kind regards

 

PS:

I attached my .cproject file

Original Attachment has been moved to: .cproject.zip

Labels (1)
0 Kudos
Reply
1 Solution
1,535 Views
BlackNight
NXP Employee
NXP Employee

Hi jerome,

checking your .cproject, I see that this library is listed there

<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="libtemplatestatic"/>
</option>

and

containerId="ksdk_platform_lib_KL46Z4;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">

                    <externalSetting>

                        <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/libtemplatestatic"/>

                        <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/libtemplatestatic/debug"/>

                        <entry flags="RESOLVED" kind="libraryFile"

So to me it looks you have that library listed in your project settings.

Could you check your linker (Libraries) settings:

pastedImage_0.png

As for the library itself: I think it is a C++ template static library, see http://stackoverflow.com/questions/15079578/template-static-library-with-template-instantiation

I think you have it listed in your linker settings. If you are not using it, then remove it.

I hope this helps,

Erich

View solution in original post

0 Kudos
Reply
5 Replies
1,535 Views
lispybear
Contributor I

I would like to add an excerpt from the console viw (last lines)

Building file: ../Project_Settings/Startup_Code/system_MKL46Z4.c

Invoking: Cross ARM C Compiler

arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g3 -D"CPU_MKL46Z256VLH4" -I"../Sources" -I"../Project_Settings/Startup_Code" -I"../SDK/platform/CMSIS/Include" -I"../SDK/platform/devices" -I"../SDK/platform/devices/MKL46Z4/include" -I"/home/deadbrain2/platform/embedded/KSDK_1.3.0/platform/utilities/inc" -I"/home/deadbrain2/platform/embedded/KSDK_1.3.0/platform/utilities/src" -I/home/lispybear/platform/embedded/KSDK_1.3.0/platform/osa/inc -I/home/lispybear/platform/embedded/KSDK_1.3.0/platform/hal/inc -I/home/lispybear/platform/embedded/KSDK_1.3.0/platform/system/inc -I/home/lispybear/platform/embedded/KSDK_1.3.0/examples/frdmkl46z -I/home/lispybear/platform/embedded/KSDK_1.3.0/platform/drivers/inc -std=c99 -MMD -MP -MF"Project_Settings/Startup_Code/system_MKL46Z4.d" -MT"Project_Settings/Startup_Code/system_MKL46Z4.o" -c -o "Project_Settings/Startup_Code/system_MKL46Z4.o" "../Project_Settings/Startup_Code/system_MKL46Z4.c"

Finished building: ../Project_Settings/Startup_Code/system_MKL46Z4.c

Building target: test1.elf

Invoking: Cross ARM C++ Linker

arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g3 -T "MKL46Z256xxx4_flash.ld" -Xlinker --gc-sections -L"/home/lispybear/workspaces/embedded-dev-mars/test1/Project_Settings/Linker_Files" -Wl,-Map,"test1.map" -specs=nosys.specs -specs=nano.specs -Xlinker -z -Xlinker muldefs -o "test1.elf"  ./Sources/Utilities/fsl_debug_console.o  ./Sources/hardware_init.o ./Sources/main.o ./Sources/pin_init.o  ./Project_Settings/Startup_Code/startup.o ./Project_Settings/Startup_Code/startup_MKL46Z4.o ./Project_Settings/Startup_Code/system_MKL46Z4.o   -llibtemplatestatic

/home/lispybear/platform/embedded/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld: cannot find -llibtemplatestatic

collect2: error: ld returned 1 exit status

makefile:59: recipe for target 'test1.elf' failed

make: *** [test1.elf] Error 1

I wondered why this project uses the arm-none-eabi-g++ while it is a plain C one ? Can I change that in the CDT complex settings?

It may be the source for this problem ?

Kind regards

Jerome

0 Kudos
Reply
1,535 Views
lispybear
Contributor I

Hi again,

I just tested with the .deb package for KDS 3.0 , I applied the patches (inside KSDK folder) and I got the same behavior.

LD is unable to find the libtemplatestatic

I expected KDS/Eclipse to ease my life with much simpler debuging than with GDB or DDD but after 2 or 3 days struggling with the problem I will be oliged to default to the Emacs + makefile + gdb solution.

Kind regards

Jerome

0 Kudos
Reply
1,535 Views
lispybear
Contributor I

Hi again,

just to close another door I just check the contents for the compiled lib_ksdk.a with the standard nm Unix tool and it seems that all symbols referenced in the code are present in this file , I checked with the calls used inside hardware_init for the clock settings and all symbols are present in the libksdk_platform.a file.

Could you explain me what is this libtemplatestatic library?

I can't find it & google is not my friend.

debian repositories do not know nothing about this library and apt-file does not find this library inside any package from the repositories I am using.

I guess it comes with KDS/Eclipse plugins or KSDK ?

Thanks for your explanations.

0 Kudos
Reply
1,536 Views
BlackNight
NXP Employee
NXP Employee

Hi jerome,

checking your .cproject, I see that this library is listed there

<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="libtemplatestatic"/>
</option>

and

containerId="ksdk_platform_lib_KL46Z4;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">

                    <externalSetting>

                        <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/libtemplatestatic"/>

                        <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/libtemplatestatic/debug"/>

                        <entry flags="RESOLVED" kind="libraryFile"

So to me it looks you have that library listed in your project settings.

Could you check your linker (Libraries) settings:

pastedImage_0.png

As for the library itself: I think it is a C++ template static library, see http://stackoverflow.com/questions/15079578/template-static-library-with-template-instantiation

I think you have it listed in your linker settings. If you are not using it, then remove it.

I hope this helps,

Erich

0 Kudos
Reply
1,535 Views
lispybear
Contributor I

Thanks Erich,

I was sure to have dropped it before , I was wondering about an absolute requirement for the project (from CDT Wizards point of view).

I dropped it again & this time the problem disappeared.

Thanks a lot.

Now I must understand why some symbols are undefined but that 's another story -)

Kind regards

0 Kudos
Reply