Very high code RAM usage

strud

Well-known member
Hi All

I have a project using a Teensy 4.1 with many peripherals, quite large line count and numberous large buffers used for logging multiple peripheral data streams.

It seems I have something going on in my code that is using a very large amount of ram ie being allocated for runtime usage:

Linking .pio\build\teensy41\firmware.elf
Checking size .pio\build\teensy41\firmware.elf
Calculating size .pio\build\teensy41\firmware.elf
Building .pio\build\teensy41\firmware.hex
teensy_size: Memory Usage on Teensy 4.1:
teensy_size: FLASH: code:403440, data:91396, headers:8572 free for files:7623056
teensy_size: RAM1: variables:121600, code:365104, padding:28112 free for local variables:9472
teensy_size: RAM2: variables:433152 free for malloc/new:91136
teensy_size: EXTRAM: variables:16777216

I do not hope to have the specific cause of this pointed out here as the code is very large and would require a large amount of time to go through by others.

What I would like pointers on is how I can go about tracking down this large RAM requirement for run time.

I have allocated a function I suspected of needing a large amount of ram to run from flash and this did save some RAM. However given the number is so large, is it fair to assume that there is likely a single function with a very large memory requirement? I ask this as I assume the compiler is not allocating for parallel memory allocations ie only one function is executing at a time.
I do have a number of ISRs that interact with the large arrays/buffers, could these require additional ram at run time?
 
What optimization are you using? I have found that GCC using _FASTEST or even just _FASTER can result in some huge code size bloat for sometime negligible speed benefits
 
What I would like pointers on is how I can go about tracking down this large RAM requirement for run time.

Add FLASHMEM to some (or most) of your functions. For an example of the syntax, see this line in CrashReport.cpp.

Each function with FLASHMEM gets allocated only in the flash memory and won't use up ITCM RAM. But it will run slower if not cached, so best to do this only for the functions you don't need to have high performance.
 
You can also click Tools > Optimize in Arduino IDE and select "Smallest Code". If you use Teensyduino 1.59-beta4 (in Boards Manager it's version 0.59.4) the menu also has "Smallest Code with LTO" which might optimize size even more, but not all libraries are (yet) well tested with LTO.
 
Thanks guys.

I have tried just changing the optimisation flag to TEENSY_OPT_SMALLEST_CODE (Iam using Platform IO) and this has reduced the RAM1 usage for code by a bit over 100kB :)

I'll go through and change as many functions to use the FLASHMEM directive and see if that can help also.

Appreciate the inputs!
 
So have had a rather unexpected issue with my code after implementing the TEENSY_OPT_SMALLEST_CODE flag.

I was having all sorts of issues with floats not being handled as expected using printf.

Unexpected problems like incorrect chars and the float not actually appearing in the string/stream at all.

After removing this compiler directive, these issues have gone away.

Thoughts?
 
A side effect of using the smallest code option is that it links with different copies of stdlib functions, which don't include support for handling floats.
 
A side effect of using the smallest code option is that it links with different copies of stdlib functions, which don't include support for handling floats.
Oh wow! I did not know that. Thanks for the heads up.
I was going a bit mad for a while as the behaviour was very odd to say the least.
 
However, you can enable it by placing asm(".global _printf_float"); into setup()
 
