Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++11 support #9

Open
bmitov opened this issue Nov 22, 2024 · 11 comments
Open

C++11 support #9

bmitov opened this issue Nov 22, 2024 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@bmitov
Copy link

bmitov commented Nov 22, 2024

How to enable C++11 support?
I am unable to compile modern libraries that require the C++11 features such as class member initialization :-( .

With best regards,
Boian Mitov

@Andy4495 Andy4495 self-assigned this Nov 24, 2024
@Andy4495 Andy4495 added the enhancement New feature or request label Nov 24, 2024
@Andy4495
Copy link
Owner

This will take a little work, and I probably won't start working on it for a couple weeks. I think it is more than just changing the compiler version; there are probably some library and configuration updates in the platform core needed as well.

@bmitov
Copy link
Author

bmitov commented Nov 24, 2024

Thank you! Sounds fantastic! :-)
Please post here the progress, and if you encounter any problems. I will try to help if I can with some library changes or something.

@tcpipchip
Copy link

This is fantastic!
I hope you can add it soon!
Thank you!

@RonsTek
Copy link

RonsTek commented Nov 26, 2024

I would also like to be added, please if possible add it soon. Thank you

@finnandreh
Copy link

Hope you can add it very soon, i would appreciate it very much. Thank you :)

@Rafal123456789987564
Copy link

Allso i Ask GPT To enable C++11 support, but didn't work. Can you add some modification please for platform's please?

Here is GPT answer

follow these steps based on your development environment:

For Arduino IDE:

  1. Open the Arduino installation folder.

  2. Navigate to the hardware directory.

  3. Locate the platform.txt file for the board you are using. For example:

For the ESP32: hardware/espressif/esp32/platform.txt

  1. Open platform.txt in a text editor.

  2. Look for a line starting with compiler.cpp.flags.

  3. Add -std=gnu++11 or -std=c++11 to the list of flags. For example:

compiler.cpp.flags=-std=gnu++11 -fno-exceptions -fno-rtti ...

  1. Save the file and restart the Arduino IDE.

For PlatformIO:

  1. Open the platformio.ini file in your project.

  2. Add the following line under the environment for your board:

build_flags = -std=gnu++11

  1. Save the file and build the project again.

For Other IDEs (e.g., Visual Studio, Eclipse):

  1. Go to your project's build settings.

  2. Locate the compiler flags or options for C++.

  3. Add -std=c++11 (or -std=gnu++11 if GNU extensions are needed).

  4. Rebuild the project.

Let me know if this resolves your issue!

@Andy4495
Copy link
Owner

Andy4495 commented Dec 2, 2024

GCC Support for C++11

Per https://gcc.gnu.org/projects/cxx-status.html#cxx11:

  • C++11 was fully implemented as of GCC 4.8.1, with some features implemented starting in GCC 4.3
    • It needs to explicitly selected with the -std=c++11 or -std=gnu++11 command-line flag
  • C++14 is the default (and therefore inclusive of C++11) starting with GCC 6.1
    • It does not appear that C++11 was ever the default before C++14

TI Platform Core Compiler Versions

Platform GCC Version Comments
msp430 4.6.6 C++11 not fully supported, compiler option not enabled
msp432 8.3.1 C++11 supported by default
tivac 8.3.1 C++11 supported by default

So, based on the above, the MSP432 and Tiva platforms should work with C++11 code, but MSP430 will not.

@Andy4495
Copy link
Owner

Andy4495 commented Dec 2, 2024

Based on the notes from my comment above, and my very limited testing, I am pretty sure that MSP432 and Tiva platforms should work with the existing platform cores published here.

So I am assuming that this request is for MSP430 support.

It turns out that that there is an "experimental" MSP430 platform version that was published by one of the Energia developers (see this archived forum post). That platform version uses GCC version 9.2.0.50 which fully supports C++11. [Edited 2-Dec-24 to correct the version number to 9.2.0.50 instead of 8.3.0]

In order to use that version, add the following URL to your Arduino Settings/Preferences:

https://raw.githubusercontent.com/Andy4495/TI_Platform_Cores_For_Arduino/refs/heads/main/json/package_msp430_elf_GCC_index.json

Then, install "Energia MSP430 boards (elf-gcc)" from the Board Manager.
And then select the appropriate MSP430 board from the Tools->Board->Energia MSP430 boards (elf-gcc) menu and compile your sketch.

If you can confirm that the "elf-gcc" version of the core works for MSP430 boards, then that should give you a workaround until I get the all the cores updated to a more recent GCC version.

Also, if you are having C++11 problems with MSP432 or Tiva, please also give details in the comments here.

@tcpipchip
Copy link

tcpipchip commented Dec 2, 2024

image

compile!

@bmitov
Copy link
Author

bmitov commented Dec 2, 2024

Thank you! I think I got it to work now with the msp432 :-) This is great! The next version of Visuino will include the support. I have started mapping the MSP432 P401R board already :-)

@tcpipchip
Copy link

congratulations Mitov!!!!!!!!! and Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants