The Pico C/C++ SDK 1.5, when installed with the windows installer, comes with GCC version 10.3.1. That version supports C++ up to C++2a. Any GCC with version > 10 supports C++23.
In this little post, I install GCC 13.3, build my project with it, and validate it with the SDK (and VSCode).
The easiest way to do this, is to install the ARM cross compiler for arm bare metal. If you accept all default settings, this toolchain will be auto-detected by VSCode on next start.
Download the installer from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads. Look for the Windows (mingw-w64-i686) hosted cross toolchains AArch32 bare-metal target (arm-none-eabi) section. Execute the installer. When prompted, leave the check for "configure registry settings" on. If you know what you are doing, you can alter other settings. When unsure, accept all defaults.
Restart VSCode. When defining the build, you can now select the new 13.3 toolchain:
To enable the C++23 standard, maintain the relevant setting in your project CMake file:
project(pico_gps_teseo C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 23) pico_sdk_init()
I tested it for this project, that needs C++23: C++ parser library for NMEA GPS data - pt. 1: ideas, concepts, early design
As extra test, I also built all the examples of the SDK 1.5 Pico examples:
[build] [6377/6377 100% :: 206.086] Linking CXX executable watchdog\hello_watchdog\hello_watchdog.elf
[driver] Build completed: 00:03:26.155
[build] Build finished with exit code 0
The install is non-intrusive, except if you let it change the path. You can either uncheck that option if you don't want that. Or remove the gcc13.3.1 bin directory from your path later on, via your Windows settings.
In any case, you will still be able to select and use the original GCC 10.3.1 that comes with the Pico SDK.
Jan, I don't use VSCode!
Other IDEs will have similar methods to select the new toolchain.
If you use command line, you can select the new toolchain via the parameters (works for Linux and Windows, as long as you use forward slashes for the path separator):
mkdir build cd build cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/opt/gcc-arm-none-eabi/bin/arm...
Also works if you're building on a GitHub hosted server via GitHub Actions (see 1st comment below):
Top Comments