Mi-V Embedded RISC-V - OPSRV Interrupt Register and TCM ECC Management example? #11
-
Hi, I'm using a MiV32I core in RTG4. At the boot stage, the TCM RAM is considered as an unknown state, the ECC errors (correctable and uncorrectable) are already raised which is correct. But, when we enable the OPSRV interrupts, in trap is raised. This is a false ECC error as the TCM RAM isn't initialized yet. Probably, you have already a recipe of how to manage the OPSRV/ECC interrupt in assembler ? Thanks for your help, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
there is an explanation of the ECC configuration for GPRs and TCM in section 4.14 of the core handbook which will probably be useful here.
volatile uint32_t *tcm_addr;
tcm_addr = 0x40000000; // Memory mapped start address of TCM
uint32_t tcm_end_addr = 0x40002000; // Memory mapped end address of TCM
while (tcm_addr != tcm_end_addr){ // loop until end is reached
*tcm_addr = 0x0; // write 0 to memory location tcm_addr = tcm_addr + 0x1; // increment pointer
}
volatile uint32_t *tcm_addr;
tcm_addr = 0x40000000; // Memory mapped start address of TCM
uint32_t tcm_end_addr = 0x40002000; // Memory mapped end address of TCM
while (tcm_addr != tcm_end_addr){
*tcm_addr = *tcm_addr;
tcm_addr = tcm_addr + 0x1;
}
I hope this helps 🙂 In terms of assembly, something like the following should work to initialize to 0: la a4, __tcm_start
la a5, __tcm_end
.init_tcm
sw x0, 0(a4)
add a4, a4, 4
blt a4, a5, .init_tcm or to generate parity for existing data: la a4, __tcm_start
la a5, __tcm_end
.init_tcm
lw t0, 0(a4)
sw t0, 0(a4)
add a4, a4, 4
blt a4, a5, .init_tcm |
Beta Was this translation helpful? Give feedback.
Hi @patricevenant
there is an explanation of the ECC configuration for GPRs and TCM in section 4.14 of the core handbook which will probably be useful here.