Skip to content

convention: platform (sub)type macros must follow FL_IS_<PLATFORM> (e.g. FL_IS_ARM_LPC_845, not FL_LPC845) #2999

Closed

Description

@zackees

Problem

The NXP LPC platform-detection macros defined in src/platforms/arm/lpc/is_lpc.h did not follow the project-wide FL_IS_<PLATFORM> naming convention used everywhere else (FL_IS_TEENSY_LC, FL_IS_STM32_F1, FL_IS_ESP8266, FL_IS_SAMD21, ...). They were bare FL_<PLATFORM> names:

  • FL_LPC845, FL_LPC804, FL_LPC11, FL_LPC11_USB, FL_LPC11_LEGACY, FL_LPC15

Only the family roll-up (FL_IS_ARM_LPC) was compliant.

Convention (the rule)

Any macro that signals a platform or platform subtype (CPU family, MCU part, board variant) MUST:

  1. Start with FL_IS_ (defined-or-undefined, no value).
  2. Be nested under its family roll-up as FL_IS_<FAMILY>_<SUBTYPE>.

So given the roll-up FL_IS_ARM_LPC, the variants are:

Old (wrong) New (correct)
FL_LPC845 FL_IS_ARM_LPC_845
FL_LPC804 FL_IS_ARM_LPC_804
FL_LPC11 FL_IS_ARM_LPC_11
FL_LPC11_USB FL_IS_ARM_LPC_11_USB
FL_LPC11_LEGACY FL_IS_ARM_LPC_11_LEGACY
FL_LPC15 FL_IS_ARM_LPC_15

Note FL_IS_LPC845 would still be wrong — the family prefix (ARM_LPC) must be preserved.

Status

  • The LPC rename is implemented on branch feat/lpc845-port (all 10 affected files updated; raw CMSIS/build inputs like __LPC845__ / CPU_LPC845M301JBD48 left untouched).
  • .coderabbit.yaml macro-naming path instruction was extended to flag any platform/subtype #define that omits the FL_IS_ prefix or breaks the family nesting, so future violations are caught in review.

This issue tracks the convention itself and serves as the canonical reference for the CodeRabbit rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions