Hi, I'm having a play with creating a project using C++ for the LPC4078 Cortex M4 using RTX. I can happily create, compile and run a C++ project or a C RTX project; but not the combination.
My minimal project consists of:
main.cpp
#include <RTL.h> int main() { SCB->VTOR = 0x00010000; }
I get an SCB undefined error. I can see that SCB is defined in core_cm3.h which I would have expected to be included automatically (somehow).
My project settings are fairly empty: I have Operating system: RTX Kernel, and C99 Mode selected which I presume affects only C files.
Where am I going wrong? Thanks in advance.
core_cm3.h is not included by default. Since you are running on a Cortem-M4 you would not want that included anyway. You would want to include the proper cm4.h file. This file is usually included as part of you device a specific include file. You should be able to find the correct include file in your projects that work.
You should include the proper device header file for your device. This will include the CMSIS Core header.
Thanks Matthias, I feel stupid for forgetting that!
However, I now have warning 335-D linkage specification is not allowed for my empty main() function. I imagine that means that it either should or shouldn't be extern "C"?
Any ideas please?
Ant
Hi Ant, I had a look and I'd say that there is a mistake in the LPC407x_8x_177x_8x.h. It properly opens:
#ifdef __cplusplus extern "C" { #endif
but the bracket gets never closed. Just add this before the last #endif
#ifdef __cplusplus } #endif
Brilliant, thank you Matthias, I hadn't even looked at the file, I just assumed it was tried and tested. Do I need to report that as a bug to someone?
It'll be fixed in the next version of the Device Family Pack Keil.LPC4000_DFP.x.x.x.pack
Thanks for pointing out the issue.