跳转至

TC3xx

AURIX TC3xx RAM Safety Mechanisms: Comprehensive Overview

AURIX TC3xx RAM Safety Mechanisms: Comprehensive Overview

The AURIX TC3xx family implements multiple layers of hardware-based RAM safety mechanisms to detect and manage random hardware faults, supporting ASIL-D compliance according to ISO 26262. This comprehensive overview covers the primary safety features for on-chip memory.

1. Error Detection and Correction (ECC)

Primary Memory Protection: - ECC Implementation: Single-bit error correction, double-bit error detection - Coverage: Local CPU-specific RAM (LCSR), Scratchpad RAM, DSPR, PSPR, Flash memories, and DMI - Automatic Operation: ECC errors are corrected transparently during read operations; detection triggers SMU alerts - Multi-Bit Error Tracking: Accumulates correctable errors to predict potential failures before they occur

Key ECC Registers: - Each memory with ECC has dedicated control/status registers for error monitoring - SMU integration ensures immediate fault response

2. Address Monitoring (MBAR)

Illegal Access Detection: - MBAR Functionality: Memory Background Access Register monitors for illegal addressing - Detection Logic: Detects multi-bit address faults that could access incorrect memory locations - Hardware Integration: Works with MPU to provide comprehensive address fault coverage - SMU Reporting: Triggers safety alerts when address violations occur

3. Address Error Monitor

Address Fault Detection: - Multi-Bit Address Fault Detection: Monitors address bus for multi-bit errors - Background Access Monitoring: Continuously checks address validity during background operations - Integration with MBAR: Works in conjunction with MBAR for comprehensive address fault coverage - Fault Containment: Prevents address errors from propagating to memory accesses

Key Features: - Detects address decoder faults - Identifies address line stuck-at faults - Monitors for transient address errors - Provides real-time address fault reporting to SMU

4. SMU Integration for RAM Safety

Safety Monitor Unit Integration: - Alarm Configuration: RAM safety mechanisms trigger SMU alarms on fault detection - Fault Response: Configurable responses including system reset, safe state entry, or notification - Alarm Priorities: Different RAM faults have different priority levels - Fault Collection: SMU collects and manages all RAM safety events

Common RAM-Related SMU Alarms: - ECC Single-Bit Error: Correctable error, logged for monitoring - ECC Multi-Bit Error: Uncorrectable error, typically triggers reset - Address Error: Illegal access detected, triggers protection trap - MBAR Violation: Memory background access violation detected

Detailed RAM Alarm Classification:

1. Correctable-Error Alarm (CE): - Trigger: ECC single-bit error correction performed - Severity: Non-critical, latent fault indication - Action: Logged for monitoring and trend analysis - Response: Typically notification only - Purpose: Predictive maintenance before failure occurs

2. Uncorrectable-Error Alarm (UCE): - Trigger: ECC double-bit error detection OR RAM address error detection - Severity: Critical, immediate fault indication - Action: Triggers configurable fault response - Response: System reset, safe state entry, or trap - Purpose: Prevent propagation of corrupted data

3. Miscellaneous Error Alarm (ME): - Trigger: Non-critical (latent) fault detection - Severity: Low, warning indication - Action: Logged for diagnostic purposes - Response: Notification or monitoring - Purpose: Early warning of potential degradation

/**
 * @brief Configure SMU alarms for RAM safety mechanisms
 */
void configure_ram_smu_alarms(void) {
    // ECC single-bit error alarm - notification only
    smu_configure_alarm(SMU_ALARM_ECC_1BIT, SMU_ACTION_NOTIFICATION);

    // ECC multi-bit error alarm - system reset
    smu_configure_alarm(SMU_ALARM_ECC_2BIT, SMU_ACTION_RESET);

    // Address error alarm - protection trap
    smu_configure_alarm(SMU_ALARM_ADDR_ERR, SMU_ACTION_TRAP);

    // MBAR violation alarm - safe state
    smu_configure_alarm(SMU_ALARM_MBAR_VIOL, SMU_ACTION_SAFE_STATE);
}

5. Port Protection for RAM

Bus-Level Access Control: - Port-Based Protection: Controls RAM access at the bus master level - SRI Tag ID Verification: Validates bus master IDs before granting RAM access - Multi-Core Isolation: Prevents unauthorized cores from accessing specific RAM regions - DMA Access Control: Restricts DMA channels to authorized memory regions

