NOLOAD attribute for PSoC6

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

cross mob
akrupaa
Level 2
Level 2
5 replies posted 5 questions asked 10 sign-ins

Good morning,

I have simple question: how not to program selected section of Flash? I added NOLOAD attribute to linker script in both cores, but it does not work.

    /* Emulated EEPROM Flash area */
    .cy_em_eeprom (NOLOAD) :
    {
        KEEP(*(.cy_em_eeprom))
    } > em_eeprom

 I am working on CY8C6247BZI-D34 microcontroller.

Yours faithfully,
akrupaa

0 Likes
1 Solution
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @akrupaa ,

I believe the main cause of your issue is because the programmer will erase the whole flash of the Chip before programming the same irrespective of the NOLOAD section in the linker script since at this point it does not check the linker script to skip any area of the flash but simply does a full erase and hence your em_eeprom section is not able to retrain any data during programming.

Please refer to the following thread for more information on this:
https://community.infineon.com/t5/PSoC-6/PSoC6-amp-PDL-em-EEPROM-does-not-retain-data-on-reset/td-p/...

Warm Regards
Alen

View solution in original post

3 Replies
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @akrupaa ,

Can you please let me know how you verified that the NOLOAD attribute is not working for the section of code you shared?

Warm Regards
Alen

0 Likes

Hi @AlenAn14,

I verified it in simple way.

Code:

// main
cy_en_em_eeprom_status_t status = PSoC_EEPROM_Init(0);

status = PSoC_EEPROM_Read(APPLICATION_INFO_OFFSET, &readAppInfo, sizeof(readAppInfo));

// a few lines of code later...
// write to EEPROM
cy_en_em_eeprom_status_t status = PSoC_EEPROM_Write(APPLICATION_INFO_OFFSET, app_info, sizeof(flash_application_info_t));

Linker script:

/*
* Memory regions, for each application and MCU core.
*/
MEMORY
{
...
em_eeprom         (rx)  : ORIGIN = 0x14000000, LENGTH = 0x8000
...
}

...

/* Emulated EEPROM Flash area */
.cy_em_eeprom (NOLOAD) :
{
    KEEP(*(.cy_em_eeprom))
} > em_eeprom

 

Firstly I do PSoC_EEPROM_Init which init EEPROM located in  .cy_em_eeprom (NOLOAD)  section.
Then I am reading data, at first boot there is not data.
Later I am writing data to EEPROM.
Then I am restarting MCU.
Init -> Read -> struct already contains data. 🙂 (GOOD)
___
Now I program MCU with the same code with PSoC Creator.
I am Init and then Read data from EEPROM.
Result: There is no data. (WRONG)

I go even deeper than that. I launch debug and watch the memory.
Result: 00000000000, there is no data. (WRONG)

Summary: PSoC Creator program MCU with zeros even if NOLOAD is present in Linker Script for cy_em_eeprom section.

 

Yours faithfully,
akrupaa

0 Likes
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @akrupaa ,

I believe the main cause of your issue is because the programmer will erase the whole flash of the Chip before programming the same irrespective of the NOLOAD section in the linker script since at this point it does not check the linker script to skip any area of the flash but simply does a full erase and hence your em_eeprom section is not able to retrain any data during programming.

Please refer to the following thread for more information on this:
https://community.infineon.com/t5/PSoC-6/PSoC6-amp-PDL-em-EEPROM-does-not-retain-data-on-reset/td-p/...

Warm Regards
Alen