Using the Emulated EEPROM Component in a Bootloadable Project - KBA89149

Version: *A

 

Question:

When you use the Emulated EEPROM Component in a bootloadable project, PSoC® gets stuck in the bootloader code on subsequent power on or reset. What is the reason for this? Is there a workaround for this issue?

 

Answer:

The Emulated EEPROM Component emulates an EEPROM device in the flash memory of PSoC, providing simplified access to nonvolatile memory. You can use this Component to update flash in the bootloadable project.

 

When PSoC 3 , PSoC 4 or PSoC 5LP boots up, the bootloader code tests the checksum of the bootloadable code. If the checksum does not match the stored value corresponding to the original download of the bootloadable project, the bootloader does not transfer control to the bootloadable project. Because the Emulated EEPROM Component can update flash, the bootloadable project checksum may no longer match and the bootloadable project does not execute.

 

To work around this, you can use the following feature available in PSoC Creator™. In the project, double-click the Bootloader Component configuration window and select the check box called Fast bootloadable application validation. When this parameter is enabled, the bootloader calculates the flash checksum only once when the new bootloadable code (application code) is downloaded. Then, a nonvolatile flag is set to indicate that the checksum matches, so that the bootloader does not compute the checksum on further resets. This gives the application code the freedom to update the flash using Emulated EEPROM.

 

Figure 1. Bootloader Component Configuration Window

 

KBA89149

 

Another workaround is to use the new option available with the latest Bootloadable Component – Checksum exclude section (bytes) as shown in Figure 2. When this option is enabled, a section with the name “cy_checksum_exclude” is added in the cm3gcc.ld linker script file of the bootloadable project with the size equal to the value set in the Component. Now, you can point the flash variables or the Emulated EEPROM data to this section using the method explained in AN89610.

 

Figure 2. Checksum exclude section in Bootloadable component

 

2.png

 

After locating the array at this section, you can also write data to this section using the flash row APIs. Use the rows which will be used by this section while writing to Flash. Ensure that the Checksum Exclude Section Size is a multiple of Flash Row Size. Refer the System Reference Guide for more details on the Flash Write APIs.