Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Predefined Macros

  1. #1
    Member ProfHuster's Avatar
    Join Date
    Aug 2018
    Location
    Pittsburgh PA
    Posts
    21

    Predefined Macros

    I can not find a list of what macros or definitions there are in the Arduino IDE. For example, Examples code has lines like
    Code:
    #if defined(KINETISL)
    (Some code)
    #elif defined(KINETISK)
    (Alternate code)
    #else
    (Different alternate code)
    #endif
    What KINETISL and KINETISK stand for? I think it is Teensy 3 or 4 or ?

    Other code uses __MK20DX256__ and __IMXRT1062__ to compile for T3 or T4.

    Is there a list of the preprocessor definitions that are commonly used without digging through a huge manual?

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,317
    Would be a nice thing to add such a list to wiki.

    If you want _all_ GCC macros, you could try this : https://stackoverflow.com/questions/...cessor-defines
    Last edited by Frank B; 08-26-2021 at 11:52 AM.

  3. #3
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,317
    Here are a few:
    Code:
    ARDUINO_ARCH_AVR - Avr Architecture / (all Teensy < 3.0)
    TEENSYDUINO=Version - Is a Teensy + gives TD version
    KINETISL - Teensy LC
    KINETISK - All Teensy 3.x
    __MK20DX128__ - Teensy 3.0
    __MK20DX256__ - Teensy 3.1, 3.2
    __MK64FX512__ - Teensy 3.5
    __MK66FX1M0__ - Teensy 3.6
    __IMXRT1062__ - all Teensy 4.x + Teensy 4 MM
    ARDUINO_TEENSY2 - Teensy 2
    ARDUINO_TEENSY30 - Teensy 3.0
    [...]
    ARDUINO_TEENSY40 - Teensy 4.0
    ARDUINO_TEENSY41 - Teensy 4.1
    ARDUINO_TEENSYMM - Teensy 4 MM
    Note: not complete.

    + There several other, which give the pincount, pll frequencies, etc. i.e. F_CPU gives the cpu freq at compile time (speed can be different @ runtime if it is a T4.x, if you've set it in the program)
    + the default ones, defined by the GCC Toolchain. Like __arm__ (is it a ARM CPU?) or __cplusplus (is the current file c++?) - this is a huge list, too. http://micro-os-plus.github.io/devel...efined-macros/
    Last edited by Frank B; 08-26-2021 at 12:07 PM.

  4. #4
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,317
    I've begun such a list here: https://github.com/TeensyUser/doc/wiki/Macros
    Feel free to edit.

  5. #5
    Member ProfHuster's Avatar
    Join Date
    Aug 2018
    Location
    Pittsburgh PA
    Posts
    21
    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •