← Back to Pull requests

fix(Boards): Change guard around MXC_ICC_Enable() in system_max32657.c #1643

Closed
unknown closed this pull request without merging on Nov 19, 2026 12:27 UTC
View on GitHub
unknown unknown commented on Nov 06, 2026 00:44 UTC
Author

Description

SystemInit() enables in the instruction cache controller (ICC) only when the code is compiled with -mcmse. Builds that run in Secure state without -mcmse therefore run with the ICC off.

    // Internal cache controller only accessible in secure world.
#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
    // Enable the internal cache controller.
    MXC_ICC_Enable();

    /* Change system clock source to the main high-speed clock */
    MXC_SYS_Clock_Select(MXC_SYS_CLOCK_IPO);
    MXC_SYS_SetClockDiv(MXC_SYS_CLOCK_DIV_1);
    SystemCoreClockUpdate();
#endif

The guard is meant to detect Secure state. __ARM_FEATURE_CMSE == 3U doesn't detect that. It means "compiled with -mcmse". Libraries/CMSIS/Device/Maxim/GCC/gcc.mk sets the two independently:

| Build | CONFIG_TRUSTED_EXECUTION_SECURE (gcc.mk:295-308) | -mcmse (gcc.mk:314-344) | ICC enabled |
|---|---|---|---|
| Single image (TRUSTZONE=0, MSECURITY_MODE=SECURE | 1 | no | no (incorrect) |
| TrustZone, Secure image (TRUSTZONE=1, SECURE) | 1 | yes | yes |
| TrustZone, Non-Secure image (NONSECURE) | 0 | no | no (correct) |

This PR replaces the guard around MXC_ICC_Enable() to:

#if defined(CONFIG_TRUSTED_EXECUTION_SECURE) && (CONFIG_TRUSTED_EXECUTION_SECURE == 1)

Checklist Before Requesting Review

  • PR Title follows correct guidelines.

  • Description of changes and all other relevant information.

  • (Optional) Link any related GitHub issues using a keyword

  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.
  • Diff: 227 lines (+170 / -57) across 2 files Reviewer: ttmut Review duration: 19423m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 227 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.325
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1643"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.9% (MEDIUM) · Higher = larger blast radius
    36.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.0% · Safe to merge
    16.0%