cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

Esteemed Contributor

Doing the following -

#define CYDEV_EE_BASE 0x40008000u        // This is Creator generated

uint8   nSavedEE = 0;

I get a warning on line 420, but does not show up in warnings notice window after compile., Still stays however

when doing further code work. Warning shown below.

pastedImage_1.png

Regards, Dana.

0 Likes
Reply
1 Solution
Employee

Dana,

At first, the compiler converted the 32-bit (unsigned int) value 0x40008000 (1073774592) into a 16-bit (unsigned short) value 0x8000 (32768) to pass the value to the function EEPROM_ReadByte() as the argument.

The function receives a 16-bit value 0x8000 (32768) and calculates the actual address as following statement.

    retByte = *((reg8 *) (CYDEV_EE_BASE + address));

So, the returned value will be read from 0x40010000 which is a "Digital interconnect configuration" register area.

I don't know why you think the program is working fine.

But this is an incorrect use of EEPROM_ReadByte() function.

Anyway, EEPROM_WriteByte() function has a protection not to access an invalid address.  So, the "Digital interconnect configuration" are will not be destroyed.

Regards,

Noriaki

View solution in original post

0 Likes
Reply
4 Replies
Employee

Dana,

Following is the description in the EEPROM component datasheet.

GS004850.png

The argument address of this API function indicates the offset address of an EEPROM block starting from 0x0000.

So, if you want to access the first byte, 0x0000 should be provided to the argument.

Regards,

Noriaki

0 Likes
Reply
Esteemed Contributor

The define, cypress generated, was used in the f() call, so it had the

correct address. So still leaves us with why are we getting a warning ?

Regards, Dana.

0 Likes
Reply
Employee

Dana,

At first, the compiler converted the 32-bit (unsigned int) value 0x40008000 (1073774592) into a 16-bit (unsigned short) value 0x8000 (32768) to pass the value to the function EEPROM_ReadByte() as the argument.

The function receives a 16-bit value 0x8000 (32768) and calculates the actual address as following statement.

    retByte = *((reg8 *) (CYDEV_EE_BASE + address));

So, the returned value will be read from 0x40010000 which is a "Digital interconnect configuration" register area.

I don't know why you think the program is working fine.

But this is an incorrect use of EEPROM_ReadByte() function.

Anyway, EEPROM_WriteByte() function has a protection not to access an invalid address.  So, the "Digital interconnect configuration" are will not be destroyed.

Regards,

Noriaki

View solution in original post

0 Likes
Reply
Esteemed Contributor

Thank you so much. I came to realize debugging last night the APIs "masked"

the base address from the user, so user did not need that in his EEPROM address

calculation APIs to gain access to EEPROM address. Only if user is doing absolute

address calculations does one need this base address value in his calculations.

To wit I was not paying attention to your original post.

Thanks again.

Regards, Dana.

0 Likes
Reply