Protection Levels: - Read Protection: Controls read access per bus master - Write Protection: Controls write access per bus master - Execute Protection: Controls execution privileges for code regions

5.1 Safety Protection Regions (SPR)

Advanced Memory Access Control: - SPR_SPROT_RGNLAi: Defines lower address of protection region in PSPR/DSPR - SPR_SPROT_RGNUAi: Defines upper address of protection region - SPR_SPROT_RGNACCENi: Defines SRI tags allowed access to each region - Region-Based Isolation: Multiple protection regions can be configured - Fine-Grained Control: Individual access control per region and bus master

Access Enable Registers: - ACCEN0/ACCEN1: Control write access for transactions with specific TAG IDs - 6-bit TAG ID Support: Prepared for 6-bit TAG ID encoding - Bit Mapping: EN0 → TAG ID 000000B through EN31 → TAG ID 011111B - Access Violation: Write accesses not permitted by register setting will error

6. Write/Read Compare Mechanisms

Soft Error Detection: - Write Compare: Verifies that data written matches what was intended - Read Compare: Background read operations to detect memory cell degradation - Automatic Execution: Performed by hardware without software intervention - Periodic Testing: Continuous monitoring for transient faults

7. Memory Control and Status Registers (MCSR)

Initialization and Monitoring: - RAM Initialization: MCSR bits indicate whether RAM has been properly initialized - Status Reporting: Provides visibility into memory initialization state - Safety Requirement: Uninitialized RAM detection prevents use of unreliable memory - Hardware Locking: MCSR.LOCK prevents accidental modification of initialization settings - RAM_INIT_RS: Bit indicating RAM initialization status after reset (0 = not initialized, 1 = initialized)

7.1 Data Integrity Error Tracking

Error Localization and Reporting: - DIETR (Data Integrity Error Trap Register): Captures error type and location - IE_S: Error in Scratchpad RAM - IE_C: Error in Cache RAM - IE_T: Error in Tag RAM - IE_LPB: Error in Local Peripheral Bus memory - IE_DLMU: Error in Distributed Local Memory Unit - IE_UNC: Indicates uncorrectable error condition - E_INFO: Cache way information for cache errors

  • DIEAR (Data Integrity Error Address Register): Contains physical address of access that caused uncorrectable error
  • Only updated when DIETR.IED is zero
  • Enables precise error localization for debugging and recovery
  • Critical for fault analysis and system recovery strategies

Error Handling Flow: 1. Error detected during memory read operation 2. DIETR registers updated with error type and location 3. DIEAR captures the failing address (if applicable) 4. IED bit set, other DIETR bits set to zero 5. Asynchronous DIE trap raised for uncorrectable errors 6. Trap handler responsible for recovery or system reset

8. Local Memory Management

CPU-Specific Memory Features: - LML (Local Memory Lock): Locks specific memory regions against unauthorized access - LSR (Local Sleep): Controls sleep modes for local memory to prevent access during inactive periods - Dual-Port RAM Support: Enables safe shared memory access between cores with built-in arbitration - Built-in Test Logic: Hardware self-test for memory integrity

8.1 Distributed LMU (DLMU) Protection

Enhanced Memory Safety: - ECC Protection Basis: 64-bit (double-word) basis for DLMU memory - SSH ECCS Register: Controls ECC enable/disable for DLMU - Error Detection: Uncorrectable error signal generated per double-word - Trap Response: Asynchronous DIE trap raised on error detection - Dual Access Paths: Protected access from both TriCore CPU and bus interface (PMI/SRI)

Error Handling for DLMU: - CPU Load Requests: ECC bits read with data, errors flagged to CPU - Bus Interface Access: Separate error detection for PMI and SRI accesses - Recovery Options: Trap handler can correct memory entry or initiate system reset

8.2 Scratchpad RAM (DSPR/PSPR) Protection

16-bit ECC Protection: - ECC Granularity: 16-bit data width for ECC protection - Read-Modify-Write: Byte writes performed as read-modify-write operations - Error Detection: Errors on read phase prevent write phase execution - Uninitialized Memory: Byte writes to uninitialized memory always detect ECC error

Memory Organization: - Tower Structure: DSPR organized as multiple memory "towers" - 64-bit Access: CPU can access 64 bits from any 16-bit aligned address - SRI Slave Access: Supports multi-core access via SRI interface - Burst Transfers: Compatible with all SRI transaction types

