大家好、团队、
我正在尝试实现 用于中断矢量表 ECC 测试的 ECC 检查机制。 在 ECC 位中手动插入故障、并检查 TRM 中提到的 ESM 功能、如下所示
应使用以下序列将故障注入数据位并测试 ECC 检查功能。
1、在保持 ECCENA 激活的同时、用所需的模式写入 VIM RAM 的数据位置。 。
ECC 位将与数据位一起自动初始化。
2.通过在 ECCCTRL 寄存器中设置 ECCENA=0来禁用 ECC。 在这种模式下、写入数据位不会
自动更新 ECC 位。
3.在这种模式下,可以使用以下任何方法来破坏数据位。
•读取数据位、翻转一位并写回
•读取数据位、翻转2位并写回
4.根据所创建的损坏类型,读回数据位并检查校正错误
(单位错误或双位错误或无错误)。
5、读取 UERRADDR 和 SBERRADDR 寄存器、并检查地址捕获是否正确。
问题:
- 第一点所需模式的含义是什么?如何选择数据位置? 请提供一个示例
- 如何完成数据位的读写操作? 是否使用任何寄存器完成?
我被困在这些位置。请看下面的代码
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* Include Files */
#include "HL_sys_common.h"
/* USER CODE BEGIN (1) */
#include "HL_reg_vim.h"
#include "HL_esm.h"
#include "HL_gio.h"
#include "HL_reg_esm.h"
#include "HL_sys_vim.h"
#include "HL_system.h"
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
#define VIM_CHANNEL 20U
#define vimRAM ((vimRAM_t *)0xFFF82000U)
/* USER CODE END */
int main(void)
{
/* USER CODE BEGIN (3) */
uint32 index_value;
uint32 channel_address;
esmInit();
vimInit();
//esmGroup1Notification(esmREG,esmREG->SR1[2]);
vimREG->ECCCTL = (uint32)((uint32)0xA << 0U | /* VIM ECC is enabled */
(uint32)0x5 << 8 | /* Enable memory-mapping of ECC bits for read/write operation */
(uint32)0xA << 16 | /* Enable correction of SBE detected by the SECDED block */
(uint32)0xA << 24); /* Enable Error Event upon detection of SBE the Interrupt Vector Table */
//Result after bitwise operation : 1010 0000 1010 0000 0101 0000 1010
//Read 32 bit volatile register
index_value = vimREG->IRQINDEX;
