C++20 and MSVC 2019 support

Status
Not open for further replies.

vulkanoid

New member
Hi All,

I just purchased a Teensy 4.0 to attempt my first hardware project. I'm hoping to use Teensy to listen to the Bluetooth signals emitted by the 'Onewheel+ XR' electric skateboard, which i purchased recently. I want to connect the T4 to a display and some speakers to have it display and sound the info it intercepts from the Bluetooth.

Is it possible to program Teensy 4.0 using C++20, as supported in MSVC 2019? I understand there may be setup involved to get the setup working, but I'm first wondering if it is possible at all.
 
The GCC that is provided with the default Arduino + Teensydunio is GCC 5.x (released in 2015, GCC 9 is the current release, and GCC 10 will be released in a few months).

I suspect using C++20 features is just not possible at this time. GCC 9 has some experimental support for C++-20 features, and GCC 10 will have more. How much, I don't know.

The C++ version that is used by the Teensydunio environment is 'g++-14', i.e. C++-14 features, plus some GNU extensions. Paul has said he wants to release a new compiler and move to 'g++-17', but right now is keeping the compiler at GCC 5.x in order to focus on adding the support for the remaining Teensy 4.x features.
 
Indeed, I currently have a very long list of features which I consider far more important than C++17 or C++20 language support.

If you want to experiment with installing a newer toolchain, look in {Arduino}/hardware/tools/arm. Save a backup copy, since you'll need to copy at least a couple .a library files after you get the newer toolchain installed.

On Windows, the default Arduino location is C:/Program Files (x86)/Arduino.

Usually newer toolchains break some things. Or sometimes it turns out stuff wasn't done all that well from the start, but always worked on the toolchains we've used so far. Newer toolchains tend to throw warnings or sometimes even errors on those sorts of things.

On Teensy 4.0, at least a couple of the low priority bugs are cases where something doesn't compile or compiles but doesn't work if other optimization settings are chosen (our default is currently -O2), so those are definitely things I want to fix before we attempt a toolchain upgrade!

If you experiment with a newer toolchain, especially if using Teensy 4.0 where so much code is relatively new, expect a bumpy ride. Please let us know about the problems you find, so some of that stuff can be gradually improved in prep when when we do upgrade.

Also, if you're the type of programmer who loves C++ fancy features, please be aware we always compile with -fno-exceptions and -fno-rtti. That will not change, even as we upgrade to newer toolchains. If you want different compiler flags, edit {Arduino}/hardware/teensy/avr/boards.txt.

We also generally follow Arduino's style guidelines (no templates & other complex syntax) for examples and public APIs.
 
Hi All,
I just purchased a Teensy 4.0 to attempt my first hardware project. I'm hoping to use Teensy to listen to the Bluetooth signals emitted by the 'Onewheel+ XR' electric skateboard, which i purchased recently.

I wonder why you chose Teensy 4.0, instead of a MCU that has Bluetooth support? I think I'd try an ESP32 first. What am I missing?
 
Status
Not open for further replies.
Back
Top