8.3 Cache Memory Protection

Comprehensive ECC Coverage: - Data Cache (DCACHE): All cache SRAMs ECC protected - Tag SRAMs: All TAG SRAMs ECC protected - Cache Line Structure: 256 bits data + ECC bits per line - Error Signaling: Errors detected at ECC decoders signaled to EMM via SSH logic - Two-way Set Associative: LRU replacement algorithm with per-line valid/dirty bits

9. Safety Flip-Flops

Additional Protection Layer: - SFF Protection: Critical flip-flops in CPU and peripheral RAMs protected against transient faults - Automatic Detection: Hardware detects flip-flop state changes - Immediate Response: Triggers SMU alerts on detection

Safety Mechanism Classification

According to the functional safety documentation, RAM safety mechanisms are classified as:

Safety Mechanisms (SM): - Can be handled by MCU internal software or hardware - Include ECC, address monitoring, MBAR, address error monitor, write/read compare mechanisms

External Safety Mechanisms (ESM): - Require system-level software or hardware solutions - Include periodic memory tests and software-based integrity checks

This section provides detailed information about the key registers used for RAM safety in AURIX TC3xx.

10.1 Data Integrity Error Registers

CPUx_DIETR - Data Integrity Error Trap Register - Address: 0x19024 (Short: 0x9024) - Reset Value: 0x0000_0000 - Access: Read/Write

Bit Fields:

Bits Field Description
[31:24] - Reserved
[23] IE_MT Error in Memory Test (not used in this context)
[22] IE_S Error in Scratchpad RAM (DSPR/PSPR)
[21] IE_C Error in Cache RAM
[20] IE_T Error in Tag RAM
[19] IE_LPB Error in Local Peripheral Bus memory
[18] IE_DLMU Error in Distributed Local Memory Unit
[17] IE_UNC Uncorrectable error condition detected
[16:12] E_INFO Cache way information (when IE_C is set)
[11:1] - Reserved
[0] IED Interrupt Error Detected - set when error captured, inhibits further updates until cleared

CPUx_DIEAR - Data Integrity Error Address Register - Address: 0x19020 (Short: 0x9020) - Reset Value: 0x0000_0000 - Access: Read/Write

Bit Fields:

Bits Field Description
[31:0] TA Trap Address - Physical address of the access that caused the uncorrectable error

Usage Notes: - DIETR is only updated when IED bit is zero - Once IED is set, no further hardware updates occur until software clears it - DIEAR is only updated when DIETR.IED is zero - These registers enable precise error localization for debugging and recovery

10.2 Memory Protection Registers

SPR_SPROT_RGNLAi - Safety Protection Region Lower Address - Address: 0xE000 + i*0x4 (where i = 0-7) - Reset Value: Application dependent - Access: Read/Write, Supervisor mode only

Description: Defines the lower address boundary for safety protection regions in PSPR/DSPR memory.

SPR_SPROT_RGNUAi - Safety Protection Region Upper Address - Address: 0xE020 + i*0x4 (where i = 0-7) - Reset Value: Application dependent - Access: Read/Write, Supervisor mode only

Description: Defines the upper address boundary for safety protection regions in PSPR/DSPR memory.

SPR_SPROT_RGNACCENAi_W - Region Access Enable Register A (Write) - Address: 0xE040 + i*0x8 (where i = 0-7) - Reset Value: 0x0000000 - Access**: Read/Write, Supervisor mode only

Bit Fields:

Bits Field Description
[31:0] EN Enable bits for bus masters 0-31 (1 bit per master)

SPR_SPROT_RGNACCENBi_W - Region Access Enable Register B (Write) - Address: 0xE044 + i*0x8 (where i = 0-7) - Reset Value: 0x0000000 - Access**: Read/Write, Supervisor mode only

Bit Fields:

Bits Field Description
[31:0] EN Enable bits for bus masters 32-63 (1 bit per master)

DLMU_SPROT_RGNACCENAi_R - DLMU Region Read Access Enable - Address: 0xE288 + i*0x10 (where i = 0-7) - Reset Value: Application dependent - Access: Read/Write, Supervisor mode only

Description: Controls read access permissions for specific bus masters to DLMU protection regions.

10.3 Access Control Registers

ACCEN0 - Access Enable Register 0 - Module: LMU, EMU, various peripherals - Reset Value: 0xFFFF_FFFF (all accesses enabled after reset) - Access: Read/Write, Safe Endinit protected

Bit Fields:

Bits Field Description
[31:0] EN0-EN31 Enable bits for TAG IDs 0-31 (EN0 = TAG ID 000000B, EN31 = TAG ID 011111B)

ACCEN1 - Access Enable Register 1 - Module: LMU, EMU, various peripherals - Reset Value: 0xFFFF_FFFF (all accesses enabled after reset) - Access: Read/Write, Safe Endinit protected

Bit Fields:

Bits Field Description
[31:0] EN32-EN63 Enable bits for TAG IDs 32-63 (EN32 = TAG ID 100000B, EN63 = TAG ID 111111B)

Important Notes: - Write accesses not permitted by ACCEN settings will error - ACCEN registers are "Safe Endinit" protected - After reset, all ACCEN1/0 registers allow access to entire addressable space for all masters - Application must initialize protection ranges and permissions adapted to software architecture

10.4 ECC Control Registers

HF_ECCC - Flash ECC Control Register (DMU) - Module: DMU (Data Flash) - Address: 0x0000_0048 (offset from DMU base) - Access: Hardware Update, Software Read

HF_ECCW - Flash ECC Write Register (DMU) - Module: DMU (Data Flash) - Address: 0x0000_004C (offset from DMU base) - Access: Write

SSH ECCS - SRAM Support Hardware ECC Status Register - Module: CPU Subsystem (LMU, DSPR, PSPR) - Description: Controls ECC enable/disable for various memory regions - Access: Read/Write

10.5 RAM Initialization Registers

RAM_INIT_RS - RAM Initialization Status - Location: Various memory controllers - Description: Bit indicating RAM initialization status after reset - Values: - 0: RAM is not initialized after reset - 1: RAM is initialized after reset

MCSR - Memory Control and Status Registers - Module: Various memory blocks - Fields: - INIT: Initialization status bit - LOCK: Prevents modification of initialization settings - READY: Indicates memory is ready for use

10.6 Register Access Protection Summary
Register Type Protection Access Mode Notes
DIETR/DIEAR None U,SV,32 Application reset
SPR_SPROT Supervisor only U,SV,32 Requires PSW.S = 1
ACCEN0/1 Safe Endinit SV,32 Protected initialization
MCSR.LOCK Write-once SV Prevents runtime changes
SSH ECCS Supervisor SV Memory-specific

Legend: - U: User mode access possible - SV: Supervisor mode required - 32: 32-bit access - Safe Endinit: Special protection requiring write access enable

Best Practices for Implementation

  1. Enable ECC by Default: ECC is enabled by default and should remain active for safety-critical applications
  2. Configure SMU Alarms: Set up appropriate SMU alarm handlers for all RAM safety events
  3. Monitor SMU Alerts: Implement appropriate handlers for ECC and address fault notifications
  4. Initialize MCSR: Ensure all RAM segments are properly initialized before use
  5. Implement Periodic Tests: Complement hardware mechanisms with software-based memory tests
  6. Use Locking Mechanisms: Leverage LML and MCSR.LOCK to prevent runtime misconfiguration
  7. Validate Port Protection: Ensure port protection is configured for multi-core systems
  8. Handle DIETR/DIEAR: Implement trap handlers to process data integrity error information
  9. Configure SPR Regions: Set up safety protection regions for memory isolation
  10. Monitor Correctable Errors: Track CE alarms to predict potential failures before they become critical
  11. Test Error Paths: Verify error handling mechanisms during integration testing
  12. Document Recovery Strategies: Define clear recovery procedures for each error type

References and Further Reading

Conclusion

The AURIX TC3xx RAM safety mechanisms provide comprehensive protection against memory faults through a multi-layered approach combining ECC, address monitoring, address error monitoring, SMU integration, port protection, write/read compare mechanisms, and hardware-based testing. Proper configuration and monitoring of these mechanisms is essential for achieving functional safety compliance in automotive applications.


Last Updated: January 27, 2026

AURIX TC3xx RAM 安全机制:全面概述

AURIX TC3xx RAM 安全机制:全面概述

AURIX TC3xx 系列实现了多层基于硬件的 RAM 安全机制,用于检测和管理随机硬件故障,支持按照 ISO 26262 标准达到 ASIL-D 等级。本文全面介绍了片上存储器的主要安全特性。

