Eeprom and ble with bootloader

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ErGo_3681856
Level 1
Level 1

I am using the CY8C4248LQI-BL483. I managed to get the EEPROM example "PSoC_EmEEPROM_PSOC401" up and running on my MCU, and I can see the reset count printing out a higher number after each reset.

However, I copy-pasted the code from main.c into my own custom project which has a bootloader and bootable/upgradable stack. When I run the project now the read EEPROM lines only load 0x00 into the array. The end result of this is that nothing prints out. What am I missing? Does the Emulated EEPROM not work with a bootloader?

//Small section of code:

        DBG_PRINTF("Writing updated count\n\r");

        /*Only update the two count values in the EEPROM*/

        eepromReturnValue = Em_EEPROM_1_Write(RESET_COUNT_LOCATION, &eepromArray[RESET_COUNT_LOCATION], RESET_COUNT_SIZE);

        if(eepromReturnValue != CY_EM_EEPROM_SUCCESS)

        {

            HandleError();

        }

    DBG_PRINTF("Reading updated value\n\r");

    eepromReturnValue = Em_EEPROM_1_Read(LOGICAL_EEPROM_START, eepromArray, LOGICAL_EEPROM_SIZE);

    if(eepromReturnValue != CY_EM_EEPROM_SUCCESS)

   

    /*Print EEPROM contents to console*/

    eepromArray[LOGICAL_EEPROM_SIZE] = '\0';

    DBG_PRINTF((char *)eepromArray);

    DBG_PRINTF("\n\r");

0 Likes
1 Solution
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Bootloader and bootloadable projects have checksum validation to ensure image integrity. As Emulated EEPROM updates the flash content, the checksum vary over life. So user needs to follow one of the approaches mentioned in Using the Emulated EEPROM Component in a Bootloadable Project - KBA89149

View solution in original post

0 Likes
2 Replies
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Bootloader and bootloadable projects have checksum validation to ensure image integrity. As Emulated EEPROM updates the flash content, the checksum vary over life. So user needs to follow one of the approaches mentioned in Using the Emulated EEPROM Component in a Bootloadable Project - KBA89149

0 Likes

The actual answer turned out to be a need to update the EEPROM version to the latest and then do a clean rebuild. V2.2. The project needed to be cleaned.

After flash writes started working, then the KBA89149​ came into effect and started causing havoc with the bootloader. This was an easy fix, I simply added that the section placement was .cy_checksum_exclude:

const uint8_t Em_EEPROM_1_em_EepromStorage[Em_EEPROM_1_PHYSICAL_SIZE]

__ALIGNED(CY_FLASH_SIZEOF_ROW)  CY_SECTION(".cy_checksum_exclude") = {0u};

0 Likes