ECC
ECC stands for error-correcting code. Memory chips use ECC to detect and correct bit errors, which can be caused by production (e.g., faults or aging). It is used with non-volatile flash memory as well as volatile RAM memory.
ECC works by generating and storing an ECC code in a memory-write process, and verifying code on a memory-read. Due to this process, ECC memory can be read only after it is written.
Handling ECC with flash memory
With ECC flash memory, J-Link software must be set up to prevent memory reading from taking place before writing. This can be done by executing multiple J-Link command strings.
The following snippet of J-Link script code will set up necessary options for ECC protected flash memory:
void ConfigTargetSettings(void) {
JLINK_ExecCommand("SetCompareMode=0"); // Make sure that J-Link SW does not try to compare before programming
JLINK_ExecCommand("SetFlashDLNoRMWThreshold=0"); // Make sure that the J-Link SW does not perform a read-modify-write
JLINK_ExecCommand("SetDisableSkipBlankDataOnProg=1"); // Make sure that areas filled with blank data are also programmed by J-Link SW
JLINK_ExecCommand("DisableFlashBPs"); // Because of enabled interrupts and RAM is used for flash programming, we cannot allow flash breakpoints
return 0;
}
For detailed information about J-Link command strings, refer to the J-Link Command Strings article
ECC RAM
ECC RAM is not readable after a reset, due to missing ECC code. J-Link software offers a convenient method for initializing a device's work RAM during connection in order to allow initial read access. While the work-RAM area is specified with device information within the J-Link software, it is adjustable via the J-Link command string 'SetWorkRAM'.
The following snippet of J-Link script code will initialize the work RAM:
void ConfigTargetSettings(void) {
JLINK_ExecCommand("SetInitWorkRAMOnConnect = 1"); // Work RAM will be initialized on connect
return 0;
For detailed information regarding SetInitWorkRAMOnConnect refer to the J-Link Command Strings article.
To attach to a running application, the ECC RAM initialization is unnecessary and will crash the application in most cases. Your preferred IDE will normally makes all settings automatically. In order to suppress the RAM initialization in J-Link Commander you can set ForceAttachTarget in front of the connect:
J-Link>exec ForceAttachTarget=1 // This will disable the WorkRAM init on connect