1. 错误检测与纠正 (ECC)

主要存储器保护: - ECC 实现:单比特错误纠正、双比特错误检测 - 覆盖范围:本地 CPU 特定 RAM (LCSR)、暂存 RAM、DSPR、PSPR、Flash 存储器和 DMI - 自动运行:ECC 错误在读操作期间自动纠正;检测会触发 SMU 告警 - 多比特错误跟踪:累积可纠正错误以在潜在故障发生前进行预测

关键 ECC 寄存器: - 每个带有 ECC 的存储器都有专用的控制/状态寄存器用于错误监控 - SMU 集成确保立即的故障响应

2. 地址监控 (MBAR)

非法访问检测: - MBAR 功能:存储器后台访问寄存器监控非法寻址 - 检测逻辑:检测可能访问错误存储器位置的多比特地址故障 - 硬件集成:与 MPU 协作提供全面的地址故障覆盖 - SMU 报告:当地址违规发生时触发安全告警

3. 地址错误监控器

地址故障检测: - 多比特地址故障检测:监控地址总线多比特错误 - 后台访问监控:在后台操作期间持续检查地址有效性 - 与 MBAR 集成:与 MBAR 协作提供全面的地址故障覆盖 - 故障包含:防止地址错误传播到存储器访问

关键特性: - 检测地址解码器故障 - 识别地址线 stuck-at 故障 - 监控瞬态地址错误 - 向 SMU 实时报告地址故障

4. RAM 安全的 SMU 集成

安全监控单元集成: - 告警配置:RAM 安全机制在检测到故障时触发 SMU 告警 - 故障响应:可配置的响应,包括系统复位、安全状态进入或通知 - 告警优先级:不同的 RAM 故障具有不同的优先级 - 故障收集:SMU 收集并管理所有 RAM 安全事件

常见的 RAM 相关 SMU 告警: - ECC 单比特错误:可纠正错误,记录用于监控 - ECC 多比特错误:不可纠正错误,通常触发复位 - 地址错误:检测到非法访问,触发保护陷阱 - MBAR 违规:检测到存储器后台访问违规

详细的 RAM 告警分类:

1. 可纠正错误告警 (CE): - 触发:执行 ECC 单比特错误纠正 - 严重性:非关键,潜在故障指示 - 操作:记录用于监控和趋势分析 - 响应:通常仅通知 - 目的:在故障发生前进行预测性维护

2. 不可纠正错误告警 (UCE): - 触发:ECC 双比特错误检测或 RAM 地址错误检测 - 严重性:关键,立即故障指示 - 操作:触发可配置的故障响应 - 响应:系统复位、安全状态进入或陷阱 - 目的:防止损坏的数据传播

3. 杂项错误告警 (ME): - 触发:非关键(潜在)故障检测 - 严重性:低,警告指示 - 操作:记录用于诊断目的 - 响应:通知或监控 - 目的:潜在退化的早期警告

/**
 * @brief 为 RAM 安全机制配置 SMU 告警
 */
void configure_ram_smu_alarms(void) {
    // ECC 单比特错误告警 - 仅通知
    smu_configure_alarm(SMU_ALARM_ECC_1BIT, SMU_ACTION_NOTIFICATION);

    // ECC 多比特错误告警 - 系统复位
    smu_configure_alarm(SMU_ALARM_ECC_2BIT, SMU_ACTION_RESET);

    // 地址错误告警 - 保护陷阱
    smu_configure_alarm(SMU_ALARM_ADDR_ERR, SMU_ACTION_TRAP);

    // MBAR 违规告警 - 安全状态
    smu_configure_alarm(SMU_ALARM_MBAR_VIOL, SMU_ACTION_SAFE_STATE);
}

5. RAM 的端口保护

总线级访问控制: - 基于端口的保护:在总线主设备级别控制 RAM 访问 - SRI 标签 ID 验证:在授予 RAM 访问权限前验证总线主设备 ID - 多核隔离:防止未授权的核心访问特定 RAM 区域 - DMA 访问控制:将 DMA 通道限制到授权的存储器区域

保护级别: - 读保护:按总线主设备控制读访问 - 写保护:按总线主设备控制写访问 - 执行保护:控制代码区域的执行权限

