Which C/C++ dialect is MCUXpresso using by default?

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

Which C/C++ dialect is MCUXpresso using by default?

6,044 Views
danielholala
Senior Contributor II

Hi,

I'm using MCUXpresso IDE and SDK shipped with it. The IDE also installs the required toolchains, so I don't have to worry about all the parts and the setup. While this provides a solid base to start working with, it sometimes hides away some interesting details.

For example, the C/C++ dialect used in the current project is set in the project settings (C/C++ Build > Settings > Tool Settings > Dialect) as "Compiler default". Regarding "gcc", the default depends on the compiler version used but I don't know which version of gcc the IDE installed.

 

To find out which compiler is used for the current project, I clicked "Utilities > Open command prompt" in the context menu. Running "gcc --version" reports "6.3.1 20170620". 

Google didn't have the manual for exactly this gcc version but for version 6.4.0, the official manual states:

The default, if no C language dialect options are given, is -std=gnu11.

and 

The default, if no C++ language dialect options are given, is -std=gnu++14.

Can I correctly assume that these are the C/C++ dialects used for my current project?

Thanks.

Tags (2)
0 Kudos
3 Replies

2,716 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Sorry, the only documentation we have for the specific implementation details of Redlib is supplied in the IDE User Guide. Beyond that - its "just a C library" and generally most website or text book reference material should be usable.

Regards,

MCUXpresso IDE Support

0 Kudos

2,716 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The GCC documentation matching the version of GCC supplied in MCUXpresso IDE can be found within the IDE's Built in help system.

  • Help -> Help Contents -> Tools (Compilers, Debugger, Utilities) -> Using the GNU Compilers

The simplest way to double check the GCC version supplied is probably to:

  • Right click on a project in the Project Explorer view
  • Select Utilities -> Open command prompt here
  • Enter: arm-none-eabi-gcc --version

One thing to be aware of if you want to make use of functionality introduced in more recent C standards is that by default C projects link against the "Redlib" C library, which is a C90 standard library with some C99 extensions. This is fine if you only want language functionality added in latter standards, but if you want library functionality beyond this standard, you need to switch to Newlib / NewlibNano. For more details, please see the MCUXpresso IDE v10.1 User Guide, chapter 13, "C/C++ Library Support".

Regards,

MCUXpresso IDE Support

0 Kudos

2,716 Views
danielholala
Senior Contributor II

Thanks lpcxpresso_support, for the immediate response which is very helpful.

Of course you are correct, I did run "arm-none-eabi-gcc --version"  and not just "gcc --version" to gather version information. The gcc manual from the built-in help system agrees with the more current manual quoted above.

Thanks for mentioning that the different C libraries are supporting different C standards. I checked the MCUXpresso IDE User Guide and the built in help system. There I found the complete API of Newlib C library:

  • Help -> Help Contents -> Tools -> Newlib

Great, however, I failed to find the documentation for "Redlib" C library (which is recommend for C projects by default). 

IDE User Guide, chapter 13.1.1 vaguely mentions that Redlib C "implements a number of extensions" but does not specify if the listed three extensions are conclusive.

Any advise?

Thanks.
Daniel

0 Kudos