Bug in KDS when using CMSIS in C++ - Was: Kinetis Design Studio and C++

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

Bug in KDS when using CMSIS in C++ - Was: Kinetis Design Studio and C++

Jump to solution
1,482 Views
Masmiseim
Senior Contributor I

Hello,

 

Until know I was working with Rowley Crossworks for Embedded Development and I’m quite happy with it. But I wanted to give KDS (v3.0) a try.

I created a simple Project without using Processor-Expert or KSDK. I renamed the automatically created main.c file to main.cpp and added some includes to the CMSIS files.  You can find the resulting main.cpp File as an attachment.

 

Compiling this leads to an error in the CMSIS include File:

../Includes/core_cm4.h:1787:1: error: expected declaration before '}' token

 

It should definitely compile. Has KDS some problems with C++?

 

Thanks and regards

 

Markus

Original Attachment has been moved to: main.cpp.zip

Labels (1)
1 Solution
1,207 Views
Masmiseim
Senior Contributor I

Hello,

OK I fixed it on my own. It is not a C++ problem.

The CMSIS-Headerfiles delivered with KDS3.0 are rather old and seems to have some bugs which lead to the described Errors, but only when compiled as C++.

I replaced the CMSIS Files with the current Version. Now it is compiling without problems.

Regards

Markus

View solution in original post

0 Kudos
Reply
3 Replies
1,208 Views
Masmiseim
Senior Contributor I

Hello,

OK I fixed it on my own. It is not a C++ problem.

The CMSIS-Headerfiles delivered with KDS3.0 are rather old and seems to have some bugs which lead to the described Errors, but only when compiled as C++.

I replaced the CMSIS Files with the current Version. Now it is compiling without problems.

Regards

Markus

0 Kudos
Reply
1,207 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

hello Markus.

please refer Erich blog for C++ with Kinetis Design Studio:

C++ with Kinetis Design Studio | MCU on Eclipse

this article may help you.


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,207 Views
Masmiseim
Senior Contributor I

Hello Zhang Jun,

thanks for your feedback. I know Erich’s blog, and I like it very much.

Erich says in his blog:

“Bare Projects with C++

If using C++ with a bare project type, then everything is setup correctly. You only need to make sure that header files included for C++ files are listed in the compiler include path settings:”

This means I shouldn’t have any problems, but I do.

The only things I did was renaming main.c to main.cpp and added the include instruction

#include <core_cm4.h>

#include <core_cmInstr.h>

#include <core_cmFunc.h>

This Blog is abound Version 1.1.1. Maybe something changed to the current Version?

Thanks and regards

Markus

0 Kudos
Reply