5.1 安全保护区域 (SPR)

高级存储器访问控制: - SPR_SPROT_RGNLAi:定义 PSPR/DSPR 中保护区域的下限地址 - SPR_SPROT_RGNUAi:定义保护区域的上限地址 - SPR_SPROT_RGNACCENi:定义允许访问每个区域的 SRI 标签 - 基于区域的隔离:可以配置多个保护区域 - 细粒度控制:每个区域和总线主设备的单独访问控制

访问使能寄存器: - ACCEN0/ACCEN1:控制具有特定 TAG ID 的事务的写访问 - 6 位 TAG ID 支持:为 6 位 TAG ID 编码准备 - 位映射:EN0 → TAG ID 000000B 至 EN31 → TAG ID 011111B - 访问违规:寄存器设置不允许的写访问将出错

6. 写/读比较机制

软错误检测: - 写比较:验证写入的数据与预期数据是否匹配 - 读比较:后台读操作以检测存储器单元退化 - 自动执行:由硬件执行,无需软件干预 - 定期测试:持续监控瞬态故障

7. 存储器控制与状态寄存器 (MCSR)

初始化与监控: - RAM 初始化:MCSR 位指示 RAM 是否已正确初始化 - 状态报告:提供存储器初始化状态的可见性 - 安全要求:未初始化 RAM 检测防止使用不可靠的存储器 - 硬件锁定:MCSR.LOCK 防止意外修改初始化设置 - RAM_INIT_RS:复位后 RAM 初始化状态指示位(0 = 未初始化,1 = 已初始化)

7.1 数据完整性错误跟踪

错误定位与报告: - DIETR(数据完整性错误陷阱寄存器):捕获错误类型和位置 - IE_S:暂存 RAM 中的错误 - IE_C:缓存 RAM 中的错误 - IE_T:标签 RAM 中的错误 - IE_LPB:本地外设总线存储器中的错误 - IE_DLMU:分布式本地存储器单元中的错误 - IE_UNC:指示不可纠正错误条件 - E_INFO:缓存错误的缓存路信息

  • DIEAR(数据完整性错误地址寄存器):包含导致不可纠正错误的访问的物理地址
  • 仅在 DIETR.IED 为零时更新
  • 启用精确的错误定位以进行调试和恢复
  • 对故障分析和系统恢复策略至关重要

错误处理流程: 1. 存储器读操作期间检测到错误 2. DIETR 寄存器更新错误类型和位置 3. DIEAR 捕获失败地址(如适用) 4. 设置 IED 位,其他 DIETR 位设置为零 5. 为不可纠正错误引发异步 DIE 陷阱 6. 陷阱处理程序负责恢复或系统复位

8. 本地存储器管理

CPU 特定存储器特性: - LML (本地存储器锁定):锁定特定存储器区域以防止未授权访问 - LSR (本地休眠):控制本地存储器的休眠模式以防止在非活动期间访问 - 双端口 RAM 支持:支持内核间安全共享存储器访问,具有内置仲裁 - 内置测试逻辑:存储器完整性的硬件自测试

8.1 分布式 LMU (DLMU) 保护

增强的存储器安全: - ECC 保护基础:DLMU 存储器的 64 位(双字)基础 - SSH ECCS 寄存器:控制 DLMU 的 ECC 启用/禁用 - 错误检测:为每个双字生成不可纠正错误信号 - 陷阱响应:错误检测时引发异步 DIE 陷阱 - 双重访问路径:通过 TriCore CPU 和总线接口(PMI/SRI)进行受保护访问

DLMU 的错误处理: - CPU 加载请求:ECC 位与数据一起读取,错误标记到 CPU - 总线接口访问:PMI 和 SRI 访问的单独错误检测 - 恢复选项:陷阱处理程序可以纠正存储器条目或启动系统复位

8.2 暂存 RAM (DSPR/PSPR) 保护

16 位 ECC 保护: - ECC 粒度:ECC 保护的 16 位数据宽度 - 读-修改-写:字节写操作作为读-修改-写操作执行 - 错误检测:读阶段的错误阻止写阶段执行 - 未初始化存储器:对未初始化存储器的字节写操作始终检测到 ECC 错误

存储器组织: - 塔式结构:DSPR 组织为多个存储器"塔" - 64 位访问:CPU 可以从任何 16 位对齐地址访问 64 位数据 - SRI 从站访问:通过 SRI 接口支持多核访问 - 突发传输:兼容所有 SRI 事务类型

