I would like to use C++ in a project generated with KSDK Project Generator 2.1 (board FRDM-K82F). I imported the project into Kinetis Design Studio. It was all ok until that point.
I added a simple C++ class in a .hpp files and included that into the main.c. I got some compile errors. This was somewhat expected, as I tried to use C++ in a C file. So, I renamed the main.c to main.cpp, but I'm getting the following error: "(.text+0x4a): undefined reference to `main'". As I saw the main.cpp is not even compiled.
Any idea what is the problem?
解決済! 解決策の投稿を見る。
Hi Atilla,
in KDS 3.2, there is also New Project Wizard for KSDK2.0 available. This allows to create CPP projects too.
Use "File - New - C++ Project - Executable - Kinetis Project for SDK 2.x"
Regards,
Marek Trmac
Hi Attila,
there is problem in the manifest - wrong linker specification. Please download the latest package from the KEX server.
Regards
Marek
Hi Attila,
could you please post as attachment "*_manifest.xml" file from the root folder of your KSDK package? I still cannot reproduce the issue, and I susupect the problem is in the manifest file.
Thanks
Marek
Hi Atilla,
can you describe how to reproduce your problem with two linker scripts in one project?
If I create project for the board (all drivers, no RTOS), there is just one linker, see attached picture:
Regards
Marek
Hi Marek,
I just created a project with the File - New - C++ Project - Executable - Kinetis Project for SDK 2.x wizard. I'm using KDS on Ubuntu. Maybe it's related to this.
Thanks,
Attila
Hi Attilla,
we cannot reproduce your problem on UBuntu 16.04 (also not on Windows 7). Can you specify what parameters have you selected during project creation (what driver and what RTOS - if any)? Can you find what version of NewProjectWizard do you have - using Help - About - Installation Details - item "New Kinetis SDK 2.x Project Wizard" (version is displayed in the second column).
Thanks
Marek
Hi Marek,
I am using the default setting: all drivers, no RTOS.
Here is a quick video of how I create the project:
KDS 3 - Two linkers scripts - vidme
Eclipse component versions:
Thanks,
Attila
Ok, I found the problem.
There were two conflicting linker scripts used with the linker:
MK82FN256xxx15_flash.ld
MK82FN256xxx15_ram.ld
so the second fucked up the memory regions defined by the first.
The solution was to remove the MK82FN256xxx15_ram.ld from script files from the Cross ARM C++ Linker settings.
Thanks!
Hi Atilla,
in KDS 3.2, there is also New Project Wizard for KSDK2.0 available. This allows to create CPP projects too.
Use "File - New - C++ Project - Executable - Kinetis Project for SDK 2.x"
Regards,
Marek Trmac
Hi Marek,
Thanks for your suggestion. I tried it and the following happens:
Description | Resource | Path | Location | Type |
redeclaration of memory region `m_text' | CppTest222 | line 61, external location: /opt/Freescale/KDS_v3/toolchain/arm-none-eabi/bin/ld:../MK82FN256xxx15_ram.ld | C/C++ Problem | |
redeclaration of memory region `m_interrupts' | CppTest222 | line 59, external location: /opt/Freescale/KDS_v3/toolchain/arm-none-eabi/bin/ld:../MK82FN256xxx15_ram.ld | C/C++ Problem | |
redeclaration of memory region `m_data' | CppTest222 | line 60, external location: /opt/Freescale/KDS_v3/toolchain/arm-none-eabi/bin/ld:../MK82FN256xxx15_ram.ld | C/C++ Problem |
and the board is still executing the old program.
I looked into the logs, but I can't figure out what could be wrong.
Here are the consoles from KDS:
CDT-Global-Build-Console - Pastebin.com
JLinkGDBServerCL - Pastebin.com
arm-none-eabi-gdb - Pastebin.com
Can you please take a look?
Thanks,
Attila
Hello Attila
You may refer to these blogs to use GCC tool chain with C++:
http://mcuoneclipse.com/2012/10/04/processor-expert-gcc-c-and-kinetis-l-and-mqxlite/
http://mcuoneclipse.com/2014/10/25/c-with-kinetis-design-studio/
Hope this helps!
Best Regards
Fiona Kuang
TIC - Technical Information Center
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Mark Correct button. Thank you!
-----------------------------------------------------------------------------------------------------------------------