Skip to content

Define NRFX_CLZ/NRFX_CTZ and NRFY_CACHE_* in nrfx_glue.h - #18

Open
caveman99 wants to merge 1 commit into
masterfrom
nrfx-glue-warnings
Open

caveman99 wants to merge 1 commit into
masterfrom
nrfx-glue-warnings

Conversation

@caveman99

@caveman99 caveman99 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Fixes compiler warnings in every build:

  • nrfx_timer.c, nrfx_gppi_dppi.c: implicit declaration of NRFX_CTZ / NRFX_CLZ. nrfx expects the glue layer to define them; they now map to __builtin_ctz / __builtin_clz.
  • nrfy_nfct.h, nrfy_saadc.h, nrfy_spim.h, nrfy_uarte.h: unused variables passed to the empty NRFY_CACHE_* fallbacks in nrf_common.h. The glue now defines them as no-ops that consume their arguments (nRF54L has an instruction cache only).

Summary by CodeRabbit

  • Platform Support
    • Added support for bit-counting and cache-control interfaces on the nRF5 platform. Cache-control operations remain no-ops, with their arguments safely accepted. These changes affect platform-level behavior and do not add new user-facing controls or features.

nrfx expects the glue layer to provide these. Without them nrfx_timer.c
and nrfx_gppi_dppi.c call NRFX_CTZ/NRFX_CLZ as undeclared functions
(-Wimplicit-function-declaration), and the empty NRFY_CACHE_* fallbacks
in nrf_common.h leave the locals passed to them unused in nrfy_nfct.h,
nrfy_saadc.h, nrfy_spim.h and nrfy_uarte.h (-Wunused-variable).

NRFX_CLZ/NRFX_CTZ map to the GCC builtins. nRF54L has an instruction
cache only, so the cache macros stay no-ops that consume their arguments.
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The nrfx_glue.h header adds macros for counting leading and trailing zeroes. It also adds cache-maintenance macros that consume their arguments without evaluating them.

Changes: nrfx glue macros

Layer / File(s) Summary
Zero-count and cache-maintenance macros
cores/nRF5/nordic/nrfx_glue.h
NRFX_CLZ and NRFX_CTZ use compiler built-ins. The cache writeback, invalidate, and writeback/invalidate macros cast their arguments to void without evaluating them.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: Minimal · up to c61af

The change adds glue macros for zero counting and no-op cache maintenance, which addresses the reported compiler warnings. No concrete behavior regression was found, so the merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes: the NRFX_CLZ/NRFX_CTZ macros and the NRFY_CACHE_* macros added to nrfx_glue.h. The raw summary confirms that exactly these macros were added to that file, and the…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: the NRFX_CLZ/NRFX_CTZ macros and the NRFY_CACHE_* macros added to nrfx_glue.h. The raw summary confirms that exactly these macros were added to that file, and the objectives say the purpose is to fix implicit-declaration and unused-variable compiler warnings. The title is specific and matches the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit counts the zeros bright
With built-in tools, both left and right
Cache hooks stand ready, calm and still
They take their args, but do no thrill
The header gains a modest flight

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 09273f5b-698a-4201-828a-43bce7a50e74
Commits

Reviewing files that changed from the base of the PR and between 29c4903 and c61afc6.

Files selected for processing: 1

  • cores/nRF5/nordic/nrfx_glue.h

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant