c++c++11armkeilarmcc

C++11 on MicroVision 5.13 and ARMCC 5.05


I have a working uVision 5.13 project for the STM32F407 processor, I'm also using the RTX operating system and I'm trying to use some C++11 features like scoped enums but when I put the --cpp11 compiler option I receive this error from one of the cmsis headers:

compiling RTX_Conf_CM.c...
C:\Keil\ARM\PACK\ARM\CMSIS\4.2.0\CMSIS_RTX\INC\RTX_CM_lib.h(250): error: #390: function "main" may not be called or have its address taken osThreadDef_t os_thread_def_main = {(os_pthread)main, osPriorityNormal, 1, 4*OS_MAINSTKSIZE };
RTE\CMSIS\RTX_Conf_CM.c: 0 warnings, 1 error**

That´s compiling the same sources that was working just fine without the --cpp11 option.

Then if I add one of the supported C++11 features like this:

namespace TestNamespace
{

enum class Test : std::int16_t
{
  TestValue1 = 0
};

class TestClass
{

//All the class code here

};
}

then I start to receive messages from windows that "The ARM C/C++ Compiler has stopped working" every time the header file containing the scoped enum is compiled. This is the problem signature in windows:

Problem Event Name: APPCRASH
Application Name: ArmCC.exe
Application Version: 5.5.0.106
Application Timestamp: 547650a9
Fault Module Name: ArmCC.exe
Fault Module Version: 5.5.0.106
Fault Module Timestamp: 547650a9
Exception Code: c0000005
Exception Offset: 003f566a
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

So, I'm doing something wrong or those are ARMCC bugs??

My uVision version is 5.13 and the compiler version is 5.05 update 1 build 106.


Solution

  • The first error is absolutely correct, even in C++98 the practice was banned.

    The compiler crash however is a ARMCC bug, regardless of your code. Even if you tried to compile an .mp3 file, it shouldn't crash.