8.3 缓存存储器保护

全面的 ECC 覆盖: - 数据缓存 (DCACHE):所有缓存 SRAM 受 ECC 保护 - 标签 SRAM:所有标签 SRAM 受 ECC 保护 - 缓存行结构:每行 256 位数据 + ECC 位 - 错误信令:在 ECC 解码器检测到的错误通过 SSH 逻辑信令到 EMM - 双路组相联:LRU 替换算法,每行具有有效/脏位

9. 安全触发器

额外保护层: - SFF 保护:CPU 和外设 RAM 中的关键触发器受到针对瞬态故障的保护 - 自动检测:硬件检测触发器状态变化 - 立即响应:检测时触发 SMU 告警

安全机制分类

根据功能安全文档,RAM 安全机制分类如下:

安全机制 (SM): - 可由 MCU 内部软件或硬件处理 - 包括 ECC、地址监控、MBAR、地址错误监控器、写/读比较机制

外部安全机制 (ESM): - 需要系统级软件或硬件解决方案 - 包括定期存储器测试和基于软件的完整性检查

RAM 安全机制相关寄存器

本节提供 AURIX TC3xx 中用于 RAM 安全的关键寄存器的详细信息。

10.1 数据完整性错误寄存器

CPUx_DIETR - 数据完整性错误陷阱寄存器 - 地址:0x19024(短地址:0x9024) - 复位值:0x0000_0000 - 访问:读/写

位字段:

位 字段 描述
[31:24] - 保留
[23] IE_MT 存储器测试中的错误(在此上下文中未使用)
[22] IE_S 暂存 RAM (DSPR/PSPR) 中的错误
[21] IE_C 缓存 RAM 中的错误
[20] IE_T 标签 RAM 中的错误
[19] IE_LPB 本地外设总线存储器中的错误
[18] IE_DLMU 分布式本地存储器单元中的错误
[17] IE_UNC 检测到不可纠正错误条件
[16:12] E_INFO 缓存路信息(当 IE_C 置位时)
[11:1] - 保留
[0] IED 中断错误检测 - 捕获错误时置位,直到软件清除前禁止进一步更新

CPUx_DIEAR - 数据完整性错误地址寄存器 - 地址:0x19020(短地址:0x9020) - 复位值:0x0000_0000 - 访问:读/写

位字段:

位 字段 描述
[31:0] TA 陷阱地址 - 导致不可纠正错误的访问的物理地址

使用说明: - DIETR 仅在 IED 位为零时更新 - IED 置位后,直到软件清除前不会发生进一步的硬件更新 - DIEAR 仅在 DIETR.IED 为零时更新 - 这些寄存器支持精确的错误定位以进行调试和恢复

10.2 存储器保护寄存器

SPR_SPROT_RGNLAi - 安全保护区域下限地址 - 地址:0xE000 + i*0x4(其中 i = 0-7) - 复位值:应用相关 - 访问:读/写,仅监控模式

描述:定义 PSPR/DSPR 存储器中安全保护区域的下限地址边界。

SPR_SPROT_RGNUAi - 安全保护区域上限地址 - 地址:0xE020 + i*0x4(其中 i = 0-7) - 复位值:应用相关 - 访问:读/写,仅监控模式

描述:定义 PSPR/DSPR 存储器中安全保护区域的上限地址边界。

SPR_SPROT_RGNACCENAi_W - 区域访问使能寄存器 A(写) - 地址:0xE040 + i*0x8(其中 i = 0-7) - 复位值:0x000000- 访问:读/写,仅监控模式

位字段:

位 字段 描述
[31:0] EN 总线主设备 0-31 的使能位(每个主设备 1 位)

SPR_SPROT_RGNACCENBi_W - 区域访问使能寄存器 B(写) - 地址:0xE044 + i*0x8(其中 i = 0-7) - 复位值:0x000000- 访问:读/写,仅监控模式

位字段:

位 字段 描述
[31:0] EN 总线主设备 32-63 的使能位(每个主设备 1 位)

DLMU_SPROT_RGNACCENAi_R - DLMU 区域读访问使能 - 地址:0xE288 + i*0x10(其中 i = 0-7) - 复位值:应用相关 - 访问:读/写,仅监控模式