I'd like to pick up on this. I'm building a synth, using classful programming. My understanding is that the FLASHMEM attribute does not work with class methods unless they are static. I have a little over 22K remaining for variables in RAM1. Adding one line of code, then pushes the padding, resulting in -10K of RAM1 available... :( .... up until this moment I have been using build_flags
-DUSB_MIDI_AUDIO_SERIAL
-DTEENSY_OPT_FASTEST

teensy_size: Memory Usage on Teensy 4.1:
teensy_size: FLASH: code:400700, data:96588, headers:8564 free for files:7620612
RAM1: variables:108576, code:397284, padding:28700 free for local variables:-10272
teensy_size: RAM2: variables:43136 free for malloc/new:481152
Error program exceeds memory space
*** [size] Error 255


I tried:
-DUSB_MIDI_AUDIO_SERIAL
-D TEENSY_OPT_SMALLEST_CODE

teensy_size: Memory Usage on Teensy 4.1:
teensy_size: FLASH: code:197700, data:59716, headers:8820 free for files:7860228
teensy_size: RAM1: variables:70528, code:194744, padding:1864 free for local variables:257152
teensy_size: RAM2: variables:43136 free for malloc/new:481152

Sadly on execution it results in complete unavailability of the USB interface. I am coding in VScode on mac and platformio.

and:
-DUSB_MIDI_AUDIO_SERIAL
-D TEENSY_OPT_FAST

this yields the following:
Building .pio/build/teensy41/firmware.hex
teensy_size: Memory Usage on Teensy 4.1:
teensy_size: FLASH: code:383124, data:96588, headers:8732 free for files:7638020
teensy_size: RAM1: variables:108576, code:379940, padding:13276 free for local variables:22496
teensy_size: RAM2: variables:43136 free for malloc/new:481152

This is fine, until it's not again... I have a lot more functionality to add.

What is the best course of action? Is USB disabled when using -D TEENSY_OPT_SMALLEST_CODE
Also, should I be opting for using arduino Strings instead of const char* to free up more memory? And, I use a fair number of lengthy enums, to simplify coding. It seems these are stored in RAM1, with no option to move them elsewhere. Should I deploy a different strategy here?

code base is here : https://github.com/mike-freislich/IM-DigiSynth/tree/main/lib
 
USB should be working with smallest code.
You should also be able to use FLASHMEM on any member function, whether it's static or not.
 
USB should be working with smallest code.
You should also be able to use FLASHMEM on any member function, whether it's static or not.
Thanks for your replay @jmarsh.

The FLASHMEM seems to cause section type conflicts between global methods and class methods. Not sure how to resolve this... only when the global method is also in FLASHMEM.

I think that if I am able to solve the USB issues, I'll be OK... but I'm not really sure where to start troubleshooting this. Any thoughts?
 
The FLASHMEM seems to cause section type conflicts between global methods and class methods. Not sure how to resolve this... only when the global method is also in FLASHMEM.

Use FLASHMEM for code (which isn't speed critical) and PROGMEM for const variables.

Make sure you are using version 1.59. A bug with startup when compiled with smallest code was fixed in 1.59. I believe PlatformIO is now supporting 1.59, so make sure you're not using 1.58 or older where that startup bug might be affecting your program (which would appear to manifest as no USB, but is actually the whole program not starting up properly).
 
Himm. Can't seem to build,

I've tried adding the following into platformio.ini in order to update to the new framework:

Code:
platform_packages =
    platformio/framework-arduinoteensy@^1.159.0
    platformio/toolchain-gccarmnoneeabi-teensy@^1.110301.0
    platformio/tool-teensy@^1.159.0

and I'm getting the following output on build .... am I doing something wrong?

Code:
Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.18.0) > Teensy 4.1
HARDWARE: IMXRT1062 720MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy @ 1.159.0 (1.59)
 - tool-teensy @ 1.159.0 (1.59)
 - toolchain-gccarmnoneeabi-teensy @ 1.110301.0 (11.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 100 compatible libraries
Scanning dependencies...
Dependency Graph
|-- PCF8575 @ 0.2.1
|-- Audio @ 1.3
|-- LXSynth
|-- SD @ 2.0.0
|-- SPI @ 1.0
|-- SerialFlash
|-- Wire @ 1.0
Building in release mode
Compiling .pio/build/teensy41/src/main.cpp.o
Compiling .pio/build/teensy41/libcbf/Wire/Wire.cpp.o
Compiling .pio/build/teensy41/libcbf/Wire/WireIMXRT.cpp.o
Compiling .pio/build/teensy41/libcbf/Wire/WireKinetis.cpp.o
Compiling .pio/build/teensy41/lib683/PCF8575/PCF8575.cpp.o
Compiling .pio/build/teensy41/lib540/SPI/SPI.cpp.o
Compiling .pio/build/teensy41/libc78/SerialFlash/SerialFlashChip.cpp.o
Compiling .pio/build/teensy41/libc78/SerialFlash/SerialFlashDirectory.cpp.o
Compiling .pio/build/teensy41/libfbb/SdFat/ExFatLib/ExFatDbg.cpp.o
Compiling .pio/build/teensy41/libfbb/SdFat/ExFatLib/ExFatFile.cpp.o
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/Wire/Wire.cpp:22:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SPI/SPI.h:16,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SPI/SPI.cpp:11:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/Wire/WireKinetis.cpp:27:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/../common/../SdFatConfig.h:56,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/../common/SysCall.h:33,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/../common/FsDateTime.h:29,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/ExFatFile.h:33,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/ExFatVolume.h:27,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/ExFatDbg.cpp:25:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from .pio/libdeps/teensy41/PCF8575/PCF8575.h:11,
                 from .pio/libdeps/teensy41/PCF8575/PCF8575.cpp:10:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/Wire/WireIMXRT.h:32,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/Wire/Wire.h:26,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/Wire/WireIMXRT.cpp:2:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SerialFlash/SerialFlash.h:31,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SerialFlash/SerialFlashDirectory.cpp:28:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/../common/../SdFatConfig.h:56,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/../common/SysCall.h:33,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/../common/DebugMacros.h:27,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SdFat/src/ExFatLib/ExFatFile.cpp:26:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SerialFlash/SerialFlash.h:31,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/libraries/SerialFlash/SerialFlashChip.cpp:28:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
*** [.pio/build/teensy41/libcbf/Wire/WireKinetis.cpp.o] Error 1
*** [.pio/build/teensy41/libcbf/Wire/Wire.cpp.o] Error 1
*** [.pio/build/teensy41/lib683/PCF8575/PCF8575.cpp.o] Error 1
*** [.pio/build/teensy41/lib540/SPI/SPI.cpp.o] Error 1
*** [.pio/build/teensy41/libcbf/Wire/WireIMXRT.cpp.o] Error 1
*** [.pio/build/teensy41/libc78/SerialFlash/SerialFlashChip.cpp.o] Error 1
*** [.pio/build/teensy41/libc78/SerialFlash/SerialFlashDirectory.cpp.o] Error 1
*** [.pio/build/teensy41/libfbb/SdFat/ExFatLib/ExFatDbg.cpp.o] Error 1
*** [.pio/build/teensy41/libfbb/SdFat/ExFatLib/ExFatFile.cpp.o] Error 1
In file included from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/WProgram.h:69,
                 from /Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/Arduino.h:6,
                 from lib/LXSynth/utils/DebugLog.h:3,
                 from src/main.cpp:2:
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h: In member function 'uint32_t IntervalTimer::cyclesFromPeriod(period_t)':
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:36: error: 'is_arithmetic_v' is not a member of 'std'; did you mean 'is_arithmetic'?
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                    ^~~~~~~~~~~~~~~
      |                                    is_arithmetic
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:60: error: expected primary-expression before '>' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                            ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:114:61: error: expected primary-expression before ',' token
  114 |                 static_assert(std::is_arithmetic_v<period_t>, "Period must be arithmetic");
      |                                                             ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:36: error: 'is_integral_v' is not a member of 'std'; did you mean 'is_integral'?
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                    ^~~~~~~~~~~~~
      |                                    is_integral
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:58: error: expected primary-expression before '>' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                          ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:118:59: error: expected primary-expression before ')' token
  118 |                 if constexpr (std::is_integral_v<period_t>)       // handles all integral types
      |                                                           ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:20: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17'
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                    ^~~~~~~~~
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:36: error: 'is_floating_point_v' is not a member of 'std'; did you mean 'is_floating_point'?
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    is_floating_point
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:64: error: expected primary-expression before '>' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                ^
/Users/mikef/.platformio/packages/framework-arduinoteensy/cores/teensy4/IntervalTimer.h:120:65: error: expected primary-expression before ')' token
  120 |                 if constexpr (std::is_floating_point_v<period_t>) // handles all float types
      |                                                                 ^
*** [.pio/build/teensy41/src/main.cpp.o] Error 1
================================================================================================== [FAILED] Took 2.22 seconds ==================================================================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1.
 *  Terminal will be reused by tasks, press any key to close it.
 
Looks like you don't compile for gnu++17. Make sure -std=gnu++17 is set in your build options
 
Last edited:
Looks like you don't compile for gnu++17. Make sure -std=gnu++17 is set in your build options
you are correct of course. It was defaulting to gnu++14. All issues resolved. I can now compile with the SMALLEST_CODE option, and USB is working correctly!

Thank you everyone!
 
Instead of SMALLEST_CODE you could also try to add --specs=nano.specs which will switch to newlib-nano (same as SMALLEST_CODE does) but keeps the optimization level.
 
Back
Top