I created my own bootloader,not using HALcogen.
When I perform an ECC check for flash, I can see that the code catches 1 bit errors to flash in ESMSR1, but it doesn't catch 2-bit errors to flash, even though it cacthes 2-bit errors in RAM.
I'm certainly missing a setting, but I don't see where.
void checkFlashECC() { volatile uint32_t flashRead; F021Reg->FEDACTRL1 = 0x000A060AU; /*Configuration of registers for the flash ECC check*/ F021Reg->FPAR_OVR = 0x00005A01U; F021Reg->FDIAGCTRL = 0x01050007U; /*Configure and enable diagnostic mode*/ flashRead = (*(volatile uint32_t *)0x20000000); /*Causes a 1-bit ECC error*/ F021Reg->FDIAGCTRL = 0xA0007U; /*Disable diagnostic mode*/ if (!(F021Reg->FEDACSTATUS & 0x2)) { /*If the error wasn't caught by this register, then the boot process cannot continue*/ while(1); } else { F021Reg->FEDACSTATUS = 0x2U; /*Clears status flag*/ ESMReg->ESMSR1 = 0x40U; /*Clears ESM flag*/ /*Now the code must reset the ECC check for a 2-bit error*/ F021Reg->FDIAGCTRL = 0x50007U; /*Configure diagnostic mode*/ F021Reg->FPAR_OVR = 0x00005A03U; F021Reg->FDIAGCTRL |= 0x01000000U; /*Enable diagnostic mode*/ flashRead = (*(volatile uint32_t *)0x20000010); /*Causes a 2-bit ECC error*/ flashRead = F021Reg->FUNC_ERR_ADD; /*Reads func error address to clear it*/ F021Reg->FDIAGCTRL = 0x000A0007; } }
I compared it to the one created by HALcogen and I noticed that they are practically identical. I checked both start ups (especially the asm files) and they do the exact same thing. Maybe I'm not setting a register correctly? Any ideas?