描述:控制特定总线主设备对 DLMU 保护区域的读访问权限。

10.3 访问控制寄存器

ACCEN0 - 访问使能寄存器 0 - 模块:LMU、EMU、各种外设 - 复位值:0xFFFF_FFFF(复位后所有访问都使能) - 访问:读/写,安全 Endinit 保护

位字段:

位 字段 描述
[31:0] EN0-EN31 TAG ID 0-31 的使能位(EN0 = TAG ID 000000B,EN31 = TAG ID 011111B)

ACCEN1 - 访问使能寄存器 1 - 模块:LMU、EMU、各种外设 - 复位值:0xFFFF_FFFF(复位后所有访问都使能) - 访问:读/写,安全 Endinit 保护

位字段:

位 字段 描述
[31:0] EN32-EN63 TAG ID 32-63 的使能位(EN32 = TAG ID 100000B,EN63 = TAG ID 111111B)

重要说明: - ACCEN 设置不允许的写访问将出错 - ACCEN 寄存器受"安全 Endinit"保护 - 复位后,所有 ACCEN1/0 寄存器允许所有主设备访问整个可寻址空间 - 应用必须初始化适合软件架构的保护范围和权限

10.4 ECC 控制寄存器

HF_ECCC - Flash ECC 控制寄存器 (DMU) - 模块:DMU(数据 Flash) - 地址:0x0000_0048(从 DMU 基地址偏移) - 访问:硬件更新,软件读

HF_ECCW - Flash ECC 写寄存器 (DMU) - 模块:DMU(数据 Flash) - 地址:0x0000_004C(从 DMU 基地址偏移) - 访问:写

SSH ECCS - SRAM 支持硬件 ECC 状态寄存器 - 模块:CPU 子系统(LMU、DSPR、PSPR) - 描述:控制各种存储器区域的 ECC 使能/禁用 - 访问:读/写

10.5 RAM 初始化寄存器

RAM_INIT_RS - RAM 初始化状态 - 位置:各种存储器控制器 - 描述:复位后 RAM 初始化状态指示位 - 值: - 0:复位后 RAM 未初始化 - 1:复位后 RAM 已初始化

MCSR - 存储器控制与状态寄存器 - 模块:各种存储器块 - 字段: - INIT:初始化状态位 - LOCK:防止修改初始化设置 - READY:指示存储器准备好使用

10.6 寄存器访问保护摘要
寄存器类型 保护 访问模式 说明
DIETR/DIEAR 无 U,SV,32 应用复位
SPR_SPROT 仅监控 U,SV,32 需要 PSW.S = 1
ACCEN0/1 安全 Endinit SV,32 受保护的初始化
MCSR.LOCK 一次性写入 SV 防止运行时更改
SSH ECCS 监控 SV 存储器特定

图例: - U:可能用户模式访问 - SV:需要监控模式 - 32:32 位访问 - 安全 Endinit:特殊保护,需要写访问使能

实现最佳实践

  1. 默认启用 ECC:ECC 默认启用,对于安全关键应用应保持活动状态
  2. 配置 SMU 告警:为所有 RAM 安全事件设置适当的 SMU 告警处理程序
  3. 监控 SMU 告警:为 ECC 和地址故障通知实现适当的处理程序
  4. 初始化 MCSR:确保所有 RAM 段在使用前正确初始化
  5. 实施定期测试:通过基于软件的存储器测试补充硬件机制
  6. 使用锁定机制:利用 LML 和 MCSR.LOCK 防止运行时错误配置
  7. 验证端口保护:确保为多核系统配置了端口保护
  8. 处理 DIETR/DIEAR:实现陷阱处理程序以处理数据完整性错误信息
  9. 配置 SPR 区域:设置安全保护区域以进行存储器隔离
  10. 监控可纠正错误:跟踪 CE 告警以在潜在故障变得严重之前进行预测
  11. 测试错误路径:在集成测试期间验证错误处理机制
  12. 记录恢复策略:为每种错误类型定义明确的恢复程序

参考资料与延伸阅读

结论

AURIX TC3xx RAM 安全机制通过多层方法提供全面的存储器故障保护,结合了 ECC、地址监控、地址错误监控器、SMU 集成、端口保护、写/读比较机制和基于硬件的测试。正确配置和监控这些机制对于在汽车应用中实现功能安全合规至关重要。


最后更新:2026年1月27日