Teensy 4.1 Architecture Definition

Whizz

New member
I need to detect the target architecture during compile within the Arduino or PlatformIO IDEs. Most target boards have a definition like ARDUINO_ARCH_XXXXX. Where XXXXX is the MCU. Some of the previous Teensy's have this defined (ARDUINO_ARCH_AVR - which I think maybe wrong as an additional issue), but not for the Teensy 4.1 in the TeensyDuino files. Is it defined anywhere, if not can it be added please?

Example:
#ifdef ARDUINO_ARCH_RP2040
#define rebootCore rp2040.restart
#endif

Cheers.
 
If you turn on verbose output during compile and look at the command line used, it has these when compiling for Teensy 4.0 using Arduino 1.8.19 and Teensyduino 1.60 (beta).

Code:
-D__IMXRT1062__ -DTEENSYDUINO=160 -DARDUINO=10819 -DARDUINO_TEENSY40

Hopefully some combination of these can meet your needs. Regarding "if not can it be added please?" the answer is Teensy has consistently used these defines for many years. Adding another is pretty unlikely to happen and wouldn't change the already published versions.

You also get some defines from the compiler's internals, like __arm__. Those are from the gcc toolchain, which we do sometimes update, though odds seem strong we'll stay with gcc 11.3 for at least another year or two.
 